Add the deferred stop to prometheus wrapper test

This commit is contained in:
Nikolay Bondarenko 2019-01-25 18:45:41 +03:00 committed by Vasiliy Tolstov
parent 57a323f700
commit 1024ea75b3

View File

@ -44,6 +44,8 @@ func TestPrometheusMetrics(t *testing.T) {
server.WrapHandler(NewHandlerWrapper()), server.WrapHandler(NewHandlerWrapper()),
) )
defer s.Stop()
type Test struct { type Test struct {
*testHandler *testHandler
} }
@ -85,8 +87,6 @@ func TestPrometheusMetrics(t *testing.T) {
assert.Equal(t, *metric.Metric[1].Label[1].Name, "status") assert.Equal(t, *metric.Metric[1].Label[1].Name, "status")
assert.Equal(t, *metric.Metric[1].Label[1].Value, "success") assert.Equal(t, *metric.Metric[1].Label[1].Value, "success")
assert.Equal(t, *metric.Metric[1].Counter.Value, float64(1)) assert.Equal(t, *metric.Metric[1].Counter.Value, float64(1))
s.Stop()
} }
func findMetricByName(list []*dto.MetricFamily, tp dto.MetricType, name string) *dto.MetricFamily { func findMetricByName(list []*dto.MetricFamily, tp dto.MetricType, name string) *dto.MetricFamily {