summaryrefslogtreecommitdiff
path: root/plugins/metrics/tests
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
parent99b6012400ab407cfcb04aab833640af565d550d (diff)
golangci linters warnings fix
Diffstat (limited to 'plugins/metrics/tests')
-rw-r--r--plugins/metrics/tests/metrics_test.go15
-rw-r--r--plugins/metrics/tests/plugin1.go4
2 files changed, 10 insertions, 9 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 {
diff --git a/plugins/metrics/tests/plugin1.go b/plugins/metrics/tests/plugin1.go
index cac41c82..345a3ec6 100644
--- a/plugins/metrics/tests/plugin1.go
+++ b/plugins/metrics/tests/plugin1.go
@@ -58,7 +58,7 @@ func (p *Plugin3) Stop() error {
}
func (p *Plugin3) Name() string {
- return "metrics_test.plugin1"
+ return "metrics_test.plugin3"
}
func (p *Plugin3) MetricsCollector() prometheus.Collector {
@@ -90,7 +90,7 @@ func (p *Plugin4) Stop() error {
}
func (p *Plugin4) Name() string {
- return "metrics_test.plugin1"
+ return "metrics_test.plugin4"
}
func (p *Plugin4) MetricsCollector() prometheus.Collector {