You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Chia-Ping Tsai (Jira)" <ji...@apache.org> on 2020/03/30 08:45:00 UTC

[jira] [Updated] (KAFKA-9786) fix flaky MetricsTest.testGeneralBrokerTopicMetricsAreGreedilyRegistered

     [ https://issues.apache.org/jira/browse/KAFKA-9786?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chia-Ping Tsai updated KAFKA-9786:
----------------------------------
    Description: 
{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}

This

BTW, the orphan metrics is left by ReplicaManagerTest.

  was:
{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.


> 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
>
> {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}
> This
> BTW, the orphan metrics is left by ReplicaManagerTest.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)