Esempio n. 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)

	select {
	case res := <-h.Channel():
		if !expected {
			assert.Fail(t, fmt.Sprintf("Did not expect metric %s", res.Name))
		}
	default:
		if expected {
			assert.Fail(t, "Was expecting the metric to go through")
		}
	}
}
Esempio n. 2
0
func sendMetrics(handler handler.Handler, metrics []metric.Metric) {
	for _, m := range metrics {
		handler.Channel() <- m
	}
}