Merge pull request #614 from percona/prometheus-master

Log response body if test fails.
This commit is contained in:
Tobias Schmidt 2017-07-05 11:45:51 +02:00 committed by GitHub
commit ab3414e6fd
1 changed files with 5 additions and 1 deletions

View File

@ -93,11 +93,15 @@ func queryExporter(address string) error {
if err != nil {
return err
}
b, err := ioutil.ReadAll(resp.Body)
if err != nil {
return err
}
if err := resp.Body.Close(); err != nil {
return err
}
if want, have := http.StatusOK, resp.StatusCode; want != have {
return fmt.Errorf("want /metrics status code %d, have %d", want, have)
return fmt.Errorf("want /metrics status code %d, have %d. Body:\n%s", want, have, b)
}
return nil
}