mirror of
https://github.com/go-gitea/gitea.git
synced 2025-09-01 05:22:50 +09:00
refactor: rename import alias
This commit is contained in:
@ -6,7 +6,7 @@ package actions
|
||||
import (
|
||||
"testing"
|
||||
|
||||
bots_model "code.gitea.io/gitea/models/actions"
|
||||
actions_model "code.gitea.io/gitea/models/actions"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
@ -14,93 +14,93 @@ import (
|
||||
func TestFullSteps(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
task *bots_model.BotTask
|
||||
want []*bots_model.BotTaskStep
|
||||
task *actions_model.BotTask
|
||||
want []*actions_model.BotTaskStep
|
||||
}{
|
||||
{
|
||||
name: "regular",
|
||||
task: &bots_model.BotTask{
|
||||
Steps: []*bots_model.BotTaskStep{
|
||||
{Status: bots_model.StatusSuccess, LogIndex: 10, LogLength: 80, Started: 10010, Stopped: 10090},
|
||||
task: &actions_model.BotTask{
|
||||
Steps: []*actions_model.BotTaskStep{
|
||||
{Status: actions_model.StatusSuccess, LogIndex: 10, LogLength: 80, Started: 10010, Stopped: 10090},
|
||||
},
|
||||
Status: bots_model.StatusSuccess,
|
||||
Status: actions_model.StatusSuccess,
|
||||
Started: 10000,
|
||||
Stopped: 10100,
|
||||
LogLength: 100,
|
||||
},
|
||||
want: []*bots_model.BotTaskStep{
|
||||
{Name: preStepName, Status: bots_model.StatusSuccess, LogIndex: 0, LogLength: 10, Started: 10000, Stopped: 10010},
|
||||
{Status: bots_model.StatusSuccess, LogIndex: 10, LogLength: 80, Started: 10010, Stopped: 10090},
|
||||
{Name: postStepName, Status: bots_model.StatusSuccess, LogIndex: 90, LogLength: 10, Started: 10090, Stopped: 10100},
|
||||
want: []*actions_model.BotTaskStep{
|
||||
{Name: preStepName, Status: actions_model.StatusSuccess, LogIndex: 0, LogLength: 10, Started: 10000, Stopped: 10010},
|
||||
{Status: actions_model.StatusSuccess, LogIndex: 10, LogLength: 80, Started: 10010, Stopped: 10090},
|
||||
{Name: postStepName, Status: actions_model.StatusSuccess, LogIndex: 90, LogLength: 10, Started: 10090, Stopped: 10100},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "failed step",
|
||||
task: &bots_model.BotTask{
|
||||
Steps: []*bots_model.BotTaskStep{
|
||||
{Status: bots_model.StatusSuccess, LogIndex: 10, LogLength: 20, Started: 10010, Stopped: 10020},
|
||||
{Status: bots_model.StatusFailure, LogIndex: 30, LogLength: 60, Started: 10020, Stopped: 10090},
|
||||
{Status: bots_model.StatusCancelled, LogIndex: 0, LogLength: 0, Started: 0, Stopped: 0},
|
||||
task: &actions_model.BotTask{
|
||||
Steps: []*actions_model.BotTaskStep{
|
||||
{Status: actions_model.StatusSuccess, LogIndex: 10, LogLength: 20, Started: 10010, Stopped: 10020},
|
||||
{Status: actions_model.StatusFailure, LogIndex: 30, LogLength: 60, Started: 10020, Stopped: 10090},
|
||||
{Status: actions_model.StatusCancelled, LogIndex: 0, LogLength: 0, Started: 0, Stopped: 0},
|
||||
},
|
||||
Status: bots_model.StatusFailure,
|
||||
Status: actions_model.StatusFailure,
|
||||
Started: 10000,
|
||||
Stopped: 10100,
|
||||
LogLength: 100,
|
||||
},
|
||||
want: []*bots_model.BotTaskStep{
|
||||
{Name: preStepName, Status: bots_model.StatusSuccess, LogIndex: 0, LogLength: 10, Started: 10000, Stopped: 10010},
|
||||
{Status: bots_model.StatusSuccess, LogIndex: 10, LogLength: 20, Started: 10010, Stopped: 10020},
|
||||
{Status: bots_model.StatusFailure, LogIndex: 30, LogLength: 60, Started: 10020, Stopped: 10090},
|
||||
{Status: bots_model.StatusCancelled, LogIndex: 0, LogLength: 0, Started: 0, Stopped: 0},
|
||||
{Name: postStepName, Status: bots_model.StatusFailure, LogIndex: 90, LogLength: 10, Started: 10090, Stopped: 10100},
|
||||
want: []*actions_model.BotTaskStep{
|
||||
{Name: preStepName, Status: actions_model.StatusSuccess, LogIndex: 0, LogLength: 10, Started: 10000, Stopped: 10010},
|
||||
{Status: actions_model.StatusSuccess, LogIndex: 10, LogLength: 20, Started: 10010, Stopped: 10020},
|
||||
{Status: actions_model.StatusFailure, LogIndex: 30, LogLength: 60, Started: 10020, Stopped: 10090},
|
||||
{Status: actions_model.StatusCancelled, LogIndex: 0, LogLength: 0, Started: 0, Stopped: 0},
|
||||
{Name: postStepName, Status: actions_model.StatusFailure, LogIndex: 90, LogLength: 10, Started: 10090, Stopped: 10100},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "first step is running",
|
||||
task: &bots_model.BotTask{
|
||||
Steps: []*bots_model.BotTaskStep{
|
||||
{Status: bots_model.StatusRunning, LogIndex: 10, LogLength: 80, Started: 10010, Stopped: 0},
|
||||
task: &actions_model.BotTask{
|
||||
Steps: []*actions_model.BotTaskStep{
|
||||
{Status: actions_model.StatusRunning, LogIndex: 10, LogLength: 80, Started: 10010, Stopped: 0},
|
||||
},
|
||||
Status: bots_model.StatusRunning,
|
||||
Status: actions_model.StatusRunning,
|
||||
Started: 10000,
|
||||
Stopped: 10100,
|
||||
LogLength: 100,
|
||||
},
|
||||
want: []*bots_model.BotTaskStep{
|
||||
{Name: preStepName, Status: bots_model.StatusSuccess, LogIndex: 0, LogLength: 10, Started: 10000, Stopped: 10010},
|
||||
{Status: bots_model.StatusRunning, LogIndex: 10, LogLength: 80, Started: 10010, Stopped: 0},
|
||||
{Name: postStepName, Status: bots_model.StatusWaiting, LogIndex: 0, LogLength: 0, Started: 0, Stopped: 0},
|
||||
want: []*actions_model.BotTaskStep{
|
||||
{Name: preStepName, Status: actions_model.StatusSuccess, LogIndex: 0, LogLength: 10, Started: 10000, Stopped: 10010},
|
||||
{Status: actions_model.StatusRunning, LogIndex: 10, LogLength: 80, Started: 10010, Stopped: 0},
|
||||
{Name: postStepName, Status: actions_model.StatusWaiting, LogIndex: 0, LogLength: 0, Started: 0, Stopped: 0},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "first step has canceled",
|
||||
task: &bots_model.BotTask{
|
||||
Steps: []*bots_model.BotTaskStep{
|
||||
{Status: bots_model.StatusCancelled, LogIndex: 0, LogLength: 0, Started: 0, Stopped: 0},
|
||||
task: &actions_model.BotTask{
|
||||
Steps: []*actions_model.BotTaskStep{
|
||||
{Status: actions_model.StatusCancelled, LogIndex: 0, LogLength: 0, Started: 0, Stopped: 0},
|
||||
},
|
||||
Status: bots_model.StatusFailure,
|
||||
Status: actions_model.StatusFailure,
|
||||
Started: 10000,
|
||||
Stopped: 10100,
|
||||
LogLength: 100,
|
||||
},
|
||||
want: []*bots_model.BotTaskStep{
|
||||
{Name: preStepName, Status: bots_model.StatusFailure, LogIndex: 0, LogLength: 100, Started: 10000, Stopped: 10100},
|
||||
{Status: bots_model.StatusCancelled, LogIndex: 0, LogLength: 0, Started: 0, Stopped: 0},
|
||||
{Name: postStepName, Status: bots_model.StatusFailure, LogIndex: 100, LogLength: 0, Started: 10100, Stopped: 10100},
|
||||
want: []*actions_model.BotTaskStep{
|
||||
{Name: preStepName, Status: actions_model.StatusFailure, LogIndex: 0, LogLength: 100, Started: 10000, Stopped: 10100},
|
||||
{Status: actions_model.StatusCancelled, LogIndex: 0, LogLength: 0, Started: 0, Stopped: 0},
|
||||
{Name: postStepName, Status: actions_model.StatusFailure, LogIndex: 100, LogLength: 0, Started: 10100, Stopped: 10100},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "empty steps",
|
||||
task: &bots_model.BotTask{
|
||||
Steps: []*bots_model.BotTaskStep{},
|
||||
Status: bots_model.StatusSuccess,
|
||||
task: &actions_model.BotTask{
|
||||
Steps: []*actions_model.BotTaskStep{},
|
||||
Status: actions_model.StatusSuccess,
|
||||
Started: 10000,
|
||||
Stopped: 10100,
|
||||
LogLength: 100,
|
||||
},
|
||||
want: []*bots_model.BotTaskStep{
|
||||
{Name: preStepName, Status: bots_model.StatusSuccess, LogIndex: 0, LogLength: 100, Started: 10000, Stopped: 10100},
|
||||
{Name: postStepName, Status: bots_model.StatusSuccess, LogIndex: 100, LogLength: 0, Started: 10100, Stopped: 10100},
|
||||
want: []*actions_model.BotTaskStep{
|
||||
{Name: preStepName, Status: actions_model.StatusSuccess, LogIndex: 0, LogLength: 100, Started: 10000, Stopped: 10100},
|
||||
{Name: postStepName, Status: actions_model.StatusSuccess, LogIndex: 100, LogLength: 0, Started: 10100, Stopped: 10100},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user