You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by km...@apache.org on 2019/01/29 07:33:10 UTC

[oozie] branch master updated: OOZIE-3243 [tests] Flaky test TestCoordActionsKillXCommand#testActionKillCommandDate (asalamon74 via kmarton)

This is an automated email from the ASF dual-hosted git repository.

kmarton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/oozie.git


The following commit(s) were added to refs/heads/master by this push:
     new 31522a6  OOZIE-3243 [tests] Flaky test TestCoordActionsKillXCommand#testActionKillCommandDate (asalamon74 via kmarton)
31522a6 is described below

commit 31522a6393f4a72e35ab226bac8a0dff81056e1f
Author: Julia Kinga Marton <km...@apache.org>
AuthorDate: Tue Jan 29 08:32:56 2019 +0100

    OOZIE-3243 [tests] Flaky test TestCoordActionsKillXCommand#testActionKillCommandDate (asalamon74 via kmarton)
---
 .../coord/TestCoordActionsKillXCommand.java        | 29 ++++++++++++++++++----
 release-log.txt                                    |  1 +
 2 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionsKillXCommand.java b/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionsKillXCommand.java
index c9b2f28..dbb5e68 100644
--- a/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionsKillXCommand.java
+++ b/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionsKillXCommand.java
@@ -29,6 +29,7 @@ import org.apache.oozie.client.WorkflowJob;
 import org.apache.oozie.executor.jpa.CoordActionGetForCheckJPAExecutor;
 import org.apache.oozie.executor.jpa.CoordActionQueryExecutor;
 import org.apache.oozie.executor.jpa.CoordActionQueryExecutor.CoordActionQuery;
+import org.apache.oozie.executor.jpa.JPAExecutorException;
 import org.apache.oozie.executor.jpa.WorkflowJobQueryExecutor.WorkflowJobQuery;
 import org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor;
 import org.apache.oozie.executor.jpa.WorkflowJobInsertJPAExecutor;
@@ -105,7 +106,7 @@ public class TestCoordActionsKillXCommand extends XDataTestCase {
      * Test the working of CoordActionKillXCommand by passing range
      * as date
      *
-     * @throws Exception
+     * @throws Exception in case of error
      */
     public void testActionKillCommandDate() throws Exception {
         JPAService jpaService = services.get(JPAService.class);
@@ -122,10 +123,7 @@ public class TestCoordActionsKillXCommand extends XDataTestCase {
         System.out.println(action.getNominalTime());
         assertEquals(CoordinatorAction.Status.KILLED, action.getStatus());
 
-        sleep(100);
-        WorkflowJobBean wf = WorkflowJobQueryExecutor.getInstance().get(WorkflowJobQuery.GET_WORKFLOW_FOR_SLA,
-                ids[3]);
-        assertEquals(WorkflowJob.Status.KILLED, wf.getStatus());
+        waitAndAssertWorkflowJobStatus(ids[3], WorkflowJob.Status.KILLED );
 
         CoordinatorJobBean job = jpaService.execute(new CoordJobGetJPAExecutor(ids[0]));
         assertEquals(CoordinatorJob.Status.RUNNING, job.getStatus());
@@ -136,6 +134,27 @@ public class TestCoordActionsKillXCommand extends XDataTestCase {
         assertEquals(CoordinatorJob.Status.KILLED, job.getStatus());
     }
 
+    private void waitAndAssertWorkflowJobStatus(final String workflowJobId, final WorkflowJob.Status status) throws Exception {
+        waitFor(5 * 1000, new Predicate() {
+            @Override
+            public boolean evaluate() throws Exception {
+                try {
+                    WorkflowJobBean wf = getWorkflowJobBean(workflowJobId);
+                    return wf.getStatus() == status;
+                }
+                catch (JPAExecutorException se) {
+                    throw new Exception("Workflow Job " + workflowJobId + " was not stored properly in db");
+                }
+            }
+        });
+        WorkflowJobBean wf = getWorkflowJobBean(workflowJobId);
+        assertEquals(status, wf.getStatus());
+    }
+
+    private WorkflowJobBean getWorkflowJobBean(String workflowJobId) throws JPAExecutorException {
+        return WorkflowJobQueryExecutor.getInstance().get(WorkflowJobQuery.GET_WORKFLOW_FOR_SLA, workflowJobId);
+    }
+
     private String[] createDBRecords() throws Exception {
         JPAService jpaService = services.get(JPAService.class);
 
diff --git a/release-log.txt b/release-log.txt
index 9d3af7b..b5ca0cf 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
 -- Oozie 5.2.0 release (trunk - unreleased)
 
+OOZIE-3243 [tests] Flaky test TestCoordActionsKillXCommand#testActionKillCommandDate (asalamon74 via kmarton)
 OOZIE-3419 amend [fluent-job] GraphVisualization fails before JDK 1.8.0_u40 (asalamon74 via kmarton)
 OOZIE-3420 [action] pom.xml fixes (andras.piros via kmarton)
 OOZIE-3414 Oozie master does not compile with -Dhadoop.version=2.8.5 (asalamon74 via kmarton)