diff --git a/pkg/healthcheck/mock_test.go b/pkg/healthcheck/mock_test.go index 5192fe53e..d2a9b52e1 100644 --- a/pkg/healthcheck/mock_test.go +++ b/pkg/healthcheck/mock_test.go @@ -135,6 +135,8 @@ func newHTTPServer(healthSequence ...int) *HTTPServer { func (s *HTTPServer) ServeHTTP(w http.ResponseWriter, _ *http.Request) { if s.status.IsEmpty() { s.done() + // This ensures that the health-checker will handle the context cancellation error before receiving the HTTP response. + time.Sleep(500 * time.Millisecond) return }