Skip to content

Invalidate the TestImageRegistry cache after running prune --all - #41442

Merged
Blue (OneBlue) merged 1 commit into
masterfrom
user/oneblue/fix-tests-18
Aug 26, 2026
Merged

Invalidate the TestImageRegistry cache after running prune --all#41442
Blue (OneBlue) merged 1 commit into
masterfrom
user/oneblue/fix-tests-18

Conversation

@OneBlue

Copy link
Copy Markdown
Collaborator

Summary of the Pull Request

This change solves an out-of-date test registry cache issue which can cause the following test failure:

StartGroup: WSLCE2ETests::WSLCE2EContainerRunTests::WSLCE2E_Container_Run_PortMultipleMappings
Error: Verify: AreEqual(*expected.Stderr, *Stderr) - Values (, Image 'python:3.12-alpine' not found, pulling
3.12-alpine: Pulling from library/python
55afa1ecc21d: Already exists
0021712cb493: Already exists
7eec6ed36766: Already exists
5086b6265f8c: Already exists
Digest: sha256:d09d15e60962ca365d1cd544a48773bac9d33f2fb1b00f2aa0deec78ade7dc31
Status: Downloaded newer image for python:3.12-alpine
) [File: C:/Users/piboulay/repos/wsl/test/windows/wslc/e2e/WSLCExecutor.cpp, Function: WSLCE2ETests::WSLCExecutionResult::Verify, Line: 91]
EndGroup: WSLCE2ETests::WSLCE2EContainerRunTests::WSLCE2E_Container_Run_PortMultipleMappings [Failed

That's because wslc prune --all can get rid of the python image, which causes a pull in later tests, causing test failures

PR Checklist

  • Closes: Link to issue #xxx
  • Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • Tests: Added/updated if needed and all pass
  • Localization: All end user facing strings can be localized
  • Dev docs: Added/updated if needed
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

Copilot AI lite review requested due to automatic review settings August 25, 2026 22:45
@OneBlue
Blue (OneBlue) requested review from a team as code owners August 25, 2026 22:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_AllFlag test 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.

@OneBlue Blue (OneBlue) changed the title Invalid the TestImageRegistry cache after running prune --all Invalidate the TestImageRegistry cache after running prune --all Aug 25, 2026
@OneBlue
Blue (OneBlue) merged commit 8af1856 into master Aug 26, 2026
12 checks passed
@OneBlue
Blue (OneBlue) deleted the user/oneblue/fix-tests-18 branch August 26, 2026 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants