From 10d89c409c643e48a8c2f75c5fba9d2d358d0a4b Mon Sep 17 00:00:00 2001 From: Alexandre Dutra Date: Wed, 15 Jan 2025 11:50:37 +0100 Subject: [PATCH] Fix catalog names in integration tests A few tests were still creating catalog names "manually". Depending on the order of test execution, you could see test failures, e.g. in `ManagementServiceIntegrationTest#testListCatalogs()`: ``` expected: [] but was: [...] ``` Because some catalogs created in previous tests weren't deleted. --- .../PolarisApplicationIntegrationTest.java | 23 +++++++++---------- ...larisManagementServiceIntegrationTest.java | 3 ++- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/integration-tests/src/main/java/org/apache/polaris/service/it/test/PolarisApplicationIntegrationTest.java b/integration-tests/src/main/java/org/apache/polaris/service/it/test/PolarisApplicationIntegrationTest.java index d6c5c24a6a..26fbdc32b1 100644 --- a/integration-tests/src/main/java/org/apache/polaris/service/it/test/PolarisApplicationIntegrationTest.java +++ b/integration-tests/src/main/java/org/apache/polaris/service/it/test/PolarisApplicationIntegrationTest.java @@ -353,8 +353,8 @@ public void testIcebergDropNamespaceInExternalCatalog() throws IOException { } @Test - public void testIcebergCreateTablesInExternalCatalog(TestInfo testInfo) throws IOException { - String catalogName = testInfo.getTestMethod().orElseThrow().getName() + "External"; + public void testIcebergCreateTablesInExternalCatalog() throws IOException { + String catalogName = client.newEntityName("testIcebergCreateTablesInExternalCatalogExternal"); createCatalog(catalogName, Catalog.TypeEnum.EXTERNAL, principalRoleName); try (RESTSessionCatalog sessionCatalog = newSessionCatalog(catalogName)) { SessionCatalog.SessionContext sessionContext = SessionCatalog.SessionContext.createEmpty(); @@ -380,8 +380,9 @@ public void testIcebergCreateTablesInExternalCatalog(TestInfo testInfo) throws I } @Test - public void testIcebergCreateTablesWithWritePathBlocked(TestInfo testInfo) throws IOException { - String catalogName = testInfo.getTestMethod().orElseThrow().getName() + "Internal"; + public void testIcebergCreateTablesWithWritePathBlocked() throws IOException { + String catalogName = + client.newEntityName("testIcebergCreateTablesWithWritePathBlockedInternal"); createCatalog(catalogName, Catalog.TypeEnum.INTERNAL, principalRoleName); try (RESTSessionCatalog sessionCatalog = newSessionCatalog(catalogName)) { SessionCatalog.SessionContext sessionContext = SessionCatalog.SessionContext.createEmpty(); @@ -424,8 +425,8 @@ public void testIcebergCreateTablesWithWritePathBlocked(TestInfo testInfo) throw } @Test - public void testIcebergRegisterTableInExternalCatalog(TestInfo testInfo) throws IOException { - String catalogName = testInfo.getTestMethod().orElseThrow().getName() + "External"; + public void testIcebergRegisterTableInExternalCatalog() throws IOException { + String catalogName = client.newEntityName("testIcebergRegisterTableInExternalCatalogExternal"); createCatalog( catalogName, Catalog.TypeEnum.EXTERNAL, @@ -443,8 +444,7 @@ public void testIcebergRegisterTableInExternalCatalog(TestInfo testInfo) throws String location = "file://" + testDir.toFile().getAbsolutePath() - + "/" - + testInfo.getTestMethod().get().getName(); + + "/testIcebergRegisterTableInExternalCatalog"; String metadataLocation = location + "/metadata/000001-494949494949494949.metadata.json"; TableMetadata tableMetadata = @@ -471,8 +471,8 @@ public void testIcebergRegisterTableInExternalCatalog(TestInfo testInfo) throws } @Test - public void testIcebergUpdateTableInExternalCatalog(TestInfo testInfo) throws IOException { - String catalogName = testInfo.getTestMethod().orElseThrow().getName() + "External"; + public void testIcebergUpdateTableInExternalCatalog() throws IOException { + String catalogName = client.newEntityName("testIcebergUpdateTableInExternalCatalogExternal"); createCatalog( catalogName, Catalog.TypeEnum.EXTERNAL, @@ -490,8 +490,7 @@ public void testIcebergUpdateTableInExternalCatalog(TestInfo testInfo) throws IO String location = "file://" + testDir.toFile().getAbsolutePath() - + "/" - + testInfo.getTestMethod().get().getName(); + + "/testIcebergUpdateTableInExternalCatalog"; String metadataLocation = location + "/metadata/000001-494949494949494949.metadata.json"; Types.NestedField col1 = Types.NestedField.of(1, false, "col1", Types.StringType.get()); diff --git a/integration-tests/src/main/java/org/apache/polaris/service/it/test/PolarisManagementServiceIntegrationTest.java b/integration-tests/src/main/java/org/apache/polaris/service/it/test/PolarisManagementServiceIntegrationTest.java index efe91ae6d1..523fc9400b 100644 --- a/integration-tests/src/main/java/org/apache/polaris/service/it/test/PolarisManagementServiceIntegrationTest.java +++ b/integration-tests/src/main/java/org/apache/polaris/service/it/test/PolarisManagementServiceIntegrationTest.java @@ -396,7 +396,8 @@ public void testUpdateCatalogWithoutDefaultBaseLocationInUpdate() { .setStorageType(StorageConfigInfo.StorageTypeEnum.S3) .setAllowedLocations(List.of("s3://my-old-bucket/path/to/data")) .build(); - String catalogName = "mycatalog"; + String catalogName = + client.newEntityName("testUpdateCatalogWithoutDefaultBaseLocationInUpdate"); Catalog catalog = PolarisCatalog.builder() .setType(Catalog.TypeEnum.INTERNAL)