Contain IT teardown failures so one flaky cleanup doesn't cascade#1392
Open
kuchtiak-ufal wants to merge 3 commits into
Open
Contain IT teardown failures so one flaky cleanup doesn't cascade#1392kuchtiak-ufal wants to merge 3 commits into
kuchtiak-ufal wants to merge 3 commits into
Conversation
Wrap each builder's cleanup() in its own try/catch in AbstractBuilderCleanupUtil so a single failure (e.g. the intermittent Hibernate ConcurrentModificationException in ResourceRegistryStandardImpl.releaseResources) no longer aborts cleanup of the remaining builders. The first failure is rethrown with any subsequent failures attached via addSuppressed. Restructure AbstractIntegrationTestWithDatabase.destroy() to run the shared-state resets (Solr cores, authority cache, QA events, config service, builder cache) in a finally block, so that state is always reset between tests even when builder cleanup throws. Previously those resets sat after the try/catch, so any teardown exception would skip them and poison every subsequent test in the class. Fixes DSpace#12324
There was a problem hiding this comment.
Pull request overview
This PR applies an upstream test-stability fix to prevent flaky teardown/cleanup failures (notably intermittent ConcurrentModificationException during cleanup) from cascading and breaking subsequent integration tests in CLARIN-DSpace’s DSpace v7 backend test suite.
Changes:
- Update builder cleanup to continue cleaning remaining builders even if one cleanup step fails, while aggregating failures via suppressed exceptions.
- Refactor integration test teardown to ensure shared static state (Solr cores, caches, config, builder cache) is reset even when earlier teardown steps fail.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| dspace-api/src/test/java/org/dspace/builder/util/AbstractBuilderCleanupUtil.java | Makes builder cleanup resilient by isolating failures per builder and rethrowing an aggregated failure at the end. |
| dspace-api/src/test/java/org/dspace/AbstractIntegrationTestWithDatabase.java | Attempts to contain teardown failures and always reset shared static state after each test to avoid cascading flakes. |
Comments suppressed due to low confidence (1)
dspace-api/src/test/java/org/dspace/AbstractIntegrationTestWithDatabase.java:235
- resetSharedState() wraps all failures into a bare RuntimeException, which drops useful context (message) and contradicts its own
throws Exceptioncontract. Since destroy() already aggregates/suppresses teardown failures, it’s clearer to let resetSharedState() propagate its original exception (or wrap with a descriptive message).
try {
// Reload our ConfigurationService (to reset configs to defaults again)
DSpaceServicesFactory.getInstance().getConfigurationService().reloadConfig();
AbstractBuilder.cleanupBuilderCache();
// NOTE: we explicitly do NOT destroy our default eperson & admin as they
// are cached and reused for all tests. This speeds up all tests.
} catch (Exception e) {
throw new RuntimeException(e);
}
…s it is called from super.destroy()
Comment on lines
+204
to
+206
| * Reset all shared static state between tests: Solr cores, authority cache, configuration | ||
| * service, and the builder cache. Called from {@link #destroy()} inside a finally block so this always | ||
| * runs, even if earlier teardown steps failed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change applies the upstream fix of certain ConcurrentModificationException test failures.
See: Upstream Issue:12324 and the pull request: 12325