Repository: oozie Updated Branches: refs/heads/master 5e1c9d362 -> 69c5091ad
OOZIE-3041 TestWorkflowActionRetryInfoXCommand fails in oozie core module (andras.piros via gezapeti) Project: http://git-wip-us.apache.org/repos/asf/oozie/repo Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/69c5091a Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/69c5091a Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/69c5091a Branch: refs/heads/master Commit: 69c5091ada3cb207819cc79697c59bade64d46ed Parents: 5e1c9d3 Author: Gezapeti Cseh <gezap...@apache.org> Authored: Tue Sep 12 09:22:29 2017 +0200 Committer: Gezapeti Cseh <gezap...@apache.org> Committed: Tue Sep 12 09:22:29 2017 +0200 ---------------------------------------------------------------------- .../org/apache/oozie/client/rest/JsonUtils.java | 2 +- core/pom.xml | 6 +++++ .../wf/TestWorkflowActionRetryInfoXCommand.java | 28 +++++++++++++------- release-log.txt | 1 + 4 files changed, 27 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/oozie/blob/69c5091a/client/src/main/java/org/apache/oozie/client/rest/JsonUtils.java ---------------------------------------------------------------------- diff --git a/client/src/main/java/org/apache/oozie/client/rest/JsonUtils.java b/client/src/main/java/org/apache/oozie/client/rest/JsonUtils.java index aa3d983..174e09a 100644 --- a/client/src/main/java/org/apache/oozie/client/rest/JsonUtils.java +++ b/client/src/main/java/org/apache/oozie/client/rest/JsonUtils.java @@ -73,7 +73,7 @@ public class JsonUtils { * @param str string to parse. * @return parsed date, <code>null</code> if the string was <code>null</code> or in an invalid format. */ - static Date parseDateRfc822(String str) { + public static Date parseDateRfc822(String str) { if (str != null) { try { SimpleDateFormat dateFormater = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'", Locale.US); http://git-wip-us.apache.org/repos/asf/oozie/blob/69c5091a/core/pom.xml ---------------------------------------------------------------------- diff --git a/core/pom.xml b/core/pom.xml index ea2de53..b080954 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -442,6 +442,12 @@ </dependency> <dependency> + <groupId>joda-time</groupId> + <artifactId>joda-time</artifactId> + <scope>test</scope> + </dependency> + + <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <scope>compile</scope> http://git-wip-us.apache.org/repos/asf/oozie/blob/69c5091a/core/src/test/java/org/apache/oozie/command/wf/TestWorkflowActionRetryInfoXCommand.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/oozie/command/wf/TestWorkflowActionRetryInfoXCommand.java b/core/src/test/java/org/apache/oozie/command/wf/TestWorkflowActionRetryInfoXCommand.java index 3e49f43..5c06ae5 100644 --- a/core/src/test/java/org/apache/oozie/command/wf/TestWorkflowActionRetryInfoXCommand.java +++ b/core/src/test/java/org/apache/oozie/command/wf/TestWorkflowActionRetryInfoXCommand.java @@ -19,6 +19,7 @@ package org.apache.oozie.command.wf; import java.io.File; +import java.util.Date; import java.util.List; import java.util.Map; import org.apache.hadoop.conf.Configuration; @@ -36,6 +37,7 @@ import org.apache.oozie.service.SchemaService; import org.apache.oozie.service.Services; import org.apache.oozie.test.XDataTestCase; import org.apache.oozie.util.XConfiguration; +import org.joda.time.Interval; public class TestWorkflowActionRetryInfoXCommand extends XDataTestCase { private Services services; @@ -154,29 +156,37 @@ public class TestWorkflowActionRetryInfoXCommand extends XDataTestCase { }); List<WorkflowActionBean> actions = jpaService.execute(actionsGetExecutor); - WorkflowActionBean action = null; + WorkflowActionBean action1 = null; + WorkflowActionBean action2 = null; for (WorkflowActionBean bean : actions) { - if (bean.getType().equals("test")) { - action = bean; - break; + if (bean.getType().equals("test") && bean.getName().equals("action1")) { + action1 = bean; + } + else if (bean.getType().equals("test") && bean.getName().equals("action2")) { + action2 = bean; } } - WorkflowActionRetryInfoXCommand command = new WorkflowActionRetryInfoXCommand(action.getId()); + + WorkflowActionRetryInfoXCommand command = new WorkflowActionRetryInfoXCommand(action1.getId()); List<Map<String, String>> retriesList = command.call(); assertEquals(2, retriesList.size()); - assertEquals(2, action.getUserRetryCount()); + assertEquals(2, action1.getUserRetryCount()); assertEquals(retriesList.get(0).get(JsonTags.ACTION_ATTEMPT), "1"); assertEquals(retriesList.get(0).get(JsonTags.WORKFLOW_ACTION_START_TIME), - JsonUtils.formatDateRfc822(action.getStartTime())); + JsonUtils.formatDateRfc822(action1.getStartTime())); assertNotNull(retriesList.get(0).get(JsonTags.WORKFLOW_ACTION_CONSOLE_URL)); assertNotNull(retriesList.get(0).get(JsonTags.WORKFLOW_ACTION_EXTERNAL_CHILD_IDS)); assertNotNull(retriesList.get(1).get(JsonTags.WORKFLOW_ACTION_CONSOLE_URL)); assertNotNull(retriesList.get(1).get(JsonTags.WORKFLOW_ACTION_EXTERNAL_CHILD_IDS)); - assertEquals(retriesList.get(1).get(JsonTags.WORKFLOW_ACTION_END_TIME), - JsonUtils.formatDateRfc822(action.getEndTime())); + final Date actionEndTime = action2 == null ? action1.getEndTime() : action2.getEndTime(); + final Date secondRetryEndTime = JsonUtils.parseDateRfc822(retriesList.get(1).get(JsonTags.WORKFLOW_ACTION_END_TIME)); + + assertTrue("action end time should be within ten seconds of second retry end time", + new Interval(secondRetryEndTime.getTime(), secondRetryEndTime.getTime() + 10_000) + .contains(actionEndTime.getTime())); } } http://git-wip-us.apache.org/repos/asf/oozie/blob/69c5091a/release-log.txt ---------------------------------------------------------------------- diff --git a/release-log.txt b/release-log.txt index e1ef0df..1fb1a1d 100644 --- a/release-log.txt +++ b/release-log.txt @@ -1,5 +1,6 @@ -- Oozie 5.0.0 release (trunk - unreleased) +OOZIE-3041 TestWorkflowActionRetryInfoXCommand fails in oozie core module (andras.piros via gezapeti) OOZIE-2916 Set a job name for the MR Action's child job (asasvari) OOZIE-2858 HiveMain, ShellMain and SparkMain should not overwrite properties and config files locally (gezapeti) OOZIE-3035 HDFS HA and log aggregation: getting HDFS delegation token from YARN renewer within JavaActionExecutor (andras.piros via pbacsko)