This is an automated email from the ASF dual-hosted git repository.
jxue pushed a commit to branch task-improvement
in repository https://gitbox.apache.org/repos/asf/helix.git
The following commit(s) were added to refs/heads/task-improvement by this push:
new c6d0a54 Fix the flaky test TestRecurringJobQueue.testCreateStoppedQueue (#983)
c6d0a54 is described below
commit c6d0a54e586f1e8f243c72791dd0c0342dd410d7
Author: Ali Reza Zamani Zadeh Najari <anajari@linkedin.com>
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 f5a44d8..a543c53 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
|