helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jiajunw...@apache.org
Subject [helix] branch master updated: Stabilize TestUpdateWorkflow (#1135)
Date Wed, 15 Jul 2020 00:23:06 GMT
This is an automated email from the ASF dual-hosted git repository.

jiajunwang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git


The following commit(s) were added to refs/heads/master by this push:
     new 3b471c0  Stabilize TestUpdateWorkflow (#1135)
3b471c0 is described below

commit 3b471c04734fcf9d9a9d43ee66278637339bc503
Author: Ali Reza Zamani Zadeh Najari <anajari@linkedin.com>
AuthorDate: Tue Jul 14 17:22:54 2020 -0700

    Stabilize TestUpdateWorkflow (#1135)
    
    In this commit, Thread.sleep usages have been removed
    from TestUpdateWorkflow and replaced with TestHelper.verify.
---
 .../apache/helix/integration/task/TestUpdateWorkflow.java  | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/helix-core/src/test/java/org/apache/helix/integration/task/TestUpdateWorkflow.java
b/helix-core/src/test/java/org/apache/helix/integration/task/TestUpdateWorkflow.java
index 20ae128..fb71876 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/task/TestUpdateWorkflow.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/task/TestUpdateWorkflow.java
@@ -40,7 +40,7 @@ public class TestUpdateWorkflow extends TaskTestBase {
   private static final Logger LOG = LoggerFactory.getLogger(TestUpdateWorkflow.class);
 
   @Test
-  public void testUpdateRunningQueue() throws InterruptedException {
+  public void testUpdateRunningQueue() throws Exception {
     String queueName = TestHelper.getTestMethodName();
 
     // Create a queue
@@ -70,7 +70,10 @@ public class TestUpdateWorkflow extends TaskTestBase {
     // ensure current schedule is completed
     _driver.pollForWorkflowState(scheduledQueue, TaskState.COMPLETED);
 
-    Thread.sleep(1000);
+    // Make sure next round of the recurrent workflow is scheduled
+    Assert
+        .assertTrue(TestHelper.verify(() -> (TaskTestUtil.pollForWorkflowContext(_driver,
queueName)
+            .getScheduledWorkflows().size() > 1), TestHelper.WAIT_DURATION));
 
     wCtx = TaskTestUtil.pollForWorkflowContext(_driver, queueName);
     scheduledQueue = wCtx.getLastScheduledSingleWorkflow();
@@ -86,7 +89,7 @@ public class TestUpdateWorkflow extends TaskTestBase {
   }
 
   @Test
-  public void testUpdateStoppedQueue() throws InterruptedException {
+  public void testUpdateStoppedQueue() throws Exception {
     String queueName = TestHelper.getTestMethodName();
 
     // Create a queue
@@ -124,7 +127,10 @@ public class TestUpdateWorkflow extends TaskTestBase {
     // ensure current schedule is completed
     _driver.pollForWorkflowState(scheduledQueue, TaskState.COMPLETED);
 
-    Thread.sleep(1000);
+    // Make sure next round of the recurrent workflow is scheduled
+    Assert
+        .assertTrue(TestHelper.verify(() -> (TaskTestUtil.pollForWorkflowContext(_driver,
queueName)
+            .getScheduledWorkflows().size() > 1), TestHelper.WAIT_DURATION));
 
     wCtx = TaskTestUtil.pollForWorkflowContext(_driver, queueName);
     scheduledQueue = wCtx.getLastScheduledSingleWorkflow();


Mime
View raw message