Skip to content

Commit dac13b7

Browse files
earl-warrenforgejo-backport-action
authored andcommitted
fix(ci): synchronize updates the commit status asynchronously
When a new commit is pushed to an existing pull request, the update of the commit status will happen asynchronously, via the git hook. --- FAIL: TestPullRequestCommitStatus/synchronize (2.14s) actions_trigger_test.go:331: Error Trace: /workspace/forgejo/forgejo/tests/integration/actions_trigger_test.go:331 Error: Should be true Test: TestPullRequestCommitStatus/synchronize (cherry picked from commit 983aed4)
1 parent 0db515d commit dac13b7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/integration/actions_trigger_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,9 @@ jobs:
328328
sha, err := baseGitRepo.GetRefCommitID(pr.GetGitRefName())
329329
require.NoError(t, err)
330330
// verify the commit status changes to CommitStatusSuccess when the job changes to StatusSuccess
331-
assert.True(t, checkCommitStatus(sha, context, api.CommitStatusPending))
331+
require.Eventually(t, func() bool {
332+
return checkCommitStatus(sha, context, api.CommitStatusPending)
333+
}, 30*time.Second, 1*time.Second)
332334
for _, actionRun := range actionRuns {
333335
// verify the expected ActionRunJob was created and is StatusWaiting
334336
job := unittest.AssertExistsAndLoadBean(t, &actions_model.ActionRunJob{RunID: actionRun.ID, CommitSHA: sha})
@@ -339,7 +341,9 @@ jobs:
339341
actions_service.CreateCommitStatus(db.DefaultContext, job)
340342
}
341343
// verify the commit status changed to CommitStatusSuccess because the job(s) changed to StatusSuccess
342-
assert.True(t, checkCommitStatus(sha, context, api.CommitStatusSuccess))
344+
require.Eventually(t, func() bool {
345+
return checkCommitStatus(sha, context, api.CommitStatusSuccess)
346+
}, 30*time.Second, 1*time.Second)
343347

344348
testCase.assert(t, sha, testCase.onType, testCase.action, actionRuns)
345349
})

0 commit comments

Comments
 (0)