refactor: rename tables to bot_*

This commit is contained in:
Jason Song
2022-11-29 12:34:23 +08:00
parent 3ac6bf3db4
commit 04d72d3500
20 changed files with 173 additions and 201 deletions

View File

@ -15,13 +15,13 @@ import (
func TestFullSteps(t *testing.T) {
tests := []struct {
name string
task *bots_model.Task
want []*bots_model.TaskStep
task *bots_model.BotTask
want []*bots_model.BotTaskStep
}{
{
name: "regular",
task: &bots_model.Task{
Steps: []*bots_model.TaskStep{
task: &bots_model.BotTask{
Steps: []*bots_model.BotTaskStep{
{Status: bots_model.StatusSuccess, LogIndex: 10, LogLength: 80, Started: 10010, Stopped: 10090},
},
Status: bots_model.StatusSuccess,
@ -29,7 +29,7 @@ func TestFullSteps(t *testing.T) {
Stopped: 10100,
LogLength: 100,
},
want: []*bots_model.TaskStep{
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},
@ -37,8 +37,8 @@ func TestFullSteps(t *testing.T) {
},
{
name: "failed step",
task: &bots_model.Task{
Steps: []*bots_model.TaskStep{
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},
@ -48,7 +48,7 @@ func TestFullSteps(t *testing.T) {
Stopped: 10100,
LogLength: 100,
},
want: []*bots_model.TaskStep{
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},
@ -58,8 +58,8 @@ func TestFullSteps(t *testing.T) {
},
{
name: "first step is running",
task: &bots_model.Task{
Steps: []*bots_model.TaskStep{
task: &bots_model.BotTask{
Steps: []*bots_model.BotTaskStep{
{Status: bots_model.StatusRunning, LogIndex: 10, LogLength: 80, Started: 10010, Stopped: 0},
},
Status: bots_model.StatusRunning,
@ -67,7 +67,7 @@ func TestFullSteps(t *testing.T) {
Stopped: 10100,
LogLength: 100,
},
want: []*bots_model.TaskStep{
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},
@ -75,8 +75,8 @@ func TestFullSteps(t *testing.T) {
},
{
name: "first step has canceled",
task: &bots_model.Task{
Steps: []*bots_model.TaskStep{
task: &bots_model.BotTask{
Steps: []*bots_model.BotTaskStep{
{Status: bots_model.StatusCancelled, LogIndex: 0, LogLength: 0, Started: 0, Stopped: 0},
},
Status: bots_model.StatusFailure,
@ -84,7 +84,7 @@ func TestFullSteps(t *testing.T) {
Stopped: 10100,
LogLength: 100,
},
want: []*bots_model.TaskStep{
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},
@ -92,14 +92,14 @@ func TestFullSteps(t *testing.T) {
},
{
name: "empty steps",
task: &bots_model.Task{
Steps: []*bots_model.TaskStep{},
task: &bots_model.BotTask{
Steps: []*bots_model.BotTaskStep{},
Status: bots_model.StatusSuccess,
Started: 10000,
Stopped: 10100,
LogLength: 100,
},
want: []*bots_model.TaskStep{
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},
},