diff --git a/internal/test/scorecard/common_utils.go b/internal/test/scorecard/common_utils.go index 3a53bbfe3..65ece167f 100644 --- a/internal/test/scorecard/common_utils.go +++ b/internal/test/scorecard/common_utils.go @@ -357,12 +357,6 @@ func waitTillCryostatReady(base *url.URL, resources *TestResources) error { } defer resp.Body.Close() - health := &HealthResponse{} - err = ReadJSON(resp, health) - if err != nil { - return false, fmt.Errorf("failed to read response body: %s", err.Error()) - } - if !StatusOK(resp.StatusCode) { if resp.StatusCode == http.StatusServiceUnavailable { r.Log += fmt.Sprintf("application is not yet reachable at %s\n", base.String()) @@ -371,6 +365,12 @@ func waitTillCryostatReady(base *url.URL, resources *TestResources) error { return false, fmt.Errorf("API request failed with status code %d: %s", resp.StatusCode, ReadError(resp)) } + health := &HealthResponse{} + err = ReadJSON(resp, health) + if err != nil { + return false, fmt.Errorf("failed to read response body: %s", err.Error()) + } + if err = health.Ready(); err != nil { r.Log += fmt.Sprintf("application is not yet ready: %s\n", err.Error()) return false, nil // Try again