community.docker/tests
Paul Berruti 21288cda7e Fix _image_lookup to handle combined tag@digest format
The parse_repository_tag fix alone is not sufficient because Docker stores
RepoTags and RepoDigests separately. When looking up an image with combined
tag@digest (e.g., nginx:1.21@sha256:abc...), the _image_lookup function must
split the combined format and match BOTH RepoTags (for the tag) AND
RepoDigests (for the digest).

Docker stores:
- RepoTags: ["nginx:1.21"]
- RepoDigests: ["nginx@sha256:abc..."]

But NEVER stores the combined format. The previous code would construct:
- lookup = "nginx:1.21@sha256:abc..." (never matches RepoTags)
- lookup_digest = "nginx@1.21@sha256:abc..." (never matches RepoDigests)

This fix:
1. Adds filter_images_by_tag() helper function to _util.py to avoid code
   duplication between _common.py and _common_api.py
2. Detects combined tag@digest format in the tag parameter
3. Splits into tag_part and digest_part
4. Constructs proper lookups for both RepoTags and RepoDigests
5. Requires BOTH to match for successful image lookup

Without this fix, image_label_mismatch: ignore fails because the image
cannot be found, resulting in no image labels being included in expected
labels comparison.

Includes comprehensive unit tests in test__util.py covering all scenarios
including edge cases for multiple @ symbols and empty tag parts.
2025-11-22 20:10:21 -08:00
..
ee Use FQCNs. (#1180) 2025-10-25 10:12:21 +02:00
images Add Distribution 3.0.0 image. 2025-08-03 14:18:29 +02:00
integration Improve error/warning messages w.r.t. YAML quoting (#1205) 2025-11-16 12:32:51 +01:00
sanity Add typing information, 2/n (#1178) 2025-10-25 01:16:04 +02:00
unit Fix _image_lookup to handle combined tag@digest format 2025-11-22 20:10:21 -08:00
utils Restrict cffi on Python 2. (#1126) 2025-09-12 19:58:48 +02:00
config.yml Since we require ansible-core >= 2.15, nothing before Python 2.7 is supported and used in tests anyway. 2025-04-27 12:24:53 +02:00