Repository navigation
test(durable): close the Spring context before the temp directory is removed - #4177
Closed
ningmao-hlyz wants to merge 1 commit into
Closed
ningmao-hlyz wants to merge 1 commit into
ningmao-hlyz wants to merge 1 commit into
Conversation
…removed `HttpServerApplicationTest` puts the runtime's data directory inside a static `@TempDir`. JUnit deletes that directory when the class finishes, but the Spring context is cached and stays open, so the SQLite file and the server threads are still there. On Linux the deletion then fails: Failed to delete temp directory /tmp/junit-...: the following paths could not be deleted and the build fails with an error that names neither the test's own assertion nor the runtime. Windows never showed it because the durable example modules are skipped there (`-DskipDurableWindowsTests=true`), so Linux CI is the only place this test runs. Dirty the context after the class so it is closed, and its beans destroyed, before JUnit removes the directory. The test itself is unchanged.
ningmao-hlyz
force-pushed
the
test/http-server-tempdir
branch
from
November 14, 2026 17:17
b0270d2 to
e6add77
Compare
Contributor
Author
|
Consolidated into #4176, so all the flaky-test fixes land as one change instead of several overlapping PRs. |
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.
Problem
HttpServerApplicationTestputs the runtime's data directory inside a static@TempDir:JUnit deletes that directory when the class finishes. The Spring context, however, is cached and stays open, so the SQLite file and the server threads are still using the directory at that moment. On Linux the deletion fails and the build fails with an error that names neither the test nor the runtime:
Observed in #4170 (run 43576293746), where the failing module is
agentscope-examples/durable/integrated/http-serverand the PR under test does not touch it.This is invisible on Windows because the durable example modules are skipped there (
-DskipDurableWindowsTests=true), so Linux CI is the only place this test runs, and the only place it fails.Change
Dirty the context after the class, so Spring closes it and destroys its beans before JUnit removes the directory:
One annotation, no change to the test body, and no change to production code. JUnit runs the built-in
@TempDircleanup after user-registered extensions'afterAllcallbacks, so the context is closed first.Verification
-DskipDurableWindowsTestsis absent).spotless:checkpasses.