ndimiduk commented on a change in pull request #1286: HBASE-23977 : Resolve 
flakes present in TestSlowLogRecorder
URL: https://github.com/apache/hbase/pull/1286#discussion_r395330391
 
 

 ##########
 File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/slowlog/TestSlowLogRecorder.java
 ##########
 @@ -140,12 +141,16 @@ public void testOnlieSlowLogConsumption() throws 
Exception {
     Assert.assertNotEquals(-1, HBASE_TESTING_UTILITY.waitFor(3000,
       () -> slowLogRecorder.getSlowLogPayloads(request).size() == 7));
 
-    slowLogPayloads = slowLogRecorder.getSlowLogPayloads(request);
-
-    Assert.assertEquals(slowLogPayloads.size(), 7);
-    confirmPayloadParams(0, 7, slowLogPayloads);
-    confirmPayloadParams(5, 2, slowLogPayloads);
-    confirmPayloadParams(6, 1, slowLogPayloads);
+    Assert.assertNotEquals(-1, HBASE_TESTING_UTILITY.waitFor(3000,
+      () -> {
+        List<SlowLogPayload> slowLogPayloadsList = 
slowLogRecorder.getSlowLogPayloads(request);
+        Assert.assertEquals(slowLogPayloadsList.size(), 7);
+        boolean b1 = confirmPayloadParams(0, 7, slowLogPayloadsList);
 
 Review comment:
   Oh, I see. So you're actually using `waitFor` as a retry mechanism. That's 
not how I imagined using it, but so long as those inner asserts don't interfere 
with the retry, I guess that's fine.
   
   What happens when the inner `Assert.assertEquals(slowLogPayloadsList.size(), 
7);` throws? Does `waitFor` retry that, or does it simply fail? If the latter, 
the test is still flakey. I would loop until I have all the data and then 
perform the asserts at the end.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to