Skip to content

Commit 9d2f96a

Browse files
arun0009Arun Gopalpuri
andauthored
Fix prometheus test (#49)
Co-authored-by: Arun Gopalpuri <[email protected]>
1 parent 304bbdf commit 9d2f96a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

prometheus/prometheus_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,10 @@ func TestMetricsPushGateway(t *testing.T) {
127127
p := NewPrometheus("echo", nil)
128128
p.Use(e)
129129

130-
result := p.getMetrics()
131-
132-
assert.Contains(t, string(result), fmt.Sprintf("%s_request_duration", p.Subsystem))
130+
g := gofight.New()
131+
g.GET(p.MetricsPath).Run(e, func(r gofight.HTTPResponse, rq gofight.HTTPRequest) {
132+
assert.Equal(t, http.StatusOK, r.Code)
133+
assert.NotContains(t, r.Body.String(), fmt.Sprintf("%s_request_duration", p.Subsystem))
134+
})
133135
unregister(p)
134136
}

0 commit comments

Comments
 (0)