Chia-Ping Tsai created KAFKA-9786: ------------------------------------- Summary: fix flaky MetricsTest.testGeneralBrokerTopicMetricsAreGreedilyRegistered Key: KAFKA-9786 URL: https://issues.apache.org/jira/browse/KAFKA-9786 Project: Kafka Issue Type: Test Reporter: Chia-Ping Tsai Assignee: Chia-Ping Tsai
{code:java} java.lang.AssertionError: expected:<18> but was:<23> at org.junit.Assert.fail(Assert.java:89) at org.junit.Assert.failNotEquals(Assert.java:835) at org.junit.Assert.assertEquals(Assert.java:647) at org.junit.Assert.assertEquals(Assert.java:633) at kafka.metrics.MetricsTest.testGeneralBrokerTopicMetricsAreGreedilyRegistered(MetricsTest.scala:108) {code} As gradle may use same JVM to run multiples test, the metrics from other tests can break MetricsTest.testGeneralBrokerTopicMetricsAreGreedilyRegistered. {code:scala} private def topicMetrics(topic: Option[String]): Set[String] = { val metricNames = KafkaYammerMetrics.defaultRegistry.allMetrics().keySet.asScala.map(_.getMBeanName) filterByTopicMetricRegex(metricNames, topic) } {code} BTW, the orphan metrics is left by ReplicaManagerTest. -- This message was sent by Atlassian Jira (v8.3.4#803005)