Merge pull request '[v9.0/forgejo] fix(ci): synchronize updates the commit status asynchronously' (#5926) from bp-v9.0/forgejo-983aed4 into v9.0/forgejo
Some checks failed
/ release (push) Has been cancelled
testing / backend-checks (push) Has been cancelled
testing / frontend-checks (push) Has been cancelled
testing / test-unit (push) Has been cancelled
testing / test-remote-cacher (map[image:docker.io/bitnami/valkey:7.2 port:6379]) (push) Has been cancelled
testing / test-remote-cacher (map[image:ghcr.io/microsoft/garnet-alpine:1.0.14 port:6379]) (push) Has been cancelled
testing / test-remote-cacher (map[image:registry.redict.io/redict:7.3.0-scratch port:6379]) (push) Has been cancelled
testing / test-mysql (push) Has been cancelled
testing / test-remote-cacher (map[image:docker.io/bitnami/redis:7.2 port:6379]) (push) Has been cancelled
testing / test-pgsql (push) Has been cancelled
testing / test-sqlite (push) Has been cancelled
testing / security-check (push) Has been cancelled

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5926
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
This commit is contained in:
Earl Warren 2024-11-12 12:33:20 +00:00
commit e9cd753b98

View file

@ -328,7 +328,9 @@ jobs:
sha, err := baseGitRepo.GetRefCommitID(pr.GetGitRefName()) sha, err := baseGitRepo.GetRefCommitID(pr.GetGitRefName())
require.NoError(t, err) require.NoError(t, err)
// verify the commit status changes to CommitStatusSuccess when the job changes to StatusSuccess // verify the commit status changes to CommitStatusSuccess when the job changes to StatusSuccess
assert.True(t, checkCommitStatus(sha, context, api.CommitStatusPending)) require.Eventually(t, func() bool {
return checkCommitStatus(sha, context, api.CommitStatusPending)
}, 30*time.Second, 1*time.Second)
for _, actionRun := range actionRuns { for _, actionRun := range actionRuns {
// verify the expected ActionRunJob was created and is StatusWaiting // verify the expected ActionRunJob was created and is StatusWaiting
job := unittest.AssertExistsAndLoadBean(t, &actions_model.ActionRunJob{RunID: actionRun.ID, CommitSHA: sha}) job := unittest.AssertExistsAndLoadBean(t, &actions_model.ActionRunJob{RunID: actionRun.ID, CommitSHA: sha})
@ -339,7 +341,9 @@ jobs:
actions_service.CreateCommitStatus(db.DefaultContext, job) actions_service.CreateCommitStatus(db.DefaultContext, job)
} }
// verify the commit status changed to CommitStatusSuccess because the job(s) changed to StatusSuccess // verify the commit status changed to CommitStatusSuccess because the job(s) changed to StatusSuccess
assert.True(t, checkCommitStatus(sha, context, api.CommitStatusSuccess)) require.Eventually(t, func() bool {
return checkCommitStatus(sha, context, api.CommitStatusSuccess)
}, 30*time.Second, 1*time.Second)
testCase.assert(t, sha, testCase.onType, testCase.action, actionRuns) testCase.assert(t, sha, testCase.onType, testCase.action, actionRuns)
}) })