From 9d2f96aa78a7017988c2d96fed4610ccd7c79751 Mon Sep 17 00:00:00 2001 From: Arun Gopalpuri Date: Mon, 5 Apr 2021 23:56:24 -0700 Subject: [PATCH] Fix prometheus test (#49) Co-authored-by: Arun Gopalpuri --- prometheus/prometheus_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/prometheus/prometheus_test.go b/prometheus/prometheus_test.go index 1cf7696..e00cf90 100644 --- a/prometheus/prometheus_test.go +++ b/prometheus/prometheus_test.go @@ -127,8 +127,10 @@ func TestMetricsPushGateway(t *testing.T) { p := NewPrometheus("echo", nil) p.Use(e) - result := p.getMetrics() - - assert.Contains(t, string(result), fmt.Sprintf("%s_request_duration", p.Subsystem)) + g := gofight.New() + g.GET(p.MetricsPath).Run(e, func(r gofight.HTTPResponse, rq gofight.HTTPRequest) { + assert.Equal(t, http.StatusOK, r.Code) + assert.NotContains(t, r.Body.String(), fmt.Sprintf("%s_request_duration", p.Subsystem)) + }) unregister(p) }