Improving isolation of metric conflict test

Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com>
This commit is contained in:
Pedro Tanaka 2022-08-26 11:21:02 +02:00 committed by Pedro Tanaka
parent e85098da3f
commit 30c3e31574
No known key found for this signature in database
GPG key ID: D0D8389DA4EE060B

View file

@ -520,10 +520,11 @@ mappings:
events <- s.in events <- s.in
close(events) close(events)
}() }()
ex := NewExporter(prometheus.DefaultRegisterer, testMapper, log.NewNopLogger(), eventsActions, eventsUnmapped, errorEventStats, eventStats, conflictingEventStats, metricsCount) registerer := prometheus.NewRegistry()
ex := NewExporter(registerer, testMapper, log.NewNopLogger(), eventsActions, eventsUnmapped, errorEventStats, eventStats, conflictingEventStats, metricsCount)
ex.Listen(events) ex.Listen(events)
metrics, err := prometheus.DefaultGatherer.Gather() metrics, err := registerer.Gather()
if err != nil { if err != nil {
t.Fatalf("Cannot gather from DefaultGatherer: %v", err) t.Fatalf("Cannot gather from DefaultGatherer: %v", err)
} }