(t *testing.T, client Client)
| 1233 | } |
| 1234 | |
| 1235 | func validateConsumerMetrics(t *testing.T, client Client) { |
| 1236 | // Get the broker used by test1 topic |
| 1237 | var broker *Broker |
| 1238 | if partitions, err := client.Partitions("test.1"); err != nil { |
| 1239 | t.Error(err) |
| 1240 | } else { |
| 1241 | for _, partition := range partitions { |
| 1242 | if b, err := client.Leader("test.1", partition); err != nil { |
| 1243 | t.Error(err) |
| 1244 | } else { |
| 1245 | if broker != nil && b != broker { |
| 1246 | t.Fatal("Expected only one broker, got at least 2") |
| 1247 | } |
| 1248 | broker = b |
| 1249 | } |
| 1250 | } |
| 1251 | } |
| 1252 | |
| 1253 | metricValidators := newMetricValidators() |
| 1254 | |
| 1255 | // at least 1 global fetch request for the given topic |
| 1256 | metricValidators.registerForGlobalAndTopic("test_1", minCountMeterValidator("consumer-fetch-rate", 1)) |
| 1257 | |
| 1258 | // and at least 1 fetch request to the lead broker |
| 1259 | metricValidators.registerForBroker(broker, minCountMeterValidator("consumer-fetch-rate", 1)) |
| 1260 | |
| 1261 | // Run the validators |
| 1262 | metricValidators.run(t, client.Config().MetricRegistry) |
| 1263 | } |
| 1264 | |
| 1265 | // Benchmarks |
| 1266 |
no test coverage detected