Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix parallel creating commit status bug with tests #21911

Merged
merged 13 commits into from
Nov 30, 2022
Prev Previous commit
Next Next commit
Fix test
  • Loading branch information
lunny committed Nov 29, 2022
commit 0fb567718466c47f2946c144f42828a7949eab3b
10 changes: 5 additions & 5 deletions tests/integration/repo_commits_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@ func doTestRepoCommitWithStatus(t *testing.T, state string, classes ...string) {
t.Run("CreateStatus", doAPICreateCommitStatus(NewAPITestContext(t, "user2", "repo1"), path.Base(commitURL), api.CommitStatusState(state)))

if !setting.Database.UseSQLite3 {
runBody := doAPICreateCommitStatus(NewAPITestContext(t, "user2", "repo1"), path.Base(commitURL), api.CommitStatusState(state))
var wg sync.WaitGroup
for i := 0; i < 10; i++ {
wg.Add(1)
t.Run(fmt.Sprintf("ParallelCreateStatus_%d", i), func(t *testing.T) {
go func(t *testing.T) {
go func(t *testing.T, i int) {
t.Run(fmt.Sprintf("ParallelCreateStatus_%d", i), func(t *testing.T) {
runBody := doAPICreateCommitStatus(NewAPITestContext(t, "user2", "repo1"), path.Base(commitURL), api.CommitStatusState(state))
runBody(t)
wg.Done()
}(t)
})
})
}(t, i)
}
wg.Wait()
}
Expand Down