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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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
}