1
0
Fork 0
mirror of https://github.com/containers/ansible-podman-collections.git synced 2026-02-04 07:11:49 +00:00
ansible-podman-collections/tests/integration/targets/podman_volume/tasks/main.yml
Sergey 03f19dfe25
Prepare tests to use custom executable, part 5 (#477)
Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
2022-09-04 22:03:29 +03:00

170 lines
4.4 KiB
YAML

- name: Test podman_volume
block:
- name: Print podman version
command: "{{ podman_cmd | default('podman') }} version"
- name: Generate random value for volume name
set_fact:
volume_name: "{{ 'ansible-test-podman-%0x' % ((2**32) | random) }}"
- name: Make sure volume doesn't exist
containers.podman.podman_volume:
executable: "{{ test_executable | default('podman') }}"
name: "{{ volume_name }}"
state: absent
- name: Get missing volume info
containers.podman.podman_volume_info:
executable: "{{ test_executable | default('podman') }}"
name: "{{ volume_name }}"
register: info
ignore_errors: true
- name: Check results
assert:
that:
- info is failed
- name: Create volume
containers.podman.podman_volume:
executable: "{{ test_executable | default('podman') }}"
name: "{{ volume_name }}"
register: vol
- name: Get existing volume info
containers.podman.podman_volume_info:
executable: "{{ test_executable | default('podman') }}"
name: "{{ volume_name }}"
register: info1
- name: Check info
assert:
that:
- info1 | length > 1
- info1.volumes.0.Name == volume_name
- vol is changed
- name: Create volume again
containers.podman.podman_volume:
executable: "{{ test_executable | default('podman') }}"
name: "{{ volume_name }}"
state: present
register: info2
- name: Check info
assert:
that:
- info2 is not changed
- name: Create volume with labels
containers.podman.podman_volume:
executable: "{{ test_executable | default('podman') }}"
name: "{{ volume_name }}"
state: present
label:
key: val
nokey: noval
register: info3
- name: Check info
assert:
that:
- info3 is changed
- name: Create volume with labels again
containers.podman.podman_volume:
executable: "{{ test_executable | default('podman') }}"
name: "{{ volume_name }}"
state: present
label:
key: val
nokey: noval
register: info4
- name: Check info
assert:
that:
- info4 is not changed
- name: Create volume w/o labels
containers.podman.podman_volume:
executable: "{{ test_executable | default('podman') }}"
name: "{{ volume_name }}"
state: present
register: info5
- name: Check info
assert:
that:
- info5 is changed
- name: Create volume with options
containers.podman.podman_volume:
executable: "{{ test_executable | default('podman') }}"
name: "{{ volume_name }}"
state: present
options:
- "device=/dev/something"
- "type=ext4"
register: info6
- name: Check info
assert:
that:
- info6 is changed
- name: Create volume with options again
containers.podman.podman_volume:
executable: "{{ test_executable | default('podman') }}"
name: "{{ volume_name }}"
state: present
options:
- "device=/dev/something"
- "type=ext4"
register: info7
- name: Check info
assert:
that:
- info7 is not changed
- name: Create volume w/o options
containers.podman.podman_volume:
executable: "{{ test_executable | default('podman') }}"
name: "{{ volume_name }}"
state: present
register: info8
- name: Check info
assert:
that:
- info8 is changed
- name: Make sure volume doesn't exist
containers.podman.podman_volume:
executable: "{{ test_executable | default('podman') }}"
name: "{{ volume_name }}"
state: absent
register: delete
- name: Get existing volume info
containers.podman.podman_volume_info:
executable: "{{ test_executable | default('podman') }}"
name: "{{ volume_name }}"
register: info10
ignore_errors: true
- name: Check results
assert:
that:
- info10 is failed
- delete.volume == {}
always:
- name: Make sure volume doesn't exist
containers.podman.podman_volume:
executable: "{{ test_executable | default('podman') }}"
name: "{{ volume_name }}"
state: absent