1
0
Fork 0
mirror of https://github.com/containers/ansible-podman-collections.git synced 2026-03-22 02:29:08 +00:00
ansible-podman-collections/tests/integration/targets/podman_container_idempotency/tasks/idem_volumes.yml
Sergey f6bd81e820
Add another test for volumes (#942)
Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2025-06-22 12:25:25 +03:00

397 lines
9 KiB
YAML

# Volumes
- containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
name: idempotency
state: absent
- containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
image: "{{ idem_image }}"
name: idempotency
state: started
command: 1h
- containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
image: "{{ idem_image }}"
name: idempotency
state: present
command: 1h
register: test1
- name: check test1
assert:
that: test1 is not changed
- containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
image: "{{ idem_image }}"
name: idempotency
state: present
command: 1h
register: test2
- name: check test2
assert:
that: test2 is not changed
- containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
image: "{{ idem_image }}"
name: idempotency
state: present
command: 1h
register: test3
- name: check test3
assert:
that: test3 is not changed
- containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
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:
executable: "{{ test_executable | default('podman') }}"
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:
executable: "{{ test_executable | default('podman') }}"
image: "{{ idem_image }}"
name: idempotency
state: present
command: 1h
register: test6
- name: check test6
assert:
that: test6 is changed
- containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
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:
executable: "{{ test_executable | default('podman') }}"
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:
executable: "{{ test_executable | default('podman') }}"
image: "{{ idem_image }}"
name: idempotency
state: present
command: 1h
register: test9
- name: check test9
assert:
that: test9 is changed
- name: Create volumes
shell: |
podman volume inspect local_volume1 || podman volume create local_volume1
podman volume inspect local_volume2 || podman volume create local_volume2
- containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
image: "{{ idem_image }}"
name: idempotency
state: present
command: 1h
volumes:
- "/opt:/anotherdir"
- "local_volume1:/data"
register: test10
- name: check test10
assert:
that: test10 is changed
- containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
image: "{{ idem_image }}"
name: idempotency
state: present
command: 1h
volumes:
- "/opt//:/anotherdir"
- "local_volume1:/data/"
register: test11
- name: check test11
assert:
that: test11 is not changed
- containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
image: "{{ idem_image }}"
name: idempotency
state: present
command: 1h
volumes:
- "/opt:/anotherdir"
- "local_volume2:/data"
register: test12
- name: check test12
assert:
that: test12 is changed
- containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
image: "{{ idem_image }}"
name: idempotency
state: present
command: 1h
volumes:
- "/opt:/anotherdir"
register: test13
- name: check test13
assert:
that: test13 is changed
- containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
name: idempotency1
state: absent
- containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
image: alpine
name: idempotency1
state: present
command: sleep 1h
- containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
image: alpine
name: idempotency1
state: present
command: sleep 1h
register: test14
- name: check test14
assert:
that: test14 is not changed
- containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
image: alpine
name: idempotency1
state: present
volumes:
- /opt:/data
command: sleep 1h
register: test15
- name: check test15
assert:
that: test15 is changed
- containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
image: alpine
name: idempotency1
state: present
command: sleep 1h
register: test16
- name: check test16
assert:
that: test16 is changed
- containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
image: alpine
name: idempotency1
state: present
command: sleep 1h
register: test17
- name: check test17
assert:
that: test17 is not changed
- containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
image: alpine
name: idempotency1
state: present
command: sleep 1h
mounts:
- "type=bind,source=/tmp,destination=/tmp"
register: test18
- name: check test18
assert:
that: test18 is changed
- containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
image: alpine
name: idempotency1
state: present
command: sleep 1h
mounts:
- "type=bind,source=/tmp,destination=/tmp"
register: test19
- name: check test19
assert:
that: test19 is not changed
- containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
image: alpine
name: idempotency1
state: present
command: sleep 1h
mounts:
- "type=bind,source=/tmp,destination=/tmp"
- "type=bind,source=/var,destination=/var"
volumes:
- /opt:/data
- "local_volume2:/data2"
register: test20
- name: check test20
assert:
that: test20 is changed
- containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
image: alpine
name: idempotency1
state: present
command: sleep 1h
mounts:
- "type=bind,source=/tmp,destination=/tmp"
- "type=bind,source=/var,destination=/var"
volumes:
- /opt:/data
- "local_volume2:/data2"
register: test21
- name: check test21
assert:
that: test21 is not changed
- containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
image: alpine
name: idempotency1
state: present
command: sleep 1h
mounts:
- "type=bind,source=/tmp,destination=/tmp"
volumes:
- /opt:/data
register: test22
- name: check test22
assert:
that: test22 is changed
- containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
image: alpine
name: idempotency1
state: present
command: sleep 1h
mounts:
- "type=bind,source=/tmp,destination=/tmp"
volumes:
- /opt:/data
register: test23
- name: check test23
assert:
that: test23 is not changed
- ansible.builtin.file:
path: /tmp/data
state: directory
- containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
name: test24
image: alpine
state: present
volumes:
- /tmp/data:/data:z
- containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
name: test24
image: alpine
state: present
volumes:
- /tmp/data:/data:U
register: test24
- containers.podman.podman_container:
executable: "{{ test_executable | default('podman') }}"
name: test24
image: alpine
state: present
volumes:
- /tmp/data:/data:U
register: test25
- name: Check volumes with selinux relabeling
assert:
that:
- test24 is changed
- >-
(test24.container['Config']['CreateCommand'] is defined and
'/tmp/data:/data:U' in test24.container['Config']['CreateCommand'] | list)
- test25 is not changed
- >-
(test25.container['Config']['CreateCommand'] is defined and
'/tmp/data:/data:U' in test25.container['Config']['CreateCommand'] | list)
- ansible.builtin.file:
path: /tmp/data
state: absent