44package integration
55
66import (
7- "context"
87 "encoding/base64"
98 "fmt"
109 "net/http"
@@ -92,11 +91,11 @@ jobs:
9291 steps:
9392 - run: echo 'job from workflow3'
9493`
95- opts1 := getWorkflowCreateFileOptions (user2 , repo .DefaultBranch , fmt . Sprintf ( "create %s" , wf1TreePath ) , wf1FileContent )
94+ opts1 := getWorkflowCreateFileOptions (user2 , repo .DefaultBranch , "create " + wf1TreePath , wf1FileContent )
9695 createWorkflowFile (t , token , user2 .Name , repo .Name , wf1TreePath , opts1 )
97- opts2 := getWorkflowCreateFileOptions (user2 , repo .DefaultBranch , fmt . Sprintf ( "create %s" , wf2TreePath ) , wf2FileContent )
96+ opts2 := getWorkflowCreateFileOptions (user2 , repo .DefaultBranch , "create " + wf2TreePath , wf2FileContent )
9897 createWorkflowFile (t , token , user2 .Name , repo .Name , wf2TreePath , opts2 )
99- opts3 := getWorkflowCreateFileOptions (user2 , repo .DefaultBranch , fmt . Sprintf ( "create %s" , wf3TreePath ) , wf3FileContent )
98+ opts3 := getWorkflowCreateFileOptions (user2 , repo .DefaultBranch , "create " + wf3TreePath , wf3FileContent )
10099 createWorkflowFile (t , token , user2 .Name , repo .Name , wf3TreePath , opts3 )
101100
102101 // fetch and exec workflow1, workflow2 and workflow3 are blocked
@@ -164,7 +163,7 @@ jobs:
164163 steps:
165164 - run: echo 'test the pull'
166165`
167- opts1 := getWorkflowCreateFileOptions (user2 , baseRepo .DefaultBranch , fmt . Sprintf ( "create %s" , wfTreePath ) , wfFileContent )
166+ opts1 := getWorkflowCreateFileOptions (user2 , baseRepo .DefaultBranch , "create %s" + wfTreePath , wfFileContent )
168167 createWorkflowFile (t , user2Token , baseRepo .OwnerName , baseRepo .Name , wfTreePath , opts1 )
169168 // user2 creates a pull request
170169 doAPICreateFile (user2APICtx , "user2-fix.txt" , & api.CreateFileOptions {
@@ -225,7 +224,7 @@ jobs:
225224 },
226225 ContentBase64 : base64 .StdEncoding .EncodeToString ([]byte ("user4-fix" )),
227226 })(t )
228- doAPICreatePullRequest (user4APICtx , baseRepo .OwnerName , baseRepo .Name , baseRepo .DefaultBranch , fmt . Sprintf ( "%s:bugfix/bbb" , user4 . Name ) )(t )
227+ doAPICreatePullRequest (user4APICtx , baseRepo .OwnerName , baseRepo .Name , baseRepo .DefaultBranch , user4 . Name + "%s:bugfix/bbb" )(t )
229228 // cannot fetch the task because an approval is required
230229 runner .fetchNoTask (t )
231230 // user2 approves the run
@@ -265,7 +264,7 @@ jobs:
265264 },
266265 ContentBase64 : base64 .StdEncoding .EncodeToString ([]byte ("user4-fix2" )),
267266 })(t )
268- doAPICreatePullRequest (user4APICtx , baseRepo .OwnerName , baseRepo .Name , baseRepo .DefaultBranch , fmt . Sprintf ( "%s:do-not-cancel/ccc" , user4 . Name ) )(t )
267+ doAPICreatePullRequest (user4APICtx , baseRepo .OwnerName , baseRepo .Name , baseRepo .DefaultBranch , user4 . Name + "%s:do-not-cancel/ccc" )(t )
269268 // cannot fetch the task because cancel-in-progress is false
270269 runner .fetchNoTask (t )
271270 runner .execTask (t , pr2Task1 , & mockTaskOutcome {
@@ -358,9 +357,9 @@ jobs:
358357 - run: echo 'wf3-job1'
359358`
360359
361- opts1 := getWorkflowCreateFileOptions (user2 , repo .DefaultBranch , fmt . Sprintf ( "create %s" , wf1TreePath ) , wf1FileContent )
360+ opts1 := getWorkflowCreateFileOptions (user2 , repo .DefaultBranch , "create %s" + wf1TreePath , wf1FileContent )
362361 createWorkflowFile (t , token , user2 .Name , repo .Name , wf1TreePath , opts1 )
363- opts2 := getWorkflowCreateFileOptions (user2 , repo .DefaultBranch , fmt . Sprintf ( "create %s" , wf2TreePath ) , wf2FileContent )
362+ opts2 := getWorkflowCreateFileOptions (user2 , repo .DefaultBranch , "create %s" + wf2TreePath , wf2FileContent )
364363 createWorkflowFile (t , token , user2 .Name , repo .Name , wf2TreePath , opts2 )
365364
366365 // fetch wf1-job1
@@ -388,7 +387,7 @@ jobs:
388387 assert .Equal (t , "job-main-v1.23.0" , wf2Job2ActionJob .ConcurrencyGroup )
389388 assert .Equal (t , actions_model .StatusRunning , wf2Job2ActionJob .Status )
390389 // push workflow3 to trigger wf3-job1
391- opts3 := getWorkflowCreateFileOptions (user2 , repo .DefaultBranch , fmt . Sprintf ( "create %s" , wf3TreePath ) , wf3FileContent )
390+ opts3 := getWorkflowCreateFileOptions (user2 , repo .DefaultBranch , "create %s" + wf3TreePath , wf3FileContent )
392391 createWorkflowFile (t , token , user2 .Name , repo .Name , wf3TreePath , opts3 )
393392 // fetch wf3-job1
394393 wf3Job1Task := runner1 .fetchTask (t )
@@ -446,7 +445,7 @@ jobs:
446445 - run: echo 'job2'
447446`
448447
449- opts1 := getWorkflowCreateFileOptions (user2 , repo .DefaultBranch , fmt . Sprintf ( "create %s" , wf1TreePath ) , wf1FileContent )
448+ opts1 := getWorkflowCreateFileOptions (user2 , repo .DefaultBranch , "create %s" + wf1TreePath , wf1FileContent )
450449 createWorkflowFile (t , token , user2 .Name , repo .Name , wf1TreePath , opts1 )
451450
452451 job1WinTask := windowsRunner .fetchTask (t )
@@ -524,7 +523,7 @@ jobs:
524523 - run: echo 'workflow dispatch job'
525524`
526525
527- opts1 := getWorkflowCreateFileOptions (user2 , repo .DefaultBranch , fmt . Sprintf ( "create %s" , wf1TreePath ) , wf1FileContent )
526+ opts1 := getWorkflowCreateFileOptions (user2 , repo .DefaultBranch , "create %s" + wf1TreePath , wf1FileContent )
528527 createWorkflowFile (t , token , user2 .Name , repo .Name , wf1TreePath , opts1 )
529528
530529 // run the workflow with appVersion=v1.21 and cancel=false
@@ -605,7 +604,7 @@ jobs:
605604 - run: echo 'schedule workflow'
606605`
607606
608- opts1 := getWorkflowCreateFileOptions (user2 , repo .DefaultBranch , fmt . Sprintf ( "create %s" , wf1TreePath ) , wf1FileContent )
607+ opts1 := getWorkflowCreateFileOptions (user2 , repo .DefaultBranch , "create %s" + wf1TreePath , wf1FileContent )
609608 createWorkflowFile (t , token , user2 .Name , repo .Name , wf1TreePath , opts1 )
610609
611610 // fetch the task triggered by push
@@ -619,8 +618,8 @@ jobs:
619618 // trigger the task by schedule
620619 spec := unittest .AssertExistsAndLoadBean (t , & actions_model.ActionScheduleSpec {RepoID : repo .ID })
621620 spec .Next = timeutil .TimeStampNow () // manually update "Next"
622- assert .NoError (t , actions_model .UpdateScheduleSpec (context . Background (), spec , "next" ))
623- assert .NoError (t , actions_service .StartScheduleTasks (context . Background ()))
621+ assert .NoError (t , actions_model .UpdateScheduleSpec (t . Context (), spec , "next" ))
622+ assert .NoError (t , actions_service .StartScheduleTasks (t . Context ()))
624623 runner .fetchNoTask (t ) // cannot fetch because task1 is not completed
625624 runner .execTask (t , task1 , & mockTaskOutcome {
626625 result : runnerv1 .Result_RESULT_SUCCESS ,
@@ -637,8 +636,8 @@ jobs:
637636 // trigger the task by schedule again
638637 spec = unittest .AssertExistsAndLoadBean (t , & actions_model.ActionScheduleSpec {RepoID : repo .ID })
639638 spec .Next = timeutil .TimeStampNow () // manually update "Next"
640- assert .NoError (t , actions_model .UpdateScheduleSpec (context . Background (), spec , "next" ))
641- assert .NoError (t , actions_service .StartScheduleTasks (context . Background ()))
639+ assert .NoError (t , actions_model .UpdateScheduleSpec (t . Context (), spec , "next" ))
640+ assert .NoError (t , actions_service .StartScheduleTasks (t . Context ()))
642641 runner .fetchNoTask (t ) // cannot fetch because task2 is not completed
643642 run3 := unittest .AssertExistsAndLoadBean (t , & actions_model.ActionRun {RepoID : repo .ID , Status : actions_model .StatusBlocked })
644643 assert .Equal (t , "schedule-concurrency" , run3 .ConcurrencyGroup )
@@ -773,11 +772,11 @@ jobs:
773772`
774773
775774 // push workflow 1, 2 and 3
776- opts1 := getWorkflowCreateFileOptions (user2 , repo .DefaultBranch , fmt . Sprintf ( "create %s" , wf1TreePath ) , wf1FileContent )
775+ opts1 := getWorkflowCreateFileOptions (user2 , repo .DefaultBranch , "create %s" + wf1TreePath , wf1FileContent )
777776 createWorkflowFile (t , token , user2 .Name , repo .Name , wf1TreePath , opts1 )
778- opts2 := getWorkflowCreateFileOptions (user2 , repo .DefaultBranch , fmt . Sprintf ( "create %s" , wf2TreePath ) , wf2FileContent )
777+ opts2 := getWorkflowCreateFileOptions (user2 , repo .DefaultBranch , "create %s" + wf2TreePath , wf2FileContent )
779778 createWorkflowFile (t , token , user2 .Name , repo .Name , wf2TreePath , opts2 )
780- opts3 := getWorkflowCreateFileOptions (user2 , repo .DefaultBranch , fmt . Sprintf ( "create %s" , wf3TreePath ) , wf3FileContent )
779+ opts3 := getWorkflowCreateFileOptions (user2 , repo .DefaultBranch , "create %s" + wf3TreePath , wf3FileContent )
781780 createWorkflowFile (t , token , user2 .Name , repo .Name , wf3TreePath , opts3 )
782781 // fetch wf1-job1 and wf1-job2
783782 w1j1Task := runner1 .fetchTask (t )
0 commit comments