mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 23:37:01 +00:00
apiserver/filters test: fix data race and do not leak goroutines
Signed-off-by: Adhityaa Chandrasekar <adtac@google.com>
This commit is contained in:
parent
396b90f06c
commit
a2eb6d67ee
@ -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)
|
||||
defer wg.Done()
|
||||
if err := expectHTTPGet(fmt.Sprintf("%s/api/v1/namespaces/default", server.URL), http.StatusOK); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
wg.Wait()
|
||||
|
||||
checkForExpectedMetricsWithRetry(t, []string{
|
||||
"apiserver_current_inflight_requests",
|
||||
|
Loading…
Reference in New Issue
Block a user