Fix ListImages test flaky Before/Since filter ordering#40468
Open
Fix ListImages test flaky Before/Since filter ordering#40468
Conversation
The test hardcoded the assumption that debian:latest was created before python:3.12-alpine, but Docker image Created timestamps come from when the image was built in the registry, not when it was pulled or saved. The arm64 test data tars have debian (Mar 16) newer than python (Mar 3), causing the since filter to not return python. Fix by dynamically determining which image is older/newer based on actual Created timestamps, making the test robust against independently updated test data tars. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a flaky WSLC ListImages test that assumed a stable creation-time ordering between debian:latest and python:3.12-alpine, even though Docker’s Created timestamps come from the registry image build time and can change independently across test tar updates.
Changes:
- Captures
Createdtimestamps for the two images under test. - Dynamically selects the “older”/“newer” image IDs based on those timestamps before applying
since/beforefilters. - Improves test logging to show which image was treated as older/newer.
…inct Adds explicit VERIFY checks that debianCreated/pythonCreated are > 0 and not equal before using them to choose the since/before boundary, preventing silent fallthrough or ambiguous Docker filter behavior when both images share a Created timestamp. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment on lines
+957
to
+961
| bool foundNewer = false; | ||
| for (const auto& image : images) | ||
| { | ||
| LogInfo("Image: %hs, Hash: %hs, Created: %lld", image.Image, image.Hash, image.Created); | ||
| if (std::string{image.Image} == "python:3.12-alpine") | ||
| if (std::string{image.Image} == newerName) |
Comment on lines
+979
to
983
| bool foundOlder = false; | ||
| for (const auto& image : images) | ||
| { | ||
| if (std::string{image.Image} == "debian:latest") | ||
| if (std::string{image.Image} == olderName) | ||
| { |
yao-msft
approved these changes
May 8, 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.
The test hardcoded the assumption that debian:latest was created before python:3.12-alpine, but Docker image Created timestamps come from when the image was built in the registry, not when it was pulled or saved. The arm64 test data tars have debian (Mar 16) newer than python (Mar 3), causing the since filter to not return python.
Fix by dynamically determining which image is older/newer based on actual Created timestamps, making the test robust against independently updated test data tars.