You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by GitBox <gi...@apache.org> on 2020/10/07 01:12:11 UTC

[GitHub] [helix] kaisun2000 commented on a change in pull request #1447: Fix unit test Thread.sleep() with TestHelper.verify()

kaisun2000 commented on a change in pull request #1447:
URL: https://github.com/apache/helix/pull/1447#discussion_r500680744



##########
File path: helix-core/src/test/java/org/apache/helix/controller/stages/TestRebalancePipeline.java
##########
@@ -152,15 +152,15 @@ public void testDuplicateMsg() throws Exception {
     Assert.assertTrue(messages.get(0).getFromState().equalsIgnoreCase("SLAVE"));
     Assert.assertTrue(messages.get(0).getToState().equalsIgnoreCase("MASTER"));
 
-    runPipeline(event, dataRefresh);
-
+    Thread.sleep(MessageGenerationPhase.DEFAULT_OBSELETE_MSG_PURGE_DELAY);
     // Verify the stale message should be deleted
     Assert.assertTrue(TestHelper.verify(() -> {
+      runPipeline(event, dataRefresh);

Review comment:
       Ok. 
   
   ```
   Thread.sleep(2 * MessageGenerationPhase.DEFAULT_OBSELETE_MSG_PURGE_DELAY);
   runPipeline(event, dataRefresh);
   Assert.assertTrue(TestHelper.verify(() -> {
   if (dataCache.getStaleMessages().size() != 0) {
           return false;
         }
         return true;
       }, TestHelper.WAIT_DURATION));
   ```




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



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org