diff --git a/metricbeat/module/apache/status/status_test.go b/metricbeat/module/apache/status/status_test.go index 2fde31afb56a..327456266058 100644 --- a/metricbeat/module/apache/status/status_test.go +++ b/metricbeat/module/apache/status/status_test.go @@ -151,7 +151,7 @@ func TestFetchTimeout(t *testing.T) { w.WriteHeader(200) w.Header().Set("Content-Type", "text/plain; charset=ISO-8859-1") w.Write([]byte(response)) - time.Sleep(100 * time.Millisecond) + <-r.Context().Done() })) defer server.Close() diff --git a/metricbeat/module/envoyproxy/server/server_test.go b/metricbeat/module/envoyproxy/server/server_test.go index 0c05fd668b18..e58b3517fd3c 100644 --- a/metricbeat/module/envoyproxy/server/server_test.go +++ b/metricbeat/module/envoyproxy/server/server_test.go @@ -118,7 +118,7 @@ func TestFetchTimeout(t *testing.T) { w.WriteHeader(200) w.Header().Set("Content-Type", "text/plain; charset=UTF-8") w.Write([]byte(response)) - time.Sleep(100 * time.Millisecond) + <-r.Context().Done() })) defer server.Close()