Skip to content

Commit

Permalink
replace original variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
jackgopack4 committed Nov 12, 2024
1 parent 2a5b31d commit bd1c73e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions service/telemetry/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,17 +206,17 @@ func getMetricsFromPrometheus(t *testing.T, endpoint string) map[string]*io_prom
Timeout: 10 * time.Second,
}
var (
req *http.Request
err error
resp *http.Response
req *http.Request
err error
rr *http.Response
)
req, err = http.NewRequest(http.MethodGet, endpoint, nil)
require.NoError(t, err)

maxRetries := 5
for i := 0; i < maxRetries; i++ {
resp, err = client.Do(req)
if err == nil && resp.StatusCode == http.StatusOK {
rr, err = client.Do(req)
if err == nil && rr.StatusCode == http.StatusOK {
break
}

Expand All @@ -225,11 +225,11 @@ func getMetricsFromPrometheus(t *testing.T, endpoint string) map[string]*io_prom
}
}
require.NoError(t, err, "failed to get metrics from Prometheus after %d attempts", maxRetries)
require.Equal(t, http.StatusOK, resp.StatusCode, "unexpected status code after %d attempts", maxRetries)
defer resp.Body.Close()
require.Equal(t, http.StatusOK, rr.StatusCode, "unexpected status code after %d attempts", maxRetries)
defer rr.Body.Close()

var parser expfmt.TextParser
parsed, err := parser.TextToMetricFamilies(resp.Body)
parsed, err := parser.TextToMetricFamilies(rr.Body)
require.NoError(t, err)

return parsed
Expand Down

0 comments on commit bd1c73e

Please sign in to comment.