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 2019/11/25 22:12:30 UTC

[GitHub] [helix] alirezazamani commented on a change in pull request #624: Stabilize 5 unstable tests

alirezazamani commented on a change in pull request #624: Stabilize 5 unstable tests
URL: https://github.com/apache/helix/pull/624#discussion_r350450233
 
 

 ##########
 File path: helix-core/src/test/java/org/apache/helix/controller/dataproviders/TestWorkflowControllerDataProvider.java
 ##########
 @@ -30,21 +30,26 @@
 public class TestWorkflowControllerDataProvider extends TaskTestBase {
 
   @Test
-  public void testResourceConfigRefresh() throws InterruptedException {
+  public void testResourceConfigRefresh() throws Exception {
     Workflow.Builder builder = new Workflow.Builder("TEST");
     JobConfig.Builder jobBuilder = JobConfig.Builder.fromMap(WorkflowGenerator.DEFAULT_JOB_CONFIG);
 
     builder.addJob(WorkflowGenerator.JOB_NAME_1, jobBuilder);
 
     _driver.start(builder.build());
-    Thread.sleep(4000);
+
     WorkflowControllerDataProvider cache =
         new WorkflowControllerDataProvider("CLUSTER_" + TestHelper.getTestClassName());
-    cache.requireFullRefresh();
-    cache.refresh(_manager.getHelixDataAccessor());
-    Assert.assertEquals(cache.getJobConfigMap().size(), 1);
-    Assert.assertEquals(cache.getWorkflowConfigMap().size(), 1);
-    Assert.assertEquals(cache.getContexts().size(), 2);
+
+    boolean expectedValuesAchieved = TestHelper.verify(() -> {
+      cache.requireFullRefresh();
+      cache.refresh(_manager.getHelixDataAccessor());
+      int configMapSize = cache.getJobConfigMap().size();
+      int workflowConfigMapSize = cache.getWorkflowConfigMap().size();
+      int contextsSize = cache.getContexts().size();
+      return (configMapSize == 1 && workflowConfigMapSize == 1 && contextsSize == 2);
+    }, 30 * 1000);
 
 Review comment:
   Good comment. Fixed. We already have TestHelper.WAIT_DURATION. I leveraged that here.

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

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