From ba342cb58e19208c3abc6186ae7011b0173f0582 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Mon, 8 Apr 2024 21:46:00 +0800 Subject: [PATCH] Fix the test --- tests/integration/api_packages_maven_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/integration/api_packages_maven_test.go b/tests/integration/api_packages_maven_test.go index d008956445..cb45b49ded 100644 --- a/tests/integration/api_packages_maven_test.go +++ b/tests/integration/api_packages_maven_test.go @@ -8,6 +8,7 @@ import ( "net/http" "strconv" "strings" + "sync" "testing" "code.gitea.io/gitea/models/db" @@ -263,8 +264,14 @@ func TestPackageMavenConcurrent(t *testing.T) { t.Run("Concurrent Upload", func(t *testing.T) { defer tests.PrintCurrentTest(t)() + var wg sync.WaitGroup for i := 0; i < 10; i++ { - go putFile(t, fmt.Sprintf("/%s/%s.jar", packageVersion, strconv.Itoa(i)), "test", http.StatusCreated) + wg.Add(1) + go func() { + putFile(t, fmt.Sprintf("/%s/%s.jar", packageVersion, strconv.Itoa(i)), "test", http.StatusCreated) + wg.Done() + }() } + wg.Wait() }) }