[ML] fix test mix up of millisecond with second (elastic/x-pack-elasticsearch#816)

Fix spurious Test failure

fix test resolution bug: mix up of millisecond with second

Original commit: elastic/x-pack-elasticsearch@37b8fed559
This commit is contained in:
Hendrik Muhs 2017-03-24 08:11:38 +01:00 committed by GitHub
parent 061e3fc1fe
commit f687f3ea6e
1 changed files with 3 additions and 1 deletions

View File

@ -22,6 +22,7 @@ import org.mockito.Mockito;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
@ -300,7 +301,8 @@ public class DataCountsReporterTests extends ESTestCase {
long lastReportedTimeMs = dataCountsReporter.incrementalStats().getLastDataTimeStamp().getTime();
// check last data time is equal to now give or take a second
assertTrue(lastReportedTimeMs >= now.getTime() && lastReportedTimeMs <= now.getTime() +1);
assertTrue(lastReportedTimeMs >= now.getTime()
&& lastReportedTimeMs <= now.getTime() + TimeUnit.SECONDS.toMillis(1));
assertEquals(dataCountsReporter.incrementalStats().getLastDataTimeStamp(),
dataCountsReporter.runningTotalStats().getLastDataTimeStamp());