aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGravatar Fish-pro <zechun.chen@daocloud.io> 2023-02-16 01:41:51 +0800
committerGravatar GitHub <noreply@github.com> 2023-02-15 12:41:51 -0500
commit156da74ad3b25cf51305768bdb75511e3816d3d0 (patch)
tree8d182902b218a771e49e3ee651b5b04190a61a01 /test
parent8a0d3ba3caa68178954fe30c705d57898dcb4cac (diff)
downloadcoredns-156da74ad3b25cf51305768bdb75511e3816d3d0.tar.gz
coredns-156da74ad3b25cf51305768bdb75511e3816d3d0.tar.zst
coredns-156da74ad3b25cf51305768bdb75511e3816d3d0.zip
Close the body after reading the response body information (#5907)
Signed-off-by: Fish-pro <zechun.chen@daocloud.io>
Diffstat (limited to 'test')
-rw-r--r--test/reload_test.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/reload_test.go b/test/reload_test.go
index 3c701635f..7aee8d037 100644
--- a/test/reload_test.go
+++ b/test/reload_test.go
@@ -123,6 +123,7 @@ func TestReloadMetricsHealth(t *testing.T) {
}
const proc = "coredns_build_info"
metrics, _ := io.ReadAll(resp.Body)
+ resp.Body.Close()
if !bytes.Contains(metrics, []byte(proc)) {
t.Errorf("Failed to see %s in metric output", proc)
}
@@ -135,6 +136,7 @@ func collectMetricsInfo(addr string, procs ...string) error {
return err
}
metrics, _ := io.ReadAll(resp.Body)
+ resp.Body.Close()
for _, p := range procs {
if !bytes.Contains(metrics, []byte(p)) {
return fmt.Errorf("failed to see %s in metric output \n%s", p, metrics)