1
0
Fork 0
mirror of https://github.com/containers/ansible-podman-collections.git synced 2026-03-22 02:29:08 +00:00

Fix image idempotency in pull (#983)

Fix #981

Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
This commit is contained in:
Sergey 2025-10-19 19:18:33 +03:00 committed by GitHub
parent cf7008fb0e
commit c9dd956776
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 94 additions and 4 deletions

View file

@ -0,0 +1,54 @@
---
# Test for issue #981: podman_image with force=true should be idempotent
# https://github.com/containers/ansible-podman-collections/issues/981
- name: Test issue # 981 - Remove alpine image if exists
containers.podman.podman_image:
executable: "{{ test_executable | default('podman') }}"
name: docker.io/library/alpine
tag: latest
state: absent
ignore_errors: true
- name: Test issue # 981 - Pull alpine image first time
containers.podman.podman_image:
executable: "{{ test_executable | default('podman') }}"
name: docker.io/library/alpine
tag: latest
register: issue_981_pull1
- name: Test issue # 981 - Pull alpine with force=true (same digest, should not change)
containers.podman.podman_image:
executable: "{{ test_executable | default('podman') }}"
name: docker.io/library/alpine
tag: latest
force: true
register: issue_981_pull2
- name: Test issue # 981 - Pull alpine with force=true again (same digest, should not change)
containers.podman.podman_image:
executable: "{{ test_executable | default('podman') }}"
name: docker.io/library/alpine
tag: latest
force: true
register: issue_981_pull3
- name: Test issue # 981 - Verify force=true idempotency
assert:
that:
- issue_981_pull1 is changed
- issue_981_pull1.actions | length > 0
- "'Pulled image' in issue_981_pull1.actions[0]"
- issue_981_pull2 is not changed
- issue_981_pull2.actions | length == 0
- issue_981_pull3 is not changed
- issue_981_pull3.actions | length == 0
fail_msg: "Issue #981 not fixed: force=true is not idempotent when digest hasn't changed"
success_msg: "Issue #981 fixed: force=true is idempotent when digest hasn't changed"
- name: Test issue # 981 - Cleanup
containers.podman.podman_image:
executable: "{{ test_executable | default('podman') }}"
name: docker.io/library/alpine
tag: latest
state: absent