add Concurrent tests.

pull/31037/head
dragon 5 months ago
parent 3caa520ed9
commit c35f354eb8
  1. 22
      tests/integration/api_packages_arch_test.go

@ -14,6 +14,7 @@ import (
"io"
"net/http"
"strings"
"sync"
"testing"
"testing/fstest"
@ -314,6 +315,27 @@ HMhNSS1IzUsBcpJAPFAwwUXSM0u4BjoaR8EoGAWjgGQAAILFeyQADAAA
})
}
}
t.Run("Concurrent Upload", func(t *testing.T) {
defer tests.PrintCurrentTest(t)()
var wg sync.WaitGroup
targets := []string{"any", "aarch64", "x86_64"}
for _, tag := range targets {
wg.Add(1)
go func(i string) {
defer wg.Done()
req := NewRequestWithBody(t, "PUT", rootURL, bytes.NewReader(pkgs[i])).
AddBasicAuth(user.Name)
MakeRequest(t, req, http.StatusCreated)
}(tag)
}
wg.Wait()
for _, target := range targets {
req := NewRequestWithBody(t, "DELETE", rootURL+"/test/1.0.0-1/"+target, nil).
AddBasicAuth(user.Name)
MakeRequest(t, req, http.StatusNoContent)
}
})
}
func getProperty(data, key string) string {

Loading…
Cancel
Save