diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index a6600df02b7..e93fb7464e3 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -430,6 +430,16 @@ avatica-core test + + org.hamcrest + hamcrest-all + test + + + org.hamcrest + hamcrest-core + test + org.testng testng diff --git a/integration-tests/src/test/java/org/apache/druid/tests/coordinator/duty/ITAutoCompactionTest.java b/integration-tests/src/test/java/org/apache/druid/tests/coordinator/duty/ITAutoCompactionTest.java index 8f070f33405..24ede82d0de 100644 --- a/integration-tests/src/test/java/org/apache/druid/tests/coordinator/duty/ITAutoCompactionTest.java +++ b/integration-tests/src/test/java/org/apache/druid/tests/coordinator/duty/ITAutoCompactionTest.java @@ -70,6 +70,9 @@ import org.apache.druid.tests.TestNGGroup; import org.apache.druid.tests.indexer.AbstractITBatchIndexTest; import org.apache.druid.tests.indexer.AbstractIndexerTest; import org.apache.druid.timeline.DataSegment; +import org.hamcrest.Matcher; +import org.hamcrest.MatcherAssert; +import org.hamcrest.Matchers; import org.joda.time.DateTimeZone; import org.joda.time.Interval; import org.joda.time.Period; @@ -532,9 +535,9 @@ public class ITAutoCompactionTest extends AbstractIndexerTest getAndAssertCompactionStatus( fullDatasourceName, AutoCompactionSnapshot.AutoCompactionScheduleStatus.RUNNING, - 0, - 14166, - 14165, + Matchers.equalTo(0L), + Matchers.greaterThan(0L), + Matchers.greaterThan(0L), 0, 2, 2, @@ -550,9 +553,9 @@ public class ITAutoCompactionTest extends AbstractIndexerTest getAndAssertCompactionStatus( fullDatasourceName, AutoCompactionSnapshot.AutoCompactionScheduleStatus.RUNNING, - 0, - 22262, - 0, + Matchers.equalTo(0L), + Matchers.greaterThan(0L), + Matchers.equalTo(0L), 0, 3, 0, @@ -670,16 +673,19 @@ public class ITAutoCompactionTest extends AbstractIndexerTest getAndAssertCompactionStatus( fullDatasourceName, AutoCompactionSnapshot.AutoCompactionScheduleStatus.RUNNING, - 14166, - 14165, - 0, + Matchers.greaterThan(0L), + Matchers.greaterThan(0L), + Matchers.equalTo(0L), 2, 2, 0, 1, 1, 0); - Assert.assertEquals(compactionResource.getCompactionProgress(fullDatasourceName).get("remainingSegmentSize"), "14166"); + MatcherAssert.assertThat( + Long.parseLong(compactionResource.getCompactionProgress(fullDatasourceName).get("remainingSegmentSize")), + Matchers.greaterThan(0L) + ); // Run compaction again to compact the remaining day // Remaining day compacted (1 new segment). Now both days compacted (2 total) forceTriggerAutoCompaction(2); @@ -689,9 +695,9 @@ public class ITAutoCompactionTest extends AbstractIndexerTest getAndAssertCompactionStatus( fullDatasourceName, AutoCompactionSnapshot.AutoCompactionScheduleStatus.RUNNING, - 0, - 22262, - 0, + Matchers.equalTo(0L), + Matchers.greaterThan(0L), + Matchers.equalTo(0L), 0, 3, 0, @@ -1952,9 +1958,9 @@ public class ITAutoCompactionTest extends AbstractIndexerTest private void getAndAssertCompactionStatus( String fullDatasourceName, AutoCompactionSnapshot.AutoCompactionScheduleStatus scheduleStatus, - long bytesAwaitingCompaction, - long bytesCompacted, - long bytesSkipped, + Matcher bytesAwaitingCompactionMatcher, + Matcher bytesCompactedMatcher, + Matcher bytesSkippedMatcher, long segmentCountAwaitingCompaction, long segmentCountCompacted, long segmentCountSkipped, @@ -1966,9 +1972,9 @@ public class ITAutoCompactionTest extends AbstractIndexerTest Map actualStatus = compactionResource.getCompactionStatus(fullDatasourceName); Assert.assertNotNull(actualStatus); Assert.assertEquals(actualStatus.get("scheduleStatus"), scheduleStatus.toString()); - Assert.assertEquals(Long.parseLong(actualStatus.get("bytesAwaitingCompaction")), bytesAwaitingCompaction); - Assert.assertEquals(Long.parseLong(actualStatus.get("bytesCompacted")), bytesCompacted); - Assert.assertEquals(Long.parseLong(actualStatus.get("bytesSkipped")), bytesSkipped); + MatcherAssert.assertThat(Long.parseLong(actualStatus.get("bytesAwaitingCompaction")), bytesAwaitingCompactionMatcher); + MatcherAssert.assertThat(Long.parseLong(actualStatus.get("bytesCompacted")), bytesCompactedMatcher); + MatcherAssert.assertThat(Long.parseLong(actualStatus.get("bytesSkipped")), bytesSkippedMatcher); Assert.assertEquals(Long.parseLong(actualStatus.get("segmentCountAwaitingCompaction")), segmentCountAwaitingCompaction); Assert.assertEquals(Long.parseLong(actualStatus.get("segmentCountCompacted")), segmentCountCompacted); Assert.assertEquals(Long.parseLong(actualStatus.get("segmentCountSkipped")), segmentCountSkipped);