This is an automated email from the ASF dual-hosted git repository.
xuba pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/amoro.git
The following commit(s) were added to refs/heads/master by this push:
new 615c7e8c2 Fix flaky TestInternalMixedCatalogService by hardening test
cleanup (#4165)
615c7e8c2 is described below
commit 615c7e8c25b6646336440947169ad110ae697fe1
Author: Jiwon Park <[email protected]>
AuthorDate: Tue Apr 7 14:55:32 2026 +0900
Fix flaky TestInternalMixedCatalogService by hardening test cleanup (#4165)
* Fix flaky TestInternalMixedCatalogService by hardening test cleanup
When a test method fails mid-way after creating a table but before
dropping it, the @AfterEach cleanup could not drop the non-empty
database. This left residual state that caused cascading failures
in subsequent nested test classes (Database already exists, assertion
on listDatabases().isEmpty(), etc.).
- CompatibilityCatalogTests.cleanDatabase: drop residual table before
dropping database, wrap both in try-catch
- TestTableCommit.after: guard dropTable with tableExists check, wrap
in try-catch to prevent cascading cleanup failures
Signed-off-by: Jiwon Park <[email protected]>
* Wrap dropDatabase in try-catch in TestTableOperation cleanup
Add missing try-catch around dropDatabase in TestTableOperation.after()
for consistency with TestTableCommit and CompatibilityCatalogTests
cleanup methods.
Signed-off-by: Jiwon Park <[email protected]>
---------
Signed-off-by: Jiwon Park <[email protected]>
---
.../server/TestInternalMixedCatalogService.java | 33 +++++++++++++++++++---
1 file changed, 29 insertions(+), 4 deletions(-)
diff --git
a/amoro-ams/src/test/java/org/apache/amoro/server/TestInternalMixedCatalogService.java
b/amoro-ams/src/test/java/org/apache/amoro/server/TestInternalMixedCatalogService.java
index 063fafddb..3e24e42b6 100644
---
a/amoro-ams/src/test/java/org/apache/amoro/server/TestInternalMixedCatalogService.java
+++
b/amoro-ams/src/test/java/org/apache/amoro/server/TestInternalMixedCatalogService.java
@@ -197,7 +197,11 @@ public class TestInternalMixedCatalogService extends
RestCatalogServiceTestBase
} catch (Exception e) {
LOG.warn("Failed to drop table during cleanup", e);
}
- catalog.dropDatabase(database);
+ try {
+ catalog.dropDatabase(database);
+ } catch (Exception e) {
+ LOG.warn("Failed to drop database during cleanup", e);
+ }
}
@ParameterizedTest(name = "CatalogTableOperationTest[withPrimaryKey={0}]")
@@ -257,8 +261,18 @@ public class TestInternalMixedCatalogService extends
RestCatalogServiceTestBase
@AfterEach
public void after() {
- catalog.dropTable(tableIdentifier, true);
- catalog.dropDatabase(database);
+ try {
+ if (catalog.tableExists(tableIdentifier)) {
+ catalog.dropTable(tableIdentifier, true);
+ }
+ } catch (Exception e) {
+ LOG.warn("Failed to drop table during cleanup", e);
+ }
+ try {
+ catalog.dropDatabase(database);
+ } catch (Exception e) {
+ LOG.warn("Failed to drop database during cleanup", e);
+ }
}
@ParameterizedTest(name = "TableCommitTest[withPrimaryKey={0}]")
@@ -320,7 +334,18 @@ public class TestInternalMixedCatalogService extends
RestCatalogServiceTestBase
@AfterEach
public void cleanDatabase() {
- catalog.dropDatabase(database);
+ try {
+ if (catalog.tableExists(tableIdentifier)) {
+ catalog.dropTable(tableIdentifier, true);
+ }
+ } catch (Exception e) {
+ LOG.warn("Failed to drop table during cleanup", e);
+ }
+ try {
+ catalog.dropDatabase(database);
+ } catch (Exception e) {
+ LOG.warn("Failed to drop database during cleanup", e);
+ }
}
@ParameterizedTest(name =
"Test-NewCatalog-Load-HistoricalTable[withPrimaryKey={0}]")