Merge pull request #96229 from adtac/apfrace
apiserver/filters test: fix data race and do not leak goroutines Kubernetes-commit: ec1541c38fce2db65c25a1c7255674ba98a94bd9
This commit is contained in:
commit
a283c87db3
|
|
@ -294,15 +294,17 @@ func TestApfExecuteMultipleRequests(t *testing.T) {
|
|||
defer cancel()
|
||||
StartPriorityAndFairnessWatermarkMaintenance(ctx.Done())
|
||||
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(concurrentRequests)
|
||||
for i := 0; i < concurrentRequests; i++ {
|
||||
var err error
|
||||
go func() {
|
||||
err = expectHTTPGet(fmt.Sprintf("%s/api/v1/namespaces/default", server.URL), http.StatusOK)
|
||||
}()
|
||||
if err != nil {
|
||||
defer wg.Done()
|
||||
if err := expectHTTPGet(fmt.Sprintf("%s/api/v1/namespaces/default", server.URL), http.StatusOK); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
wg.Wait()
|
||||
|
||||
checkForExpectedMetricsWithRetry(t, []string{
|
||||
"apiserver_current_inflight_requests",
|
||||
|
|
|
|||
Loading…
Reference in New Issue