mirror of
https://github.com/containers/ansible-podman-collections.git
synced 2026-02-04 07:11:49 +00:00
Fix idempotency for tagging local images (#980)
Signed-off-by: Jeoffrey Bakker <jeoffreybakker@users.noreply.github.com>
This commit is contained in:
parent
991e461ea5
commit
0d44070261
3 changed files with 104 additions and 5 deletions
|
|
@ -13,6 +13,22 @@
|
|||
target_names:
|
||||
- openjdk8
|
||||
- jdk8
|
||||
register: tag_result
|
||||
|
||||
- name: Tag image again to test idempotency
|
||||
containers.podman.podman_tag:
|
||||
executable: "{{ test_executable | default('podman') }}"
|
||||
image: docker.io/library/alpine
|
||||
target_names:
|
||||
- openjdk8
|
||||
- jdk8
|
||||
register: tag_result_idempotency
|
||||
|
||||
- name: Check idempotency
|
||||
assert:
|
||||
that:
|
||||
- tag_result.changed == true
|
||||
- tag_result_idempotency.changed == false
|
||||
|
||||
- name: Get tagged image info
|
||||
containers.podman.podman_image_info:
|
||||
|
|
|
|||
22
tests/unit/plugins/modules/test_podman_tag.py
Normal file
22
tests/unit/plugins/modules/test_podman_tag.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import pytest
|
||||
|
||||
from ansible_collections.containers.podman.plugins.modules.podman_tag import create_full_qualified_image_name
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"test_input, expected",
|
||||
[
|
||||
("alpine", "localhost/alpine:latest"),
|
||||
("alpine:3.19", "localhost/alpine:3.19"),
|
||||
("docker.io/library/alpine", "docker.io/library/alpine:latest"),
|
||||
("docker.io/alpine", "docker.io/library/alpine:latest"),
|
||||
("docker.io/alpine@sha256:1234567890abcdef", "docker.io/library/alpine@sha256:1234567890abcdef"),
|
||||
],
|
||||
)
|
||||
def test_create_full_qualified_image_name(test_input, expected):
|
||||
print(create_full_qualified_image_name.__code__.co_filename)
|
||||
assert create_full_qualified_image_name(test_input) == expected
|
||||
Loading…
Add table
Add a link
Reference in a new issue