integration test: provide a timeout for /health

This commit is contained in:
Abu Kashem
2021-07-08 18:49:32 -04:00
parent 24a614cb4c
commit 581b088f76

View File

@@ -233,7 +233,10 @@ func startAPIServerOrDie(controlPlaneConfig *controlplane.Config, incomingServer
} }
var lastHealthContent []byte var lastHealthContent []byte
err = wait.PollImmediate(100*time.Millisecond, 30*time.Second, func() (bool, error) { err = wait.PollImmediate(100*time.Millisecond, 30*time.Second, func() (bool, error) {
result := privilegedClient.Get().AbsPath("/healthz").Do(context.TODO()) ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
result := privilegedClient.Get().AbsPath("/healthz").Do(ctx)
status := 0 status := 0
result.StatusCode(&status) result.StatusCode(&status)
if status == 200 { if status == 200 {