@@ -144,11 +144,16 @@ func TestPatchStatus(t *testing.T) {
144144 require .NoError (t , git .NewCommand (t .Context (), "push" , "origin" , "HEAD:main" ).Run (& git.RunOpts {Dir : dstPath }))
145145 require .NoError (t , git .NewCommand (t .Context (), "switch" , "normal" ).Run (& git.RunOpts {Dir : dstPath }))
146146
147+ assertConflictAndLoadBean := func (t * testing.T , pr * issues_model.PullRequest , flow string ) * issues_model.PullRequest {
148+ t .Helper ()
149+ assert .Eventually (t , func () bool {
150+ return unittest .AssertExistsAndLoadBean (t , pr , flow ).Status == issues_model .PullRequestStatusConflict
151+ }, time .Second * 30 , time .Millisecond * 200 )
152+ return pr
153+ }
147154 // Wait until status check queue is done, we cannot access the queue's
148155 // internal information so we rely on the status of the patch being changed.
149- assert .Eventually (t , func () bool {
150- return unittest .AssertExistsAndLoadBean (t , & issues_model.PullRequest {ID : normalAGitPR .ID }).Status == issues_model .PullRequestStatusConflict
151- }, time .Second * 30 , time .Millisecond * 200 )
156+ _ = assertConflictAndLoadBean (t , & issues_model.PullRequest {ID : normalAGitPR .ID }, "flow = 1" )
152157
153158 test := func (t * testing.T , pr * issues_model.PullRequest ) {
154159 t .Helper ()
@@ -165,7 +170,7 @@ func TestPatchStatus(t *testing.T) {
165170 t .Run ("Existing" , func (t * testing.T ) {
166171 defer tests .PrintCurrentTest (t )()
167172
168- pr := unittest . AssertExistsAndLoadBean (t , & issues_model.PullRequest {BaseRepoID : repo .ID , HeadRepoID : forkRepo .ID , HeadBranch : "normal" }, "flow = 0" )
173+ pr := assertConflictAndLoadBean (t , & issues_model.PullRequest {BaseRepoID : repo .ID , HeadRepoID : forkRepo .ID , HeadBranch : "normal" }, "flow = 0" )
169174 test (t , pr )
170175 testAutomergeQueued (t , pr , issues_model .PullRequestStatusConflict )
171176 })
@@ -176,7 +181,7 @@ func TestPatchStatus(t *testing.T) {
176181 require .NoError (t , git .NewCommand (t .Context (), "push" , "fork" , "HEAD:conflict" ).Run (& git.RunOpts {Dir : dstPath }))
177182 testPullCreateDirectly (t , session , repo .OwnerName , repo .Name , repo .DefaultBranch , forkRepo .OwnerName , forkRepo .Name , "conflict" , "across repo conflict" )
178183
179- test (t , unittest . AssertExistsAndLoadBean (t , & issues_model.PullRequest {BaseRepoID : repo .ID , HeadRepoID : forkRepo .ID , HeadBranch : "conflict" }, "flow = 0" ))
184+ test (t , assertConflictAndLoadBean (t , & issues_model.PullRequest {BaseRepoID : repo .ID , HeadRepoID : forkRepo .ID , HeadBranch : "conflict" }, "flow = 0" ))
180185 })
181186 })
182187
0 commit comments