Example #1
0
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)
	_, ok := h.CollectorEndpoints()[coll]
	if !expected && ok {
		assert.Fail(t, fmt.Sprintf("Was not expecting a collector channel for %s", coll))
	}
	if expected && !ok {
		assert.Fail(t, fmt.Sprintf("Was expecting a collector channel for %s", coll))
	}
}