From 49b4064644b242921af4ddf1de9932bc7bcf5f0e Mon Sep 17 00:00:00 2001 From: Karthik Kambatla Date: Sun, 12 Jun 2016 14:12:31 -0700 Subject: [PATCH] HADOOP-13243. TestRollingFileSystemSink.testSetInitialFlushTime() fails intermittently. (Daniel Templeton via kasha) --- .../hadoop/metrics2/sink/TestRollingFileSystemSink.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/sink/TestRollingFileSystemSink.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/sink/TestRollingFileSystemSink.java index 9c34dbad2f..127305257a 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/sink/TestRollingFileSystemSink.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/sink/TestRollingFileSystemSink.java @@ -118,15 +118,14 @@ public void testSetInitialFlushTime() { diff = rfsSink.nextFlush.getTimeInMillis() - calendar.getTimeInMillis(); assertTrue("The initial flush time was calculated incorrectly: " + diff, - (diff >= -1000L) && (diff < -900L)); + (diff == 0L) || ((diff > -1000L) && (diff < -900L))); calendar.set(Calendar.MILLISECOND, 10); rfsSink.setInitialFlushTime(calendar.getTime()); diff = rfsSink.nextFlush.getTimeInMillis() - calendar.getTimeInMillis(); assertTrue("The initial flush time was calculated incorrectly: " + diff, - ((diff >= -10L) && (diff <= 0L) || - ((diff > -1000L) && (diff < -910L)))); + (diff >= -10L) && (diff <= 0L) || ((diff > -1000L) && (diff < -910L))); calendar.set(Calendar.SECOND, 1); calendar.set(Calendar.MILLISECOND, 10); @@ -134,8 +133,7 @@ public void testSetInitialFlushTime() { diff = rfsSink.nextFlush.getTimeInMillis() - calendar.getTimeInMillis(); assertTrue("The initial flush time was calculated incorrectly: " + diff, - ((diff >= -10L) && (diff <= 0L) || - ((diff > -1000L) && (diff < -910L)))); + (diff >= -10L) && (diff <= 0L) || ((diff > -1000L) && (diff < -910L))); // Now try pathological settings rfsSink = new RollingFileSystemSink(1000, 1000000);