diff options
author | Wolfy-J <[email protected]> | 2019-12-23 14:43:47 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2019-12-23 14:43:47 +0300 |
commit | c7b0a4a81827284f7565c56aa476eea34fb6382f (patch) | |
tree | ee30e93169c37fb058fbe55af6b3f954eabd9646 /service/metrics/service_test.go | |
parent | 7f694966730f6dac09d0d0ea3bf51276b8e4dfe4 (diff) |
- test fixes
Diffstat (limited to 'service/metrics/service_test.go')
-rw-r--r-- | service/metrics/service_test.go | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/service/metrics/service_test.go b/service/metrics/service_test.go index 0cf6fd95..62e6f6d7 100644 --- a/service/metrics/service_test.go +++ b/service/metrics/service_test.go @@ -43,9 +43,16 @@ func get(url string) (string, *http.Response, error) { if err != nil { return "", nil, err } - defer r.Body.Close() b, err := ioutil.ReadAll(r.Body) + if err != nil { + return "", nil, err + } + + err = r.Body.Close() + if err != nil { + return "", nil, err + } return string(b), r, err } @@ -63,7 +70,12 @@ func TestService_Serve(t *testing.T) { s, _ := c.Get(ID) assert.NotNil(t, s) - go func() { c.Serve() }() + go func() { + err := c.Serve() + if err != nil { + t.Errorf("error during the Serve: error %v", err) + } + }() time.Sleep(time.Millisecond * 100) defer c.Stop() @@ -94,7 +106,12 @@ func Test_ServiceCustomMetric(t *testing.T) { assert.NoError(t, s.(*Service).Register(collector)) - go func() { c.Serve() }() + go func() { + err := c.Serve() + if err != nil { + t.Errorf("error during the Serve: error %v", err) + } + }() time.Sleep(time.Millisecond * 100) defer c.Stop() @@ -127,7 +144,12 @@ func Test_ServiceCustomMetricMust(t *testing.T) { s.(*Service).MustRegister(collector) - go func() { c.Serve() }() + go func() { + err := c.Serve() + if err != nil { + t.Errorf("error during the Serve: error %v", err) + } + }() time.Sleep(time.Millisecond * 100) defer c.Stop() @@ -160,7 +182,12 @@ func Test_ConfiguredMetric(t *testing.T) { assert.True(t, s.(*Service).Enabled()) - go func() { c.Serve() }() + go func() { + err := c.Serve() + if err != nil { + t.Errorf("error during the Serve: error %v", err) + } + }() time.Sleep(time.Millisecond * 100) defer c.Stop() |