Skip to content

Commit

Permalink
Fix TestClusterAggregateMetrics (apache#2602)
Browse files Browse the repository at this point in the history
Fix flaky test TestClusterAggregateMetrics
---------

Co-authored-by: Xiaxuan Gao <[email protected]>
  • Loading branch information
MarkGaox and MarkGaox authored Sep 16, 2023
1 parent 279c3f3 commit c607364
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ public void testAggregateMetrics() throws Exception {
expectedMetricValues.put(ERROR_PARTITION_COUNT, 0L);
expectedMetricValues.put(WITHOUT_TOPSTATE_COUNT, 0L);
expectedMetricValues.put(IS_EV_MISMATCH_COUNT, 0L);
Assert.assertTrue(verifyMetrics(expectedMetricValues));
Assert.assertTrue(TestHelper.verify(() -> {
return verifyMetrics(expectedMetricValues);
}, TestHelper.WAIT_DURATION), "Expected metrics and observed metrics don't align.");

// Disable all Participants (instances)
_setupTool.getClusterManagementTool()
Expand All @@ -183,7 +185,9 @@ public void testAggregateMetrics() throws Exception {
Assert.assertTrue(verifier.verifyByPolling());

expectedMetricValues.put(WITHOUT_TOPSTATE_COUNT, 5L);
Assert.assertTrue(verifyMetrics(expectedMetricValues));
Assert.assertTrue(TestHelper.verify(() -> {
return verifyMetrics(expectedMetricValues);
}, TestHelper.WAIT_DURATION), "Expected metrics and observed metrics don't align.");

// Re-enable all Participants (instances)
for (int i = 0; i < NUM_PARTICIPANTS; i++) {
Expand Down Expand Up @@ -223,7 +227,9 @@ public void testAggregateMetrics() throws Exception {
Assert.assertTrue(verifier.verifyByPolling());

expectedMetricValues.put(PARTITION_COUNT, 0L);
Assert.assertTrue(verifyMetrics(expectedMetricValues));
Assert.assertTrue(TestHelper.verify(() -> {
return verifyMetrics(expectedMetricValues);
}, TestHelper.WAIT_DURATION), "Expected metrics and observed metrics don't align.");
}

/**
Expand Down

0 comments on commit c607364

Please sign in to comment.