diff --git a/beekeeper-cleanup/src/test/java/com/expediagroup/beekeeper/cleanup/aws/S3DryRunPathCleanerTest.java b/beekeeper-cleanup/src/test/java/com/expediagroup/beekeeper/cleanup/aws/S3DryRunPathCleanerTest.java index 583e0018..2ce72451 100644 --- a/beekeeper-cleanup/src/test/java/com/expediagroup/beekeeper/cleanup/aws/S3DryRunPathCleanerTest.java +++ b/beekeeper-cleanup/src/test/java/com/expediagroup/beekeeper/cleanup/aws/S3DryRunPathCleanerTest.java @@ -58,7 +58,7 @@ class S3DryRunPathCleanerTest { private HousekeepingPath housekeepingPath; private AmazonS3 amazonS3; - private @Mock BytesDeletedReporter bytesDeletedReporter; + @Mock private BytesDeletedReporter bytesDeletedReporter; @Mock private IcebergValidator icebergValidator; private boolean dryRunEnabled = true; diff --git a/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/BeekeeperPathCleanupIntegrationTest.java b/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/BeekeeperPathCleanupIntegrationTest.java index e370906c..dd1be3b7 100644 --- a/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/BeekeeperPathCleanupIntegrationTest.java +++ b/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/BeekeeperPathCleanupIntegrationTest.java @@ -302,24 +302,23 @@ public void cleanupSentinelForNonEmptyParent() throws SQLException, TException { @Test public void shouldSkipCleanupForIcebergTable() throws Exception { - // add iceberg table props Map tableProperties = new HashMap<>(); tableProperties.put("table_type", "ICEBERG"); tableProperties.put("format", "ICEBERG/PARQUET"); String outputFormat = "org.apache.iceberg.mr.hive.HiveIcebergOutputFormat"; - // create iceberg table + hiveTestUtils.createTableWithProperties( TABLE_PATH, TABLE_NAME_VALUE, false, tableProperties, outputFormat, true); - // add data + String objectKey = DATABASE_NAME_VALUE + "/" + TABLE_NAME_VALUE + "/file1"; - amazonS3.putObject(BUCKET, objectKey, CONTENT); - // insert housekeepingPath record String path = "s3://" + BUCKET + "/" + DATABASE_NAME_VALUE + "/" + TABLE_NAME_VALUE + "/"; - insertUnreferencedPath(path); // Uses default database and table names - // wait for the cleanup process to run and update to skipped + + amazonS3.putObject(BUCKET, objectKey, CONTENT); + insertUnreferencedPath(path); + await().atMost(TIMEOUT, TimeUnit.SECONDS) .until(() -> getUnreferencedPaths().get(0).getHousekeepingStatus() == SKIPPED); - // verify that the data in S3 is still present + assertThat(amazonS3.doesObjectExist(BUCKET, objectKey)) .withFailMessage("S3 object %s should still exist as cleanup was skipped.", objectKey) .isTrue(); diff --git a/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/utils/HiveTestUtils.java b/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/utils/HiveTestUtils.java index 8dd53b15..222fafdd 100644 --- a/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/utils/HiveTestUtils.java +++ b/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/utils/HiveTestUtils.java @@ -121,7 +121,6 @@ public Table createTableWithProperties(String path, String tableName, boolean pa hiveTable.setTableType(TableType.EXTERNAL_TABLE.name()); hiveTable.putToParameters("EXTERNAL", "TRUE"); - // Add custom table props if (tableProperties != null) { hiveTable.getParameters().putAll(tableProperties); } @@ -135,7 +134,7 @@ public Table createTableWithProperties(String path, String tableName, boolean pa sd.setCols(DATA_COLUMNS); sd.setLocation(path); sd.setParameters(new HashMap<>()); - // Set the output format for the storage descriptor, defaulting to TextOutputFormat if not specified + if (outputFormat != null) { sd.setOutputFormat(outputFormat); } else {