Skip to content

Commit

Permalink
Convert testRollbackToSnapshotWithNullArgument to integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
ebyhr committed Dec 28, 2024
1 parent 5706953 commit 0c3330a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1709,6 +1709,14 @@ public void testRollbackSnapshot()
assertUpdate("DROP TABLE test_rollback");
}

@Test
void testRollbackToSnapshotWithNullArgument()
{
assertQueryFails("CALL system.rollback_to_snapshot(NULL, 'customer_orders', 8954597067493422955)", ".*schema cannot be null.*");
assertQueryFails("CALL system.rollback_to_snapshot('testdb', NULL, 8954597067493422955)", ".*table cannot be null.*");
assertQueryFails("CALL system.rollback_to_snapshot('testdb', 'customer_orders', NULL)", ".*snapshot_id cannot be null.*");
}

@Override
protected String errorMessageForInsertIntoNotNullColumn(String columnName)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,18 +366,6 @@ public void testRollbackToSnapshot()
onTrino().executeQuery(format("DROP TABLE IF EXISTS %s", tableName));
}

@Test(groups = {ICEBERG, PROFILE_SPECIFIC_TESTS})
public void testRollbackToSnapshotWithNullArgument()
{
onTrino().executeQuery("USE iceberg.default");
assertQueryFailure(() -> onTrino().executeQuery("CALL system.rollback_to_snapshot(NULL, 'customer_orders', 8954597067493422955)"))
.hasMessageMatching(".*schema cannot be null.*");
assertQueryFailure(() -> onTrino().executeQuery("CALL system.rollback_to_snapshot('testdb', NULL, 8954597067493422955)"))
.hasMessageMatching(".*table cannot be null.*");
assertQueryFailure(() -> onTrino().executeQuery("CALL system.rollback_to_snapshot('testdb', 'customer_orders', NULL)"))
.hasMessageMatching(".*snapshot_id cannot be null.*");
}

private long getSecondOldestTableSnapshot(String tableName)
{
return (Long) onTrino().executeQuery(
Expand Down

0 comments on commit 0c3330a

Please sign in to comment.