Close contexts when clearing test context cache#36825
Conversation
|
Thanks for the PR, @Will-thom. 👍
Please note that this change would only serve as a building block for #26196, since it would not address the broader topic raised in that issue. In any case, it makes sense for Also, please make sure you comply with the DCO requirement by signing your commits. Otherwise, we cannot process this PR. |
|
@Will-thom, please address the DCO sign-off issue.
|
Signed-off-by: Will-thom <116388885+Will-thom@users.noreply.github.com>
9272ec3 to
0923445
Compare
This updates the TestContext Framework cache so that clearing the cache also closes cached ConfigurableApplicationContext instances instead of only dropping the internal references. The implementation reuses the existing removal path, preserving the hierarchy-aware close behavior already used by cache eviction/removal.
The ContextCache contract now documents the close behavior for clear(), and LruContextCacheTests covers both clear() and reset(), since reset() delegates to clear().
Closes gh-26196
Tests:
./gradlew.bat --no-daemon --max-workers=1 :spring-test:test --tests org.springframework.test.context.cache.LruContextCacheTests./gradlew.bat --no-daemon --max-workers=1 :spring-test:test --tests org.springframework.test.context.cache.ContextCacheTests./gradlew.bat --no-daemon --max-workers=1 :spring-test:check