diff --git a/.github/workflows/podman_container.yml b/.github/workflows/podman_container.yml index 73cab14..ba31180 100644 --- a/.github/workflows/podman_container.yml +++ b/.github/workflows/podman_container.yml @@ -75,7 +75,7 @@ jobs: ~/.local/bin/ansible-galaxy collection install -vvv --force /tmp/just_new_collection/*.tar.gz sudo ~/.local/bin/ansible-galaxy collection install -vvv --force /tmp/just_new_collection/*.tar.gz - - name: Run collection tests for connection + - name: Run collection tests for podman container run: | export PATH=~/.local/bin:$PATH diff --git a/.github/workflows/podman_container_info.yml b/.github/workflows/podman_container_info.yml index 14c8bd9..2faa085 100644 --- a/.github/workflows/podman_container_info.yml +++ b/.github/workflows/podman_container_info.yml @@ -75,7 +75,7 @@ jobs: ~/.local/bin/ansible-galaxy collection install -vvv --force /tmp/just_new_collection/*.tar.gz sudo ~/.local/bin/ansible-galaxy collection install -vvv --force /tmp/just_new_collection/*.tar.gz - - name: Run collection tests for connection + - name: Run collection tests for podman container info run: | export PATH=~/.local/bin:$PATH diff --git a/.github/workflows/podman_image.yml b/.github/workflows/podman_image.yml index e388395..c91b442 100644 --- a/.github/workflows/podman_image.yml +++ b/.github/workflows/podman_image.yml @@ -75,7 +75,7 @@ jobs: ~/.local/bin/ansible-galaxy collection install -vvv --force /tmp/just_new_collection/*.tar.gz sudo ~/.local/bin/ansible-galaxy collection install -vvv --force /tmp/just_new_collection/*.tar.gz - - name: Run collection tests for connection + - name: Run collection tests for podman image run: | export PATH=~/.local/bin:$PATH diff --git a/.github/workflows/podman_image_info.yml b/.github/workflows/podman_image_info.yml index d511bf5..b063c4b 100644 --- a/.github/workflows/podman_image_info.yml +++ b/.github/workflows/podman_image_info.yml @@ -75,7 +75,7 @@ jobs: ~/.local/bin/ansible-galaxy collection install -vvv --force /tmp/just_new_collection/*.tar.gz sudo ~/.local/bin/ansible-galaxy collection install -vvv --force /tmp/just_new_collection/*.tar.gz - - name: Run collection tests for connection + - name: Run collection tests for podman image info run: | export PATH=~/.local/bin:$PATH diff --git a/.github/workflows/podman_network_info.yml b/.github/workflows/podman_network_info.yml index b9a51e3..82a766d 100644 --- a/.github/workflows/podman_network_info.yml +++ b/.github/workflows/podman_network_info.yml @@ -73,7 +73,7 @@ jobs: ~/.local/bin/ansible-galaxy collection install -vvv --force /tmp/just_new_collection/*.tar.gz sudo ~/.local/bin/ansible-galaxy collection install -vvv --force /tmp/just_new_collection/*.tar.gz - - name: Run collection tests for connection + - name: Run collection tests for podman network info run: | export PATH=~/.local/bin:$PATH diff --git a/.github/workflows/podman_volume_info.yml b/.github/workflows/podman_volume_info.yml index 5632339..b64b63f 100644 --- a/.github/workflows/podman_volume_info.yml +++ b/.github/workflows/podman_volume_info.yml @@ -73,7 +73,7 @@ jobs: ~/.local/bin/ansible-galaxy collection install -vvv --force /tmp/just_new_collection/*.tar.gz sudo ~/.local/bin/ansible-galaxy collection install -vvv --force /tmp/just_new_collection/*.tar.gz - - name: Run collection tests for connection + - name: Run collection tests for podman volume info run: | export PATH=~/.local/bin:$PATH diff --git a/ci/playbooks/containers/podman_container.yml b/ci/playbooks/containers/podman_container.yml index f93b13b..1c1b4e2 100644 --- a/ci/playbooks/containers/podman_container.yml +++ b/ci/playbooks/containers/podman_container.yml @@ -4,3 +4,5 @@ tasks: - include_role: name: podman_container + vars: + idem_image: idempotency_test diff --git a/tests/integration/targets/podman_container/files/Dockerfile b/tests/integration/targets/podman_container/files/Dockerfile new file mode 100644 index 0000000..80a5372 --- /dev/null +++ b/tests/integration/targets/podman_container/files/Dockerfile @@ -0,0 +1,32 @@ +FROM alpine + +LABEL "key"="amazing value" +LABEL nobody=cares + +ARG build_arg + +ENV password root +ENV username root + +RUN adduser -D user && \ + adduser -D user2 + +COPY start.sh /start + +RUN chmod a+rwx /start + +EXPOSE 80 +EXPOSE 8080/tcp + +VOLUME ["/data"] +USER user +WORKDIR /work +STOPSIGNAL 9 + +# problem with OS w/o systemd +# HEALTHCHECK --interval=5m --timeout=3s \ +# CMD date + +CMD ["1d"] +ENTRYPOINT ["/start"] + diff --git a/tests/integration/targets/podman_container/files/start.sh b/tests/integration/targets/podman_container/files/start.sh new file mode 100755 index 0000000..1217239 --- /dev/null +++ b/tests/integration/targets/podman_container/files/start.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +s=${1:-"3h"} +sleep "$s" + diff --git a/tests/integration/targets/podman_container/tasks/build_test_container.yml b/tests/integration/targets/podman_container/tasks/build_test_container.yml new file mode 100644 index 0000000..f81eae3 --- /dev/null +++ b/tests/integration/targets/podman_container/tasks/build_test_container.yml @@ -0,0 +1,29 @@ +--- +- name: Create directory for user build images + file: + path: /tmp/usr_img + state: directory + +- name: Copy files to container build directory + copy: + src: "{{ item }}" + dest: "/tmp/usr_img/{{ item }}" + mode: 777 + loop: + - Dockerfile + - start.sh + +- name: Build test docker image for regular user + containers.podman.podman_image: + name: "{{ idem_image }}" + path: /tmp/usr_img + build: + format: docker + +- name: Build test docker image for root user + containers.podman.podman_image: + name: "{{ idem_image }}" + path: /tmp/usr_img + build: + format: docker + become: true diff --git a/tests/integration/targets/podman_container/tasks/idem_labels.yml b/tests/integration/targets/podman_container/tasks/idem_labels.yml new file mode 100644 index 0000000..b7627fc --- /dev/null +++ b/tests/integration/targets/podman_container/tasks/idem_labels.yml @@ -0,0 +1,179 @@ +# Labels +- containers.podman.podman_container: + name: idempotency + state: absent + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + register: test1 + +- name: check test1 + assert: + that: test1 is not changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + label: + key: "amazing value" + nobody: "cares" + command: 1h + register: test2 + +- name: check test2 + assert: + that: test2 is not changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + register: test3 + +- name: check test3 + assert: + that: test3 is not changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + label: + haha: kukuku + llala: wiwiwiw + command: 1h + register: test4 + +- name: check test4 + assert: + that: test4 is changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + label: + haha: kukuku + llala: wiwiwiw + command: 1h + register: test5 + +- name: check test5 + assert: + that: test5 is not changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + register: test6 + +- name: check test6 + assert: + that: test6 is changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + label: + test: notest + command: 1h + register: test7 + +- name: check test7 + assert: + that: test7 is changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + label: + key: "amazing value" + nobody: "cares" + command: 1h + register: test8 + +- name: check test8 + assert: + that: test8 is changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + register: test9 + +- name: check test9 + assert: + that: test9 is not changed + +- containers.podman.podman_container: + name: idempotency1 + state: absent + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + command: sleep 1h + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + command: sleep 1h + register: test10 + +- name: check test10 + assert: + that: test10 is not changed + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + label: + razraz: dva + command: sleep 1h + register: test11 + +- name: check test11 + assert: + that: test11 is changed + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + command: sleep 1h + register: test12 + +- name: check test12 + assert: + that: test12 is changed + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + command: sleep 1h + register: test13 + +- name: check test13 + assert: + that: test13 is not changed diff --git a/tests/integration/targets/podman_container/tasks/idem_ports.yml b/tests/integration/targets/podman_container/tasks/idem_ports.yml new file mode 100644 index 0000000..c039b58 --- /dev/null +++ b/tests/integration/targets/podman_container/tasks/idem_ports.yml @@ -0,0 +1,230 @@ +# Ports +- containers.podman.podman_container: + name: idempotency + state: absent + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + register: test1 + +- name: check test1 + assert: + that: test1 is not changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + ports: + - 7777:8080/tcp + - 127.0.0.1:8888:1929 + - 127.0.0.1:5555:9000 + command: 1h + register: test2 + +- name: check test2 + assert: + that: test2 is changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + ports: + - 7777:8080/tcp + - 127.0.0.1:8888:1929 + - 127.0.0.1:5555:9000 + register: test3 + +- name: check test3 + assert: + that: test3 is not changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + publish_all: true + command: 1h + register: test4 + +- name: check test4 + assert: + that: test4 is changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + publish_all: true + command: 1h + register: test5 + +- name: check test5 + assert: + that: test5 is changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + register: test6 + +- name: check test6 + assert: + that: test6 is changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + ports: + - 10000:8080 + command: 1h + register: test7 + +- name: check test7 + assert: + that: test7 is changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + ports: + - 10001:8080 + command: 1h + register: test8 + +- name: check test8 + assert: + that: test8 is changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + ports: + - 10001:8080/tcp + command: 1h + register: test9 + +- name: check test9 + assert: + that: test9 is not changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + ports: + - 10001:8080/tcp + publish_all: false + command: 1h + register: test9a + +- name: check test9a + assert: + that: test9a is not changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + register: test9b + +- name: check test9b + assert: + that: test9b is changed + +- containers.podman.podman_container: + name: idempotency1 + state: absent + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + command: sleep 1h + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + command: sleep 1h + register: test10 + +- name: check test10 + assert: + that: test10 is not changed + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + publish_all: false + command: sleep 1h + register: test11 + +- name: check test11 + assert: + that: test11 is not changed + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + publish_all: true + command: sleep 1h + register: test11a + +- name: check test11a + assert: + that: test11a is not changed + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + ports: + - 10000:8080 + command: sleep 1h + register: test12 + +- name: check test12 + assert: + that: test12 is changed + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + command: sleep 1h + register: test13 + +- name: check test13 + assert: + that: test13 is changed + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + command: sleep 1h + register: test14 + +- name: check test14 + assert: + that: test14 is not changed diff --git a/tests/integration/targets/podman_container/tasks/idem_stopsignal.yml b/tests/integration/targets/podman_container/tasks/idem_stopsignal.yml new file mode 100644 index 0000000..c4b2ded --- /dev/null +++ b/tests/integration/targets/podman_container/tasks/idem_stopsignal.yml @@ -0,0 +1,204 @@ +# Stop signal +- containers.podman.podman_container: + name: idempotency + state: absent + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + register: test1 + +- name: check test1 + assert: + that: test1 is not changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + stop_signal: 9 + command: 1h + register: test2 + +- name: check test2 + assert: + that: test2 is not changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + register: test3 + +- name: check test3 + assert: + that: test3 is not changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + stop_signal: 10 + command: 1h + register: test4 + +- name: check test4 + assert: + that: test4 is changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + stop_signal: 10 + command: 1h + register: test5 + +- name: check test5 + assert: + that: test5 is not changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + register: test6 + +- name: check test6 + assert: + that: test6 is changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + stop_signal: 15 + command: 1h + register: test7 + +- name: check test7 + assert: + that: test7 is changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + stop_signal: 9 + command: 1h + register: test8 + +- name: check test8 + assert: + that: test8 is changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + register: test9 + +- name: check test9 + assert: + that: test9 is not changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + stop_signal: 15 + command: 1h + register: test9a + +- name: check test9a + assert: + that: test9a is changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + register: test9b + +- name: check test9b + assert: + that: test9b is changed + +- containers.podman.podman_container: + name: idempotency1 + state: absent + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + command: sleep 1h + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + command: sleep 1h + register: test10 + +- name: check test10 + assert: + that: test10 is not changed + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + stop_signal: 15 + command: sleep 1h + register: test11 + +- name: check test11 + assert: + that: test11 is not changed + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + stop_signal: 10 + command: sleep 1h + register: test12 + +- name: check test12 + assert: + that: test12 is changed + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + command: sleep 1h + register: test13 + +- name: check test13 + assert: + that: test13 is changed + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + command: sleep 1h + register: test14 + +- name: check test14 + assert: + that: test14 is not changed diff --git a/tests/integration/targets/podman_container/tasks/idem_users.yml b/tests/integration/targets/podman_container/tasks/idem_users.yml new file mode 100644 index 0000000..ad1f103 --- /dev/null +++ b/tests/integration/targets/podman_container/tasks/idem_users.yml @@ -0,0 +1,169 @@ +# Users +- containers.podman.podman_container: + name: idempotency + state: absent + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + register: test1 + +- name: check test1 + assert: + that: test1 is not changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + user: user + command: 1h + register: test2 + +- name: check test2 + assert: + that: test2 is not changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + register: test3 + +- name: check test3 + assert: + that: test3 is not changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + user: user2 + command: 1h + register: test4 + +- name: check test4 + assert: + that: test4 is changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + user: user2 + command: 1h + register: test5 + +- name: check test5 + assert: + that: test5 is not changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + register: test6 + +- name: check test6 + assert: + that: test6 is changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + user: user2 + command: 1h + register: test7 + +- name: check test7 + assert: + that: test7 is changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + user: user + command: 1h + register: test8 + +- name: check test8 + assert: + that: test8 is changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + register: test9 + +- name: check test9 + assert: + that: test9 is not changed + +- containers.podman.podman_container: + name: idempotency1 + state: absent + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + command: sleep 1h + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + command: sleep 1h + register: test10 + +- name: check test10 + assert: + that: test10 is not changed + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + user: nobody + command: sleep 1h + register: test11 + +- name: check test11 + assert: + that: test11 is changed + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + command: sleep 1h + register: test12 + +- name: check test12 + assert: + that: test12 is changed + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + command: sleep 1h + register: test13 + +- name: check test13 + assert: + that: test13 is not changed diff --git a/tests/integration/targets/podman_container/tasks/idem_volumes.yml b/tests/integration/targets/podman_container/tasks/idem_volumes.yml new file mode 100644 index 0000000..e92a3fe --- /dev/null +++ b/tests/integration/targets/podman_container/tasks/idem_volumes.yml @@ -0,0 +1,174 @@ +# Volumes +- containers.podman.podman_container: + name: idempotency + state: absent + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + register: test1 + +- name: check test1 + assert: + that: test1 is not changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + register: test2 + +- name: check test2 + assert: + that: test2 is not changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + register: test3 + +- name: check test3 + assert: + that: test3 is not changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + volumes: + - /opt:/somedir + command: 1h + register: test4 + +- name: check test4 + assert: + that: test4 is changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + volumes: + - /opt:/somedir + command: 1h + register: test5 + +- name: check test5 + assert: + that: test5 is not changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + register: test6 + +- name: check test6 + assert: + that: test6 is changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + volumes: + - /opt:/somedir + - /data + command: 1h + register: test7 + +- name: check test7 + assert: + that: test7 is changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + volumes: + - /data + command: 1h + register: test8 + +- name: check test8 + assert: + that: test8 is changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + register: test9 + +- name: check test9 + assert: + that: test9 is not changed + +- containers.podman.podman_container: + name: idempotency1 + state: absent + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + command: sleep 1h + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + command: sleep 1h + register: test10 + +- name: check test10 + assert: + that: test10 is not changed + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + volumes: + - /opt:/data + command: sleep 1h + register: test11 + +- name: check test11 + assert: + that: test11 is changed + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + command: sleep 1h + register: test12 + +- name: check test12 + assert: + that: test12 is changed + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + command: sleep 1h + register: test13 + +- name: check test13 + assert: + that: test13 is not changed diff --git a/tests/integration/targets/podman_container/tasks/idem_workdir.yml b/tests/integration/targets/podman_container/tasks/idem_workdir.yml new file mode 100644 index 0000000..b6d0fa3 --- /dev/null +++ b/tests/integration/targets/podman_container/tasks/idem_workdir.yml @@ -0,0 +1,204 @@ +# Workdir +- containers.podman.podman_container: + name: idempotency + state: absent + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + register: test1 + +- name: check test1 + assert: + that: test1 is not changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + workdir: /work + command: 1h + register: test2 + +- name: check test2 + assert: + that: test2 is not changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + register: test3 + +- name: check test3 + assert: + that: test3 is not changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + workdir: /app + command: 1h + register: test4 + +- name: check test4 + assert: + that: test4 is changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + workdir: /app + command: 1h + register: test5 + +- name: check test5 + assert: + that: test5 is not changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + register: test6 + +- name: check test6 + assert: + that: test6 is changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + workdir: /app + command: 1h + register: test7 + +- name: check test7 + assert: + that: test7 is changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + workdir: /work + command: 1h + register: test8 + +- name: check test8 + assert: + that: test8 is changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + register: test9 + +- name: check test9 + assert: + that: test9 is not changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + workdir: / + command: 1h + register: test9a + +- name: check test9a + assert: + that: test9a is changed + +- containers.podman.podman_container: + image: "{{ idem_image }}" + name: idempotency + state: present + command: 1h + register: test9b + +- name: check test9b + assert: + that: test9b is changed + +- containers.podman.podman_container: + name: idempotency1 + state: absent + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + command: sleep 1h + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + command: sleep 1h + register: test10 + +- name: check test10 + assert: + that: test10 is not changed + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + workdir: / + command: sleep 1h + register: test11 + +- name: check test11 + assert: + that: test11 is not changed + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + workdir: /app + command: sleep 1h + register: test12 + +- name: check test12 + assert: + that: test12 is changed + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + command: sleep 1h + register: test13 + +- name: check test13 + assert: + that: test13 is changed + +- containers.podman.podman_container: + image: alpine + name: idempotency1 + state: present + command: sleep 1h + register: test14 + +- name: check test14 + assert: + that: test14 is not changed diff --git a/tests/integration/targets/podman_container/tasks/main.yml b/tests/integration/targets/podman_container/tasks/main.yml index 5687e4e..cd123b0 100644 --- a/tests/integration/targets/podman_container/tasks/main.yml +++ b/tests/integration/targets/podman_container/tasks/main.yml @@ -433,3 +433,24 @@ - name: Remove pod shell: podman pod rm -f testidempod + +- name: Prepare a container + include_tasks: build_test_container.yml + +- name: Test idempotency of users + include_tasks: idem_users.yml + +- name: Test idempotency of workdir + include_tasks: idem_workdir.yml + +- name: Test idempotency of labels + include_tasks: idem_labels.yml + +- name: Test idempotency of stop signal + include_tasks: idem_stopsignal.yml + +- name: Test idempotency of ports + include_tasks: idem_ports.yml + +- name: Test idempotency of volumes + include_tasks: idem_volumes.yml