Skip to content

Commit 4a1b5c5

Browse files
committed
Core: Remove requiresNamespaceCreate check from TestRESTCatalog
1 parent 80e59d1 commit 4a1b5c5

File tree

1 file changed

+18
-54
lines changed

1 file changed

+18
-54
lines changed

core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java

Lines changed: 18 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -903,9 +903,7 @@ public void testTableSnapshotLoading() {
903903
RESTCatalogProperties.SNAPSHOT_LOADING_MODE,
904904
SnapshotMode.REFS.name()));
905905

906-
if (requiresNamespaceCreate()) {
907-
catalog.createNamespace(TABLE.namespace());
908-
}
906+
catalog.createNamespace(TABLE.namespace());
909907

910908
// Create a table with multiple snapshots
911909
Table table = catalog.createTable(TABLE, SCHEMA);
@@ -977,9 +975,7 @@ public void testTableSnapshotLoadingWithDivergedBranches(String formatVersion) {
977975
RESTCatalogProperties.SNAPSHOT_LOADING_MODE,
978976
SnapshotMode.REFS.name()));
979977

980-
if (requiresNamespaceCreate()) {
981-
catalog.createNamespace(TABLE.namespace());
982-
}
978+
catalog.createNamespace(TABLE.namespace());
983979

984980
Table table =
985981
catalog.createTable(
@@ -1087,9 +1083,7 @@ public void lazySnapshotLoadingWithDivergedHistory() {
10871083
RESTCatalogProperties.SNAPSHOT_LOADING_MODE,
10881084
SnapshotMode.REFS.name()));
10891085

1090-
if (requiresNamespaceCreate()) {
1091-
catalog.createNamespace(TABLE.namespace());
1092-
}
1086+
catalog.createNamespace(TABLE.namespace());
10931087

10941088
Table table =
10951089
catalog.createTable(TABLE, SCHEMA, PartitionSpec.unpartitioned(), ImmutableMap.of());
@@ -1182,9 +1176,7 @@ public void testTableAuth(
11821176
required(1, "id", Types.IntegerType.get(), "unique ID"),
11831177
required(2, "data", Types.StringType.get()));
11841178

1185-
if (requiresNamespaceCreate()) {
1186-
catalog.createNamespace(TBL.namespace());
1187-
}
1179+
catalog.createNamespace(TBL.namespace());
11881180

11891181
Table table = catalog.createTable(TBL, expectedSchema);
11901182
assertThat(table.schema().asStruct())
@@ -2094,9 +2086,7 @@ public void diffAgainstSingleTable() {
20942086
Namespace namespace = Namespace.of("namespace");
20952087
TableIdentifier identifier = TableIdentifier.of(namespace, "multipleDiffsAgainstSingleTable");
20962088

2097-
if (requiresNamespaceCreate()) {
2098-
catalog().createNamespace(namespace);
2099-
}
2089+
catalog().createNamespace(namespace);
21002090

21012091
Table table = catalog().buildTable(identifier, SCHEMA).create();
21022092
Transaction transaction = table.newTransaction();
@@ -2130,9 +2120,7 @@ public void multipleDiffsAgainstMultipleTables() {
21302120
TableIdentifier identifier1 = TableIdentifier.of(namespace, "multiDiffTable1");
21312121
TableIdentifier identifier2 = TableIdentifier.of(namespace, "multiDiffTable2");
21322122

2133-
if (requiresNamespaceCreate()) {
2134-
catalog().createNamespace(namespace);
2135-
}
2123+
catalog().createNamespace(namespace);
21362124

21372125
Table table1 = catalog().buildTable(identifier1, SCHEMA).create();
21382126
Table table2 = catalog().buildTable(identifier2, SCHEMA).create();
@@ -2176,9 +2164,7 @@ public void multipleDiffsAgainstMultipleTablesLastFails() {
21762164
TableIdentifier identifier1 = TableIdentifier.of(namespace, "multiDiffTable1");
21772165
TableIdentifier identifier2 = TableIdentifier.of(namespace, "multiDiffTable2");
21782166

2179-
if (requiresNamespaceCreate()) {
2180-
catalog().createNamespace(namespace);
2181-
}
2167+
catalog().createNamespace(namespace);
21822168

21832169
catalog().createTable(identifier1, SCHEMA);
21842170
catalog().createTable(identifier2, SCHEMA);
@@ -2364,9 +2350,7 @@ public void testCleanupUncommitedFilesForCleanableFailures() {
23642350
RESTCatalogAdapter adapter = Mockito.spy(new RESTCatalogAdapter(backendCatalog));
23652351
RESTCatalog catalog = catalog(adapter);
23662352

2367-
if (requiresNamespaceCreate()) {
2368-
catalog.createNamespace(TABLE.namespace());
2369-
}
2353+
catalog.createNamespace(TABLE.namespace());
23702354

23712355
catalog.createTable(TABLE, SCHEMA);
23722356
DataFile file =
@@ -2407,9 +2391,7 @@ public void testNoCleanupForNonCleanableExceptions() {
24072391
RESTCatalogAdapter adapter = Mockito.spy(new RESTCatalogAdapter(backendCatalog));
24082392
RESTCatalog catalog = catalog(adapter);
24092393

2410-
if (requiresNamespaceCreate()) {
2411-
catalog.createNamespace(TABLE.namespace());
2412-
}
2394+
catalog.createNamespace(TABLE.namespace());
24132395

24142396
catalog.createTable(TABLE, SCHEMA);
24152397
Table table = catalog.loadTable(TABLE);
@@ -2442,9 +2424,7 @@ public void testCleanupCleanableExceptionsCreate() {
24422424
RESTCatalogAdapter adapter = Mockito.spy(new RESTCatalogAdapter(backendCatalog));
24432425
RESTCatalog catalog = catalog(adapter);
24442426

2445-
if (requiresNamespaceCreate()) {
2446-
catalog.createNamespace(TABLE.namespace());
2447-
}
2427+
catalog.createNamespace(TABLE.namespace());
24482428

24492429
catalog.createTable(TABLE, SCHEMA);
24502430
TableIdentifier newTable = TableIdentifier.of(TABLE.namespace(), "some_table");
@@ -2489,9 +2469,7 @@ public void testNoCleanupForNonCleanableCreateTransaction() {
24892469
RESTCatalogAdapter adapter = Mockito.spy(new RESTCatalogAdapter(backendCatalog));
24902470
RESTCatalog catalog = catalog(adapter);
24912471

2492-
if (requiresNamespaceCreate()) {
2493-
catalog.createNamespace(TABLE.namespace());
2494-
}
2472+
catalog.createNamespace(TABLE.namespace());
24952473

24962474
catalog.createTable(TABLE, SCHEMA);
24972475
TableIdentifier newTable = TableIdentifier.of(TABLE.namespace(), "some_table");
@@ -2531,9 +2509,7 @@ public void testCleanupCleanableExceptionsReplace() {
25312509
RESTCatalogAdapter adapter = Mockito.spy(new RESTCatalogAdapter(backendCatalog));
25322510
RESTCatalog catalog = catalog(adapter);
25332511

2534-
if (requiresNamespaceCreate()) {
2535-
catalog.createNamespace(TABLE.namespace());
2536-
}
2512+
catalog.createNamespace(TABLE.namespace());
25372513

25382514
catalog.createTable(TABLE, SCHEMA);
25392515
Mockito.doThrow(new NotAuthorizedException("not authorized"))
@@ -2574,9 +2550,7 @@ public void testNoCleanupForNonCleanableReplaceTransaction() {
25742550
RESTCatalogAdapter adapter = Mockito.spy(new RESTCatalogAdapter(backendCatalog));
25752551
RESTCatalog catalog = catalog(adapter);
25762552

2577-
if (requiresNamespaceCreate()) {
2578-
catalog.createNamespace(TABLE.namespace());
2579-
}
2553+
catalog.createNamespace(TABLE.namespace());
25802554

25812555
catalog.createTable(TABLE, SCHEMA);
25822556
Mockito.doThrow(new ServiceFailureException("some service failure"))
@@ -2777,9 +2751,7 @@ public void testETagWithCreateAndLoadTable() {
27772751

27782752
RESTCatalog catalog = catalogWithResponseHeaders(respHeaders);
27792753

2780-
if (requiresNamespaceCreate()) {
2781-
catalog.createNamespace(TABLE.namespace());
2782-
}
2754+
catalog.createNamespace(TABLE.namespace());
27832755

27842756
catalog.createTable(TABLE, SCHEMA);
27852757

@@ -2798,9 +2770,7 @@ public void testETagWithDifferentTables() {
27982770

27992771
RESTCatalog catalog = catalogWithResponseHeaders(respHeaders);
28002772

2801-
if (requiresNamespaceCreate()) {
2802-
catalog.createNamespace(TABLE.namespace());
2803-
}
2773+
catalog.createNamespace(TABLE.namespace());
28042774

28052775
catalog.createTable(TABLE, SCHEMA);
28062776

@@ -2820,9 +2790,7 @@ public void testETagAfterDataUpdate() {
28202790

28212791
RESTCatalog catalog = catalogWithResponseHeaders(respHeaders);
28222792

2823-
if (requiresNamespaceCreate()) {
2824-
catalog.createNamespace(TABLE.namespace());
2825-
}
2793+
catalog.createNamespace(TABLE.namespace());
28262794

28272795
Table tbl = catalog.createTable(TABLE, SCHEMA);
28282796

@@ -2843,9 +2811,7 @@ public void testETagAfterMetadataOnlyUpdate() {
28432811

28442812
RESTCatalog catalog = catalogWithResponseHeaders(respHeaders);
28452813

2846-
if (requiresNamespaceCreate()) {
2847-
catalog.createNamespace(TABLE.namespace());
2848-
}
2814+
catalog.createNamespace(TABLE.namespace());
28492815

28502816
Table tbl = catalog.createTable(TABLE, SCHEMA);
28512817

@@ -2866,9 +2832,7 @@ public void testETagWithRegisterTable() {
28662832

28672833
RESTCatalog catalog = catalogWithResponseHeaders(respHeaders);
28682834

2869-
if (requiresNamespaceCreate()) {
2870-
catalog.createNamespace(TABLE.namespace());
2871-
}
2835+
catalog.createNamespace(TABLE.namespace());
28722836

28732837
Table tbl = catalog.createTable(TABLE, SCHEMA);
28742838

0 commit comments

Comments
 (0)