Skip to content

Commit

Permalink
Add integration test for scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
Hamza Jugon committed Nov 27, 2024
1 parent 9a93bd7 commit db1352a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,16 +214,12 @@ public void expiredMetadataMultipleAlterPartitionTableEvents() throws SQLExcepti
}

@Test
public void expiredMetadataAlterIcebergTableEventShouldBeIgnored()
throws SQLException, IOException, URISyntaxException {
insertExpiredMetadata(LOCATION_A + "-old", null);

AlterTableSqsMessage alterTableSqsMessage = new AlterTableSqsMessage(LOCATION_A, true, true);
amazonSQS.sendMessage(sendMessageRequest(alterTableSqsMessage.getFormattedString()));
public void expiredMetadataCreateIcebergTableEvent() throws SQLException, IOException, URISyntaxException {
CreateTableSqsMessage createTableSqsMessage = new CreateTableSqsMessage(LOCATION_A, true, true);
amazonSQS.sendMessage(sendMessageRequest(createTableSqsMessage.getFormattedString()));

await().atMost(TIMEOUT, TimeUnit.SECONDS).until(() -> getUpdatedExpiredMetadataRowCount() == 1);
await().atMost(TIMEOUT, TimeUnit.SECONDS).until(() -> getExpiredMetadataRowCount() == 0);

// iceberg table event should be ignored
List<HousekeepingMetadata> expiredMetadata = getExpiredMetadata();
assertThat(expiredMetadata.size()).isEqualTo(0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,6 @@ public AlterTableSqsMessage(
setExpired(isExpired);
}

public AlterTableSqsMessage(
String tableLocation,
boolean isExpired,
boolean isIceberg
) throws IOException, URISyntaxException {
super(ALTER_TABLE);
setTableLocation(tableLocation);
setOldTableLocation(DUMMY_LOCATION);
setOldTableName(TABLE_NAME_VALUE);
setExpired(isExpired);
if (isIceberg) {
setIceberg();
}
}

public void setOldTableLocation(String oldTableLocation) {
apiaryEventMessageJsonObject.add(EVENT_TABLE_OLD_LOCATION_KEY, new JsonPrimitive(oldTableLocation));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,17 @@ public CreateTableSqsMessage(
setTableLocation(tableLocation);
setExpired(isExpired);
}

public CreateTableSqsMessage(
String tableLocation,
boolean isIceberg,
boolean isExpired
) throws IOException, URISyntaxException {
super(CREATE_TABLE);
setTableLocation(tableLocation);
setExpired(isExpired);
if (isIceberg) {
setIceberg();
}
}
}

0 comments on commit db1352a

Please sign in to comment.