func checkEmission(t *testing.T, coll string, h handler.Handler, expected bool) { m := metric.Metric{ Name: "test", Value: 1, Dimensions: map[string]string{"collector": coll}, } writeToHandlers([]handler.Handler{h}, m) ch, _ := h.CollectorChannels()[coll] if !expected && ch != nil { assert.Fail(t, fmt.Sprintf("Was not expecting a collector channel for %s", coll)) } if expected && ch == nil { assert.Fail(t, fmt.Sprintf("Was expecting a collector channel for %s", coll)) } }