Browse Source

Log response body if test fails.

pull/614/head
Alexey Palazhchenko 7 years ago
parent
commit
4d294889da
  1. 6
      node_exporter_test.go

6
node_exporter_test.go

@ -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
}

Loading…
Cancel
Save