MCPcopy
hub / github.com/prometheus/client_golang / TestNil

Function TestNil

prometheus/wrap_test.go:340–347  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

338}
339
340func TestNil(t *testing.T) {
341 // A wrapped nil registerer should be treated as a no-op, and not panic.
342 c := NewCounter(CounterOpts{Name: "test"})
343 err := WrapRegistererWith(Labels{"foo": "bar"}, nil).Register(c)
344 if err != nil {
345 t.Fatal("registering failed:", err)
346 }
347}
348
349func TestWrapCollector(t *testing.T) {
350 t.Run("can be registered and un-registered", func(t *testing.T) {

Callers

nothing calls this directly

Calls 3

WrapRegistererWithFunction · 0.85
NewCounterFunction · 0.70
RegisterMethod · 0.65

Tested by

no test coverage detected