Skip to content

Commit

Permalink
Core: Add more options in CatalogTests (apache#4906)
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanck authored May 30, 2022
1 parent 5955dff commit a8b494f
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions core/src/test/java/org/apache/iceberg/catalog/CatalogTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,14 @@ protected boolean supportsServerSideRetry() {
return false;
}

protected boolean overridesRequestedLocation() {
return false;
}

protected boolean supportsNamesWithSlashes() {
return true;
}

@Test
public void testCreateNamespace() {
C catalog = catalog();
Expand Down Expand Up @@ -428,6 +436,8 @@ public void testListNestedNamespaces() {

@Test
public void testNamespaceWithSlash() {
Assume.assumeTrue(supportsNamesWithSlashes());

C catalog = catalog();

Namespace withSlash = Namespace.of("new/db");
Expand Down Expand Up @@ -485,6 +495,8 @@ public void testBasicCreateTable() {

@Test
public void testTableNameWithSlash() {
Assume.assumeTrue(supportsNamesWithSlashes());

C catalog = catalog();

TableIdentifier ident = TableIdentifier.of("ns", "tab/le");
Expand Down Expand Up @@ -1181,7 +1193,9 @@ public void testCompleteCreateTransaction() {
Assert.assertEquals("Table properties should be a superset of the requested properties",
properties.entrySet(),
Sets.intersection(properties.entrySet(), table.properties().entrySet()));
Assert.assertEquals("Table location should match requested", "file:/tmp/ns/table", table.location());
if (!overridesRequestedLocation()) {
Assert.assertEquals("Table location should match requested", "file:/tmp/ns/table", table.location());
}
assertFiles(table, FILE_A);
assertPreviousMetadataFileCount(table, 0);
}
Expand Down Expand Up @@ -1269,7 +1283,9 @@ public void testCompleteCreateOrReplaceTransactionCreate() {
Assert.assertEquals("Table properties should be a superset of the requested properties",
properties.entrySet(),
Sets.intersection(properties.entrySet(), table.properties().entrySet()));
Assert.assertEquals("Table location should match requested", "file:/tmp/ns/table", table.location());
if (!overridesRequestedLocation()) {
Assert.assertEquals("Table location should match requested", "file:/tmp/ns/table", table.location());
}
assertFiles(table, FILE_A);
assertPreviousMetadataFileCount(table, 0);
}
Expand Down Expand Up @@ -1361,7 +1377,9 @@ public void testCompleteCreateOrReplaceTransactionReplace() {
Assert.assertEquals("Table properties should be a superset of the requested properties",
properties.entrySet(),
Sets.intersection(properties.entrySet(), loaded.properties().entrySet()));
Assert.assertEquals("Table location should be replaced", "file:/tmp/ns/table", table.location());
if (!overridesRequestedLocation()) {
Assert.assertEquals("Table location should be replaced", "file:/tmp/ns/table", table.location());
}
assertUUIDsMatch(original, loaded);
assertFiles(loaded, FILE_A);
assertPreviousMetadataFileCount(loaded, 1);
Expand Down Expand Up @@ -1484,7 +1502,9 @@ public void testCompleteReplaceTransaction() {
Assert.assertEquals("Table properties should be a superset of the requested properties",
properties.entrySet(),
Sets.intersection(properties.entrySet(), loaded.properties().entrySet()));
Assert.assertEquals("Table location should be replaced", "file:/tmp/ns/table", table.location());
if (!overridesRequestedLocation()) {
Assert.assertEquals("Table location should be replaced", "file:/tmp/ns/table", table.location());
}
assertUUIDsMatch(original, loaded);
assertFiles(loaded, FILE_A);
assertPreviousMetadataFileCount(loaded, 1);
Expand Down

0 comments on commit a8b494f

Please sign in to comment.