azkaban-aplcache

Test stability: FlowRunnerTest2 (#1162) See also #1160. Clear

6/4/2017 6:03:28 PM

Details

diff --git a/azkaban-common/src/test/java/azkaban/executor/InteractiveTestJob.java b/azkaban-common/src/test/java/azkaban/executor/InteractiveTestJob.java
index ba7894a..df1f8e0 100644
--- a/azkaban-common/src/test/java/azkaban/executor/InteractiveTestJob.java
+++ b/azkaban-common/src/test/java/azkaban/executor/InteractiveTestJob.java
@@ -17,6 +17,7 @@
 package azkaban.executor;
 
 import static azkaban.flow.CommonJobProperties.JOB_ATTEMPT;
+import static org.junit.Assert.assertNotNull;
 
 import azkaban.flow.CommonJobProperties;
 import azkaban.jobExecutor.AbstractProcessJob;
@@ -141,4 +142,10 @@ public class InteractiveTestJob extends AbstractProcessJob {
     info("Killing job");
     failJob();
   }
+
+  public static void clearTestJobs(final String... names) {
+    for (String name : names) {
+      assertNotNull(testJobs.remove(name));
+    }
+  }
 }
diff --git a/azkaban-exec-server/src/test/java/azkaban/execapp/FlowRunnerTest2.java b/azkaban-exec-server/src/test/java/azkaban/execapp/FlowRunnerTest2.java
index d11ead5..6210b03 100644
--- a/azkaban-exec-server/src/test/java/azkaban/execapp/FlowRunnerTest2.java
+++ b/azkaban-exec-server/src/test/java/azkaban/execapp/FlowRunnerTest2.java
@@ -45,7 +45,6 @@ import org.apache.commons.io.FileUtils;
 import org.apache.log4j.Logger;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 
 /**
@@ -549,8 +548,6 @@ public class FlowRunnerTest2 extends FlowRunnerTestBase {
    * Any jobs that are running will be assigned a KILLED state, and any nodes which were skipped due
    * to prior errors will be given a CANCELLED state.
    */
-  //todo HappyRay: fix the flaky test issue #1155
-  @Ignore
   @Test
   public void testCancelOnFailure() throws Exception {
     // Test propagation of KILLED status to embedded flows different branch
@@ -600,8 +597,6 @@ public class FlowRunnerTest2 extends FlowRunnerTestBase {
   /**
    * Tests retries after a failure
    */
-  //todo HappyRay: fix the flaky test issue #1155
-  @Ignore
   @Test
   public void testRetryOnFailure() throws Exception {
     // Test propagation of KILLED status to embedded flows different branch
@@ -648,6 +643,8 @@ public class FlowRunnerTest2 extends FlowRunnerTestBase {
       System.out.println(inNode.getId() + " > " + inNode.getStatus());
     }
 
+    assertStatus("jobb:innerFlow", Status.SKIPPED);
+    InteractiveTestJob.clearTestJobs("jobb:innerJobB", "jobb:innerJobC");
     this.runner.retryFailures("me");
     assertStatus("jobb:innerJobB", Status.RUNNING);
     assertStatus("jobb:innerJobC", Status.RUNNING);
@@ -984,8 +981,6 @@ public class FlowRunnerTest2 extends FlowRunnerTestBase {
    * Test the condition when a Finish all possible is called during a pause. The Failure is not
    * acted upon until the flow is resumed.
    */
-  //todo HappyRay: fix the flaky test issue #1155
-  @Ignore
   @Test
   public void testPauseFailFinishAll() throws Exception {
     final EventCollectorListener eventCollector = new EventCollectorListener();