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

 ##########
 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:
   Is there any significance to the wait times (30 * 1000 or 10 * 1000's)? If 
not, could we make it a public static constant in TestHelper and use that 
throughout these tests?

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to