This is an automated email from the ASF dual-hosted git repository. jxue pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/helix.git
commit 813e49ec8816d6fa2794353155891d341a2512c1 Author: Ali Reza Zamani Zadeh Najari <[email protected]> AuthorDate: Mon May 4 10:37:43 2020 -0700 Fix the flaky test TestRecurringJobQueue.testCreateStoppedQueue (#983) In this commit, the necessary checks have been added to make sure we do not hit NullPointerException when checking LastScheduledWorkflow. --- .../helix/integration/task/TestRecurringJobQueue.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/helix-core/src/test/java/org/apache/helix/integration/task/TestRecurringJobQueue.java b/helix-core/src/test/java/org/apache/helix/integration/task/TestRecurringJobQueue.java index 6bf5a92..20c53b1 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/task/TestRecurringJobQueue.java +++ b/helix-core/src/test/java/org/apache/helix/integration/task/TestRecurringJobQueue.java @@ -223,7 +223,7 @@ public class TestRecurringJobQueue extends TaskTestBase { } @Test - public void testCreateStoppedQueue() throws InterruptedException { + public void testCreateStoppedQueue() throws Exception { String queueName = TestHelper.getTestMethodName(); // Create a queue @@ -238,12 +238,14 @@ public class TestRecurringJobQueue extends TaskTestBase { _driver.resume(queueName); - //TaskTestUtil.pollForWorkflowState(_driver, queueName, ); - WorkflowContext wCtx = TaskTestUtil.pollForWorkflowContext(_driver, queueName); + // ensure LAST_SCHEDULED_WORKFLOW field is written to Zookeeper + Assert.assertTrue(TestHelper.verify(() -> { + WorkflowContext wCtx = TaskTestUtil.pollForWorkflowContext(_driver, queueName); + return wCtx.getLastScheduledSingleWorkflow() != null; + }, TestHelper.WAIT_DURATION)); - // ensure current schedule is started - String scheduledQueue = wCtx.getLastScheduledSingleWorkflow(); - _driver.pollForWorkflowState(scheduledQueue, TaskState.COMPLETED); + WorkflowContext wCtx = TaskTestUtil.pollForWorkflowContext(_driver, queueName); + _driver.pollForWorkflowState(wCtx.getLastScheduledSingleWorkflow(), TaskState.COMPLETED); } @Test
