You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2019/07/31 16:20:37 UTC

[GitHub] [zookeeper] anmolnar commented on a change in pull request #1024: ZOOKEEPER-3470:Flaky test: LearnerMetricsTest.testLearnerMetricsTest()

anmolnar commented on a change in pull request #1024: ZOOKEEPER-3470:Flaky test: LearnerMetricsTest.testLearnerMetricsTest()
URL: https://github.com/apache/zookeeper/pull/1024#discussion_r309312593
 
 

 ##########
 File path: zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/LearnerMetricsTest.java
 ##########
 @@ -78,15 +78,22 @@ public void testLearnerMetricsTest() throws Exception {
 
         Map<String, Object> values = MetricsUtils.currentServerMetrics();
         // there are 4 followers, each received two proposals, one for leader election, one for the create request
-        Assert.assertEquals(8L, values.get("learner_proposal_received_count"));
-        Assert.assertEquals(8L, values.get("cnt_proposal_latency"));
-        Assert.assertThat((long)values.get("min_proposal_latency"), greaterThan(0L));
-        Assert.assertEquals(10L, values.get("cnt_proposal_ack_creation_latency"));
-        Assert.assertThat((long)values.get("min_proposal_ack_creation_latency"), greaterThan(0L));
+        Assert.assertThat((long)values.get("learner_proposal_received_count"), lessThanOrEqualTo(8L));
+        Assert.assertThat((long)values.get("cnt_proposal_latency"), lessThanOrEqualTo(8L));
+        Assert.assertThat((long)values.get("min_proposal_latency"), greaterThanOrEqualTo(0L));
+        Assert.assertThat((long)values.get("cnt_proposal_ack_creation_latency"), lessThanOrEqualTo(10L));
+        Assert.assertThat((long)values.get("min_proposal_ack_creation_latency"), greaterThanOrEqualTo(0L));
 
         // there are five learners, each received two commits, one for leader election, one for the create request
-        Assert.assertEquals(10L, values.get("learner_commit_received_count"));
-        Assert.assertEquals(10L, values.get("cnt_commit_propagation_latency"));
-        Assert.assertThat((long)values.get("min_commit_propagation_latency"), greaterThan(0L));
+        Assert.assertThat((long)values.get("learner_commit_received_count"), lessThanOrEqualTo(10L));
+        Assert.assertThat((long)values.get("cnt_commit_propagation_latency"), lessThanOrEqualTo(10L));
+        Assert.assertThat((long)values.get("min_commit_propagation_latency"), greaterThanOrEqualTo(0L));
+
+        //clean up
+        zk.close();
+        for(int i = 0; i < SERVER_COUNT; i++) {
 
 Review comment:
   Is it possible to use the `LaunchServers()` method in the base class to instantiate the quorum and rely on the `tearDown()` logic instead of this manual shutdown?

----------------------------------------------------------------
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


With regards,
Apache Git Services