[
https://issues.apache.org/jira/browse/OOZIE-2726?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15666060#comment-15666060
]
Satish Subhashrao Saley edited comment on OOZIE-2726 at 11/15/16 5:11 AM:
--------------------------------------------------------------------------
1. TestCoordMaterializeTransitionXCommand.testMaterizationLookup
If start is in Daylight savings time (e.g. PDT) and end is in Standard time
(e.g. PST), then we need to add DST_OFFSET to end.
If start is in Standard time (e.g. PST) and end is in Daylight savings time
(e.g. PDT), then we need to subtract DST_OFFSET from end.
In this test case, coord job start time is in Daylight time and end time is in
Standard Time. Therefore, we should be adding DST_OFFSET to end. We don't have
daylight adjustments while materializing the actions. In the following loop, we
increment {{effStart}} which is in Daylight time and compared it with {{end}}
which is in Standard Time. This results in materialization of one less action.
{code}
https://github.com/apache/oozie/blob/master/core/src/main/java/org/apache/oozie/command/coord/CoordMaterializeTransitionXCommand.java#L458
while (effStart.compareTo(end) < 0 && (ignoreMaxActions ||
maxActionToBeCreated-- > 0)) {
if (pause != null && effStart.compareTo(pause) >= 0) {
break;
}
...
...
effStart.add(freqTU.getCalendarUnit(), lastActionNumber *
Integer.parseInt(coordJob.getFrequency()));
{code}
The same thing happens when start is in Standard time and end is in Daylight
savings time. But there we get one extra materialized action.
2. TestCoordMaterializeTransitionXCommand.testActionMaterWithDST1 and
TestCoordMaterializeTransitionXCommand.testActionMaterWithDST2
Basically, these tests conflict with the above fix. i.e. if we fix above these
will break and if we fix these then above will break on each Daylight saving
time.
For {{testActionMaterWithDST1}}, start time is in Standard Time
{{2013-03-10T08:00Z}} and end time is in Daylight savings time
{{2013-03-10T12:00Z}}. For an hourly cron freqency job, we expect it to
materialize 4 actions. But, after considering time adjustments (i.e. subtracing
DST_OFFSET from end), its only 3 actions.
For {{testActionMaterWithDST2}}, it the reverse, instead of 4, there will be 5
actions to materialize.
was (Author: satishsaley):
Let me get some numbers, I will update explanation on the patch.
> Flaky test due to daylight saving changes
> -----------------------------------------
>
> Key: OOZIE-2726
> URL: https://issues.apache.org/jira/browse/OOZIE-2726
> Project: Oozie
> Issue Type: Bug
> Reporter: Satish Subhashrao Saley
> Assignee: Satish Subhashrao Saley
> Priority: Blocker
> Fix For: 4.3.0
>
> Attachments: OOZIE-2726-1.patch, OOZIE-2726-2.patch
>
>
> org.apache.oozie.command.coord.TestCoordMaterializeTransitionXCommand.testMaterizationLookup
> {code}
> Error Message
> expected:<Mon Nov 07 19:51:14 UTC 2016> but was:<Sun Nov 06 21:51:14 UTC 2016>
> Stacktrace
> junit.framework.AssertionFailedError: expected:<Mon Nov 07 19:51:14 UTC 2016>
> but was:<Sun Nov 06 21:51:14 UTC 2016>
> at junit.framework.Assert.fail(Assert.java:50)
> at junit.framework.Assert.failNotEquals(Assert.java:287)
> at junit.framework.Assert.assertEquals(Assert.java:67)
> at junit.framework.Assert.assertEquals(Assert.java:74)
> at
> org.apache.oozie.command.coord.TestCoordMaterializeTransitionXCommand.testMaterizationLookup(TestCoordMaterializeTransitionXCommand.java:582)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:483)
> at junit.framework.TestCase.runTest(TestCase.java:168)
> at junit.framework.TestCase.runBare(TestCase.java:134)
> at junit.framework.TestResult$1.protect(TestResult.java:110)
> at junit.framework.TestResult.runProtected(TestResult.java:128)
> at junit.framework.TestResult.run(TestResult.java:113)
> at junit.framework.TestCase.run(TestCase.java:124)
> at junit.framework.TestSuite.runTest(TestSuite.java:243)
> at junit.framework.TestSuite.run(TestSuite.java:238)
> at
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
> at org.junit.runners.Suite.runChild(Suite.java:128)
> at org.junit.runners.Suite.runChild(Suite.java:24)
> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
> at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> at java.lang.Thread.run(Thread.java:745)
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)