(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestGetOrRegisterHistogram(t *testing.T) { |
| 12 | metricRegistry := metrics.NewRegistry() |
| 13 | histogram := getOrRegisterHistogram("name", metricRegistry) |
| 14 | |
| 15 | if histogram == nil { |
| 16 | t.Error("Unexpected nil histogram") |
| 17 | } |
| 18 | |
| 19 | // Fetch the metric |
| 20 | foundHistogram := metricRegistry.Get("name") |
| 21 | |
| 22 | if foundHistogram != histogram { |
| 23 | t.Error("Unexpected different histogram", foundHistogram, histogram) |
| 24 | } |
| 25 | |
| 26 | // Try to register the metric again |
| 27 | sameHistogram := getOrRegisterHistogram("name", metricRegistry) |
| 28 | |
| 29 | if sameHistogram != histogram { |
| 30 | t.Error("Unexpected different histogram", sameHistogram, histogram) |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | func TestGetMetricNameForBroker(t *testing.T) { |
| 35 | metricName := getMetricNameForBroker("name", &Broker{id: 1}) |
nothing calls this directly
no test coverage detected