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

This commit is contained in:
Karthik Kambatla 2016-06-12 14:12:31 -07:00
parent 7dae2b3bc4
commit 49b4064644

View File

@ -118,15 +118,14 @@ public void testSetInitialFlushTime() {
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 void testSetInitialFlushTime() {
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);