You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2020/03/30 09:31:00 UTC

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

    [ https://issues.apache.org/jira/browse/KAFKA-9786?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17070831#comment-17070831 ] 

ASF GitHub Bot commented on KAFKA-9786:
---------------------------------------

chia7712 commented on pull request #8385: #9786 KAFKA-9786 fix flaky MetricsTest.testGeneralBrokerTopicMetricsA…
URL: https://github.com/apache/kafka/pull/8385
 
 
   ```
   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)
   ```
   
   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```. 
   
   ```
     private def topicMetrics(topic: Option[String]): Set[String] = {
       val metricNames = KafkaYammerMetrics.defaultRegistry.allMetrics().keySet.asScala.map(_.getMBeanName)
       filterByTopicMetricRegex(metricNames, topic)
     }
   ```
   
   ```MetricsTest.testGeneralBrokerTopicMetricsAreGreedilyRegistered``` is not captured by QA since the guy who 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".
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> 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 (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 guy who 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)