Invalidate the TestImageRegistry cache after running prune --all - #41442
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the WSLC E2E test infrastructure to prevent stale TestImageRegistry cache state after wslc image prune --all, avoiding later tests incorrectly assuming images are still present (leading to unexpected pulls and stderr/output mismatches).
Changes:
- Added
TestImageRegistry::InvalidateSession()to discard cached per-session image state after bulk-removal operations. - Updated the
WSLCE2E_Image_Prune_AllFlagtest cleanup to invalidate the cache and restore the baseline Debian test image. - Implemented cache invalidation by removing cached loaded-image keys and clearing the “seeded” marker for the session.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/windows/wslc/e2e/WSLCE2EImagePruneTests.cpp | Ensures image prune --all test cleanup invalidates cache and restores baseline image to avoid cross-test contamination. |
| test/windows/wslc/e2e/TestImageRegistry.h | Adds InvalidateSession() API to explicitly drop cached image state for a session. |
| test/windows/wslc/e2e/TestImageRegistry.cpp | Implements InvalidateSession() by clearing cached loaded images and the seeded-session marker. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
ggarzia-MSFT
approved these changes
Aug 26, 2026
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.
Summary of the Pull Request
This change solves an out-of-date test registry cache issue which can cause the following test failure:
That's because
wslc prune --allcan get rid of the python image, which causes a pull in later tests, causing test failuresPR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed