@@ -140,11 +140,16 @@ func TestPatchStatus(t *testing.T) {
140140 require .NoError (t , git .NewCommand (t .Context (), "push" , "origin" , "HEAD:main" ).Run (& git.RunOpts {Dir : dstPath }))
141141 require .NoError (t , git .NewCommand (t .Context (), "switch" , "normal" ).Run (& git.RunOpts {Dir : dstPath }))
142142
143+ assertConflictAndLoadBean := func (t * testing.T , pr * issues_model.PullRequest , flow string ) * issues_model.PullRequest {
144+ t .Helper ()
145+ assert .Eventually (t , func () bool {
146+ return unittest .AssertExistsAndLoadBean (t , pr , flow ).Status == issues_model .PullRequestStatusConflict
147+ }, time .Second * 30 , time .Millisecond * 200 )
148+ return pr
149+ }
143150 // Wait until status check queue is done, we cannot access the queue's
144151 // internal information so we rely on the status of the patch being changed.
145- assert .Eventually (t , func () bool {
146- return unittest .AssertExistsAndLoadBean (t , & issues_model.PullRequest {ID : normalAGitPR .ID }).Status == issues_model .PullRequestStatusConflict
147- }, time .Second * 30 , time .Millisecond * 200 )
152+ _ = assertConflictAndLoadBean (t , & issues_model.PullRequest {ID : normalAGitPR .ID }, "flow = 1" )
148153
149154 test := func (t * testing.T , pr * issues_model.PullRequest ) {
150155 t .Helper ()
@@ -161,7 +166,7 @@ func TestPatchStatus(t *testing.T) {
161166 t .Run ("Existing" , func (t * testing.T ) {
162167 defer tests .PrintCurrentTest (t )()
163168
164- pr := unittest . AssertExistsAndLoadBean (t , & issues_model.PullRequest {BaseRepoID : repo .ID , HeadRepoID : forkRepo .ID , HeadBranch : "normal" }, "flow = 0" )
169+ pr := assertConflictAndLoadBean (t , & issues_model.PullRequest {BaseRepoID : repo .ID , HeadRepoID : forkRepo .ID , HeadBranch : "normal" }, "flow = 0" )
165170 test (t , pr )
166171 testAutomergeQueued (t , pr , issues_model .PullRequestStatusConflict )
167172 })
@@ -172,7 +177,7 @@ func TestPatchStatus(t *testing.T) {
172177 require .NoError (t , git .NewCommand (t .Context (), "push" , "fork" , "HEAD:conflict" ).Run (& git.RunOpts {Dir : dstPath }))
173178 testPullCreateDirectly (t , session , repo .OwnerName , repo .Name , repo .DefaultBranch , forkRepo .OwnerName , forkRepo .Name , "conflict" , "across repo conflict" )
174179
175- test (t , unittest . AssertExistsAndLoadBean (t , & issues_model.PullRequest {BaseRepoID : repo .ID , HeadRepoID : forkRepo .ID , HeadBranch : "conflict" }, "flow = 0" ))
180+ test (t , assertConflictAndLoadBean (t , & issues_model.PullRequest {BaseRepoID : repo .ID , HeadRepoID : forkRepo .ID , HeadBranch : "conflict" }, "flow = 0" ))
176181 })
177182 })
178183
0 commit comments