[
https://issues.apache.org/jira/browse/KAFKA-9786?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Chia-Ping Tsai updated KAFKA-9786:
----------------------------------
Labels: flaky-test (was: )
> 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
> Priority: Minor
> Labels: flaky-test
>
> {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 (see
> https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.Test.html#org.gradle.api.tasks.testing.Test:forkEvery),
> 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}
> MetricsTest.testGeneralBrokerTopicMetricsAreGreedilyRegistered is not
> captured by QA since the test which leaves orphan metrics in JVM is
> ReplicaManagerTest and it belongs to integrationTest. By contrast,
> MetricsTest is a part of unitTest. Hence, they are NOT executed by same JVM
> (since they are NOT in the same task).
> MetricsTest.testGeneralBrokerTopicMetricsAreGreedilyRegistered fails
> frequently on my jenkins because my jenkins verify kafka by running
> "./gradlew clean core:test".
--
This message was sent by Atlassian Jira
(v8.3.4#803005)