This is an automated email from the ASF dual-hosted git repository.
juzhiyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git
The following commit(s) were added to refs/heads/master by this push:
new b1b405e fix: added respbody error asserton and defer resp.Body.Close
() (#1531)
b1b405e is described below
commit b1b405e02132b13d3e748294eb5c9337dfafb674
Author: JinChen <[email protected]>
AuthorDate: Tue Mar 2 11:52:18 2021 +0800
fix: added respbody error asserton and defer resp.Body.Close () (#1531)
---
api/test/e2enew/upstream/upstream_test.go | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/api/test/e2enew/upstream/upstream_test.go
b/api/test/e2enew/upstream/upstream_test.go
index c0776a0..0707d74 100644
--- a/api/test/e2enew/upstream/upstream_test.go
+++ b/api/test/e2enew/upstream/upstream_test.go
@@ -331,6 +331,7 @@ var _ = ginkgo.Describe("Upstream chash remote addr",
func() {
for i := 0; i < 18; i++ {
resp, err := http.DefaultClient.Do(request)
assert.Nil(t, err)
+ defer resp.Body.Close()
respBody, err := ioutil.ReadAll(resp.Body)
assert.Nil(t, err)
body := string(respBody)
@@ -339,7 +340,6 @@ var _ = ginkgo.Describe("Upstream chash remote addr",
func() {
} else {
res[body]++
}
- resp.Body.Close()
}
assert.Equal(t, 18, res["1982"])
})
@@ -403,11 +403,12 @@ var _ = ginkgo.Describe("Upstream chash remote addr",
func() {
for i := 0; i <= 17; i++ {
resp, err := http.DefaultClient.Do(request)
assert.Nil(t, err)
+ defer resp.Body.Close()
respBody, err := ioutil.ReadAll(resp.Body)
+ assert.Nil(t, err)
if string(respBody) == "1980" {
count++
}
- resp.Body.Close()
}
assert.Equal(t, 18, count)
})