HADOOP-13243. TestRollingFileSystemSink.testSetInitialFlushTime() fails intermittently. (Daniel Templeton via kasha)

(cherry picked from commit 49b4064644)
This commit is contained in:
Karthik Kambatla 2016-06-12 14:12:31 -07:00
parent a92be02c2e
commit 63da641910
1 changed files with 3 additions and 5 deletions

View File

@ -118,15 +118,14 @@ public class TestRollingFileSystemSink {
diff = rfsSink.nextFlush.getTimeInMillis() - calendar.getTimeInMillis(); diff = rfsSink.nextFlush.getTimeInMillis() - calendar.getTimeInMillis();
assertTrue("The initial flush time was calculated incorrectly: " + diff, assertTrue("The initial flush time was calculated incorrectly: " + diff,
(diff >= -1000L) && (diff < -900L)); (diff == 0L) || ((diff > -1000L) && (diff < -900L)));
calendar.set(Calendar.MILLISECOND, 10); calendar.set(Calendar.MILLISECOND, 10);
rfsSink.setInitialFlushTime(calendar.getTime()); rfsSink.setInitialFlushTime(calendar.getTime());
diff = rfsSink.nextFlush.getTimeInMillis() - calendar.getTimeInMillis(); diff = rfsSink.nextFlush.getTimeInMillis() - calendar.getTimeInMillis();
assertTrue("The initial flush time was calculated incorrectly: " + diff, assertTrue("The initial flush time was calculated incorrectly: " + diff,
((diff >= -10L) && (diff <= 0L) || (diff >= -10L) && (diff <= 0L) || ((diff > -1000L) && (diff < -910L)));
((diff > -1000L) && (diff < -910L))));
calendar.set(Calendar.SECOND, 1); calendar.set(Calendar.SECOND, 1);
calendar.set(Calendar.MILLISECOND, 10); calendar.set(Calendar.MILLISECOND, 10);
@ -134,8 +133,7 @@ public class TestRollingFileSystemSink {
diff = rfsSink.nextFlush.getTimeInMillis() - calendar.getTimeInMillis(); diff = rfsSink.nextFlush.getTimeInMillis() - calendar.getTimeInMillis();
assertTrue("The initial flush time was calculated incorrectly: " + diff, assertTrue("The initial flush time was calculated incorrectly: " + diff,
((diff >= -10L) && (diff <= 0L) || (diff >= -10L) && (diff <= 0L) || ((diff > -1000L) && (diff < -910L)));
((diff > -1000L) && (diff < -910L))));
// Now try pathological settings // Now try pathological settings
rfsSink = new RollingFileSystemSink(1000, 1000000); rfsSink = new RollingFileSystemSink(1000, 1000000);