diff --git a/beekeeper-path-cleanup/src/test/java/com/expediagroup/beekeeper/path/cleanup/service/PagingCleanupServiceTest.java b/beekeeper-path-cleanup/src/test/java/com/expediagroup/beekeeper/path/cleanup/service/PagingCleanupServiceTest.java index db654ed4..00279f22 100644 --- a/beekeeper-path-cleanup/src/test/java/com/expediagroup/beekeeper/path/cleanup/service/PagingCleanupServiceTest.java +++ b/beekeeper-path-cleanup/src/test/java/com/expediagroup/beekeeper/path/cleanup/service/PagingCleanupServiceTest.java @@ -50,6 +50,7 @@ import com.google.common.collect.Lists; import com.expediagroup.beekeeper.cleanup.path.PathCleaner; +import com.expediagroup.beekeeper.core.checker.IcebergTableChecker; import com.expediagroup.beekeeper.core.model.HousekeepingPath; import com.expediagroup.beekeeper.core.model.HousekeepingStatus; import com.expediagroup.beekeeper.core.model.PeriodDuration; @@ -74,9 +75,10 @@ public class PagingCleanupServiceTest { private @Autowired HousekeepingPathRepository housekeepingPathRepository; private @MockBean PathCleaner pathCleaner; + private @MockBean IcebergTableChecker icebergTableChecker; @Test public void typicalWithPaging() { - UnreferencedPathHandler handler = new UnreferencedPathHandler(housekeepingPathRepository, pathCleaner); + UnreferencedPathHandler handler = new UnreferencedPathHandler(housekeepingPathRepository, pathCleaner, icebergTableChecker); pagingCleanupService = new PagingPathCleanupService(List.of(handler), 2, false); List paths = List.of("s3://bucket/some_foo", "s3://bucket/some_bar", "s3://bucket/some_foobar"); @@ -97,7 +99,7 @@ public void typicalWithPaging() { @Test public void mixOfScheduledAndFailedPaths() { - UnreferencedPathHandler handler = new UnreferencedPathHandler(housekeepingPathRepository, pathCleaner); + UnreferencedPathHandler handler = new UnreferencedPathHandler(housekeepingPathRepository, pathCleaner, icebergTableChecker); pagingCleanupService = new PagingPathCleanupService(List.of(handler), 2, false); List paths = List .of(createEntityHousekeepingPath("s3://bucket/some_foo", SCHEDULED), @@ -113,7 +115,7 @@ public void mixOfScheduledAndFailedPaths() { @Test public void mixOfAllPaths() { - UnreferencedPathHandler handler = new UnreferencedPathHandler(housekeepingPathRepository, pathCleaner); + UnreferencedPathHandler handler = new UnreferencedPathHandler(housekeepingPathRepository, pathCleaner, icebergTableChecker); pagingCleanupService = new PagingPathCleanupService(List.of(handler), 2, false); List paths = List .of(createEntityHousekeepingPath("s3://bucket/some_foo", SCHEDULED), @@ -130,7 +132,7 @@ public void mixOfAllPaths() { @Test void pathCleanerException() { - UnreferencedPathHandler handler = new UnreferencedPathHandler(housekeepingPathRepository, pathCleaner); + UnreferencedPathHandler handler = new UnreferencedPathHandler(housekeepingPathRepository, pathCleaner, icebergTableChecker); pagingCleanupService = new PagingPathCleanupService(List.of(handler), 2, false); doThrow(new RuntimeException("Error")).doNothing().when(pathCleaner).cleanupPath(any(HousekeepingPath.class)); @@ -158,7 +160,7 @@ void pathCleanerException() { @Test @Timeout(value = 10) void doNotInfiniteLoopOnRepeatedFailures() { - UnreferencedPathHandler handler = new UnreferencedPathHandler(housekeepingPathRepository, pathCleaner); + UnreferencedPathHandler handler = new UnreferencedPathHandler(housekeepingPathRepository, pathCleaner, icebergTableChecker); pagingCleanupService = new PagingPathCleanupService(List.of(handler), 1, false); List paths = List .of(createEntityHousekeepingPath("s3://bucket/some_foo", FAILED), @@ -186,7 +188,7 @@ void doNotInfiniteLoopOnRepeatedFailures() { @Test @Timeout(value = 10) void doNotInfiniteLoopOnDryRunCleanup() { - UnreferencedPathHandler handler = new UnreferencedPathHandler(housekeepingPathRepository, pathCleaner); + UnreferencedPathHandler handler = new UnreferencedPathHandler(housekeepingPathRepository, pathCleaner, icebergTableChecker); pagingCleanupService = new PagingPathCleanupService(List.of(handler), 1, true); List paths = List .of(createEntityHousekeepingPath("s3://bucket/some_foo", SCHEDULED), @@ -211,7 +213,6 @@ private HousekeepingPath createEntityHousekeepingPath(String path, HousekeepingS .housekeepingStatus(housekeepingStatus) .creationTimestamp(localNow) .modifiedTimestamp(localNow) - .modifiedTimestamp(localNow) .cleanupDelay(PeriodDuration.of(Duration.parse("P3D"))) .cleanupAttempts(0) .lifecycleType(UNREFERENCED.toString())