Fix flaky healthcheck test

This commit is contained in:
Kevin Pollet
2022-11-24 16:32:05 +01:00
committed by GitHub
parent 580e7fa774
commit 268d1edc8f

View File

@@ -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
}