Skip to content

Commit a7b5bc2

Browse files
committed
Core: Remove requiresNamespaceCreate check from TestRESTCatalog
1 parent 1a1945b commit a7b5bc2

File tree

1 file changed

+20
-60
lines changed

1 file changed

+20
-60
lines changed

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

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

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

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

981-
if (requiresNamespaceCreate()) {
982-
catalog.createNamespace(TABLE.namespace());
983-
}
979+
catalog.createNamespace(TABLE.namespace());
984980

985981
Table table =
986982
catalog.createTable(
@@ -1088,9 +1084,7 @@ public void lazySnapshotLoadingWithDivergedHistory() {
10881084
RESTCatalogProperties.SNAPSHOT_LOADING_MODE,
10891085
SnapshotMode.REFS.name()));
10901086

1091-
if (requiresNamespaceCreate()) {
1092-
catalog.createNamespace(TABLE.namespace());
1093-
}
1087+
catalog.createNamespace(TABLE.namespace());
10941088

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

1186-
if (requiresNamespaceCreate()) {
1187-
catalog.createNamespace(TBL.namespace());
1188-
}
1180+
catalog.createNamespace(TBL.namespace());
11891181

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

2098-
if (requiresNamespaceCreate()) {
2099-
catalog().createNamespace(namespace);
2100-
}
2090+
catalog().createNamespace(namespace);
21012091

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

2134-
if (requiresNamespaceCreate()) {
2135-
catalog().createNamespace(namespace);
2136-
}
2124+
catalog().createNamespace(namespace);
21372125

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

2180-
if (requiresNamespaceCreate()) {
2181-
catalog().createNamespace(namespace);
2182-
}
2168+
catalog().createNamespace(namespace);
21832169

21842170
catalog().createTable(identifier1, SCHEMA);
21852171
catalog().createTable(identifier2, SCHEMA);
@@ -2365,9 +2351,7 @@ public void testCleanupUncommitedFilesForCleanableFailures() {
23652351
RESTCatalogAdapter adapter = Mockito.spy(new RESTCatalogAdapter(backendCatalog));
23662352
RESTCatalog catalog = catalog(adapter);
23672353

2368-
if (requiresNamespaceCreate()) {
2369-
catalog.createNamespace(TABLE.namespace());
2370-
}
2354+
catalog.createNamespace(TABLE.namespace());
23712355

23722356
catalog.createTable(TABLE, SCHEMA);
23732357
DataFile file =
@@ -2408,9 +2392,7 @@ public void testNoCleanupForNonCleanableExceptions() {
24082392
RESTCatalogAdapter adapter = Mockito.spy(new RESTCatalogAdapter(backendCatalog));
24092393
RESTCatalog catalog = catalog(adapter);
24102394

2411-
if (requiresNamespaceCreate()) {
2412-
catalog.createNamespace(TABLE.namespace());
2413-
}
2395+
catalog.createNamespace(TABLE.namespace());
24142396

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

2446-
if (requiresNamespaceCreate()) {
2447-
catalog.createNamespace(TABLE.namespace());
2448-
}
2428+
catalog.createNamespace(TABLE.namespace());
24492429

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

2493-
if (requiresNamespaceCreate()) {
2494-
catalog.createNamespace(TABLE.namespace());
2495-
}
2473+
catalog.createNamespace(TABLE.namespace());
24962474

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

2535-
if (requiresNamespaceCreate()) {
2536-
catalog.createNamespace(TABLE.namespace());
2537-
}
2513+
catalog.createNamespace(TABLE.namespace());
25382514

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

2578-
if (requiresNamespaceCreate()) {
2579-
catalog.createNamespace(TABLE.namespace());
2580-
}
2554+
catalog.createNamespace(TABLE.namespace());
25812555

25822556
catalog.createTable(TABLE, SCHEMA);
25832557
Mockito.doThrow(new ServiceFailureException("some service failure"))
@@ -2778,9 +2752,7 @@ public void testETagWithCreateAndLoadTable() {
27782752

27792753
RESTCatalog catalog = catalogWithResponseHeaders(respHeaders);
27802754

2781-
if (requiresNamespaceCreate()) {
2782-
catalog.createNamespace(TABLE.namespace());
2783-
}
2755+
catalog.createNamespace(TABLE.namespace());
27842756

27852757
catalog.createTable(TABLE, SCHEMA);
27862758

@@ -2799,9 +2771,7 @@ public void testETagWithDifferentTables() {
27992771

28002772
RESTCatalog catalog = catalogWithResponseHeaders(respHeaders);
28012773

2802-
if (requiresNamespaceCreate()) {
2803-
catalog.createNamespace(TABLE.namespace());
2804-
}
2774+
catalog.createNamespace(TABLE.namespace());
28052775

28062776
catalog.createTable(TABLE, SCHEMA);
28072777

@@ -2821,9 +2791,7 @@ public void testETagAfterDataUpdate() {
28212791

28222792
RESTCatalog catalog = catalogWithResponseHeaders(respHeaders);
28232793

2824-
if (requiresNamespaceCreate()) {
2825-
catalog.createNamespace(TABLE.namespace());
2826-
}
2794+
catalog.createNamespace(TABLE.namespace());
28272795

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

@@ -2844,9 +2812,7 @@ public void testETagAfterMetadataOnlyUpdate() {
28442812

28452813
RESTCatalog catalog = catalogWithResponseHeaders(respHeaders);
28462814

2847-
if (requiresNamespaceCreate()) {
2848-
catalog.createNamespace(TABLE.namespace());
2849-
}
2815+
catalog.createNamespace(TABLE.namespace());
28502816

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

@@ -2867,9 +2833,7 @@ public void testETagWithRegisterTable() {
28672833

28682834
RESTCatalog catalog = catalogWithResponseHeaders(respHeaders);
28692835

2870-
if (requiresNamespaceCreate()) {
2871-
catalog.createNamespace(TABLE.namespace());
2872-
}
2836+
catalog.createNamespace(TABLE.namespace());
28732837

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

@@ -2912,9 +2876,7 @@ public void testReconcileOnUnknownSnapshotAddMatchesSnapshotId() {
29122876
ImmutableMap.of(
29132877
CatalogProperties.FILE_IO_IMPL, "org.apache.iceberg.inmemory.InMemoryFileIO"));
29142878

2915-
if (requiresNamespaceCreate()) {
2916-
catalog.createNamespace(TABLE.namespace());
2917-
}
2879+
catalog.createNamespace(TABLE.namespace());
29182880

29192881
catalog.createTable(TABLE, SCHEMA);
29202882

@@ -2972,9 +2934,7 @@ public void testCommitStateUnknownNotReconciled() {
29722934
ImmutableMap.of(
29732935
CatalogProperties.FILE_IO_IMPL, "org.apache.iceberg.inmemory.InMemoryFileIO"));
29742936

2975-
if (requiresNamespaceCreate()) {
2976-
catalog.createNamespace(TABLE.namespace());
2977-
}
2937+
catalog.createNamespace(TABLE.namespace());
29782938

29792939
catalog.createTable(TABLE, SCHEMA);
29802940

0 commit comments

Comments
 (0)