zookeeper-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [zookeeper] anmolnar commented on a change in pull request #1024: ZOOKEEPER-3470:Flaky test: LearnerMetricsTest.testLearnerMetricsTest()
Date Mon, 05 Aug 2019 15:45:34 GMT
anmolnar commented on a change in pull request #1024: ZOOKEEPER-3470:Flaky test: LearnerMetricsTest.testLearnerMetricsTest()
URL: https://github.com/apache/zookeeper/pull/1024#discussion_r310670550
 
 

 ##########
 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:
   No problem. Please put it a finally block then.

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

Mime
View raw message