summaryrefslogtreecommitdiff
path: root/plugins/metrics/tests/metrics_test.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-11-13 17:43:20 +0300
committerValery Piashchynski <[email protected]>2020-11-13 17:43:20 +0300
commit9fd0b28d3a6a60b5e08af03bd86bcef042152e1c (patch)
tree2e925c736eb8cf3b27995db0882d06557432925f /plugins/metrics/tests/metrics_test.go
parent99b6012400ab407cfcb04aab833640af565d550d (diff)
golangci linters warnings fix
Diffstat (limited to 'plugins/metrics/tests/metrics_test.go')
-rw-r--r--plugins/metrics/tests/metrics_test.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/plugins/metrics/tests/metrics_test.go b/plugins/metrics/tests/metrics_test.go
index 2900c38f..2df011e6 100644
--- a/plugins/metrics/tests/metrics_test.go
+++ b/plugins/metrics/tests/metrics_test.go
@@ -18,23 +18,23 @@ import (
)
// get request and return body
-func get(url string) (string, *http.Response, error) {
+func get(url string) (string, error) {
r, err := http.Get(url)
if err != nil {
- return "", nil, err
+ return "", err
}
b, err := ioutil.ReadAll(r.Body)
if err != nil {
- return "", nil, err
+ return "", err
}
err = r.Body.Close()
if err != nil {
- return "", nil, err
+ return "", err
}
// unsafe
- return string(b), r, err
+ return string(b), err
}
func TestMetricsInit(t *testing.T) {
@@ -84,7 +84,7 @@ func TestMetricsInit(t *testing.T) {
tt := time.NewTimer(time.Second * 5)
- out, _, err := get("http://localhost:2112/metrics")
+ out, err := get("http://localhost:2112/metrics")
assert.NoError(t, err)
assert.Contains(t, out, "go_gc_duration_seconds")
@@ -162,7 +162,8 @@ func TestMetricsGaugeCollector(t *testing.T) {
time.Sleep(time.Second)
tt := time.NewTimer(time.Second * 5)
- out, _, err := get("http://localhost:2112/metrics")
+ out, err := get("http://localhost:2112/metrics")
+ assert.NoError(t, err)
assert.Contains(t, out, "my_gauge 100")
for {