mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Merge pull request #96229 from adtac/apfrace
apiserver/filters test: fix data race and do not leak goroutines
This commit is contained in:
commit
ec1541c38f
@ -294,15 +294,17 @@ func TestApfExecuteMultipleRequests(t *testing.T) {
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
StartPriorityAndFairnessWatermarkMaintenance(ctx.Done())
|
StartPriorityAndFairnessWatermarkMaintenance(ctx.Done())
|
||||||
|
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
wg.Add(concurrentRequests)
|
||||||
for i := 0; i < concurrentRequests; i++ {
|
for i := 0; i < concurrentRequests; i++ {
|
||||||
var err error
|
|
||||||
go func() {
|
go func() {
|
||||||
err = expectHTTPGet(fmt.Sprintf("%s/api/v1/namespaces/default", server.URL), http.StatusOK)
|
defer wg.Done()
|
||||||
}()
|
if err := expectHTTPGet(fmt.Sprintf("%s/api/v1/namespaces/default", server.URL), http.StatusOK); err != nil {
|
||||||
if err != nil {
|
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
}
|
}
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
|
wg.Wait()
|
||||||
|
|
||||||
checkForExpectedMetricsWithRetry(t, []string{
|
checkForExpectedMetricsWithRetry(t, []string{
|
||||||
"apiserver_current_inflight_requests",
|
"apiserver_current_inflight_requests",
|
||||||
|
Loading…
Reference in New Issue
Block a user