tripleo_container_manage: add check mode testing
Add more molecule coverage by running the role in check mode. Change-Id: I9b73c19b1d9449e1c0956673bcb2114675920f97
This commit is contained in:
parent
ee81ecb240
commit
51ac23cebe
@ -29,6 +29,8 @@
|
|||||||
name: tripleo_container_manage
|
name: tripleo_container_manage
|
||||||
post_tasks:
|
post_tasks:
|
||||||
- name: Verify that Fedora container was created correctly
|
- name: Verify that Fedora container was created correctly
|
||||||
|
when:
|
||||||
|
- not ansible_check_mode|bool
|
||||||
block:
|
block:
|
||||||
- name: Check for fedora container
|
- name: Check for fedora container
|
||||||
command: podman container exists fedora
|
command: podman container exists fedora
|
||||||
@ -103,12 +105,16 @@
|
|||||||
podman_container_info:
|
podman_container_info:
|
||||||
name: fedora
|
name: fedora
|
||||||
register: fedora_infos_old
|
register: fedora_infos_old
|
||||||
|
when:
|
||||||
|
- not ansible_check_mode|bool
|
||||||
- include_role:
|
- include_role:
|
||||||
name: tripleo_container_manage
|
name: tripleo_container_manage
|
||||||
- name: Gather facts about fedora container after new run
|
- name: Gather facts about fedora container after new run
|
||||||
podman_container_info:
|
podman_container_info:
|
||||||
name: fedora
|
name: fedora
|
||||||
register: fedora_infos_new
|
register: fedora_infos_new
|
||||||
|
when:
|
||||||
|
- not ansible_check_mode|bool
|
||||||
post_tasks:
|
post_tasks:
|
||||||
- name: Assert that fedora container has not been re-created
|
- name: Assert that fedora container has not been re-created
|
||||||
assert:
|
assert:
|
||||||
@ -116,6 +122,8 @@
|
|||||||
- fedora_infos_new == fedora_infos_old
|
- fedora_infos_new == fedora_infos_old
|
||||||
fail_msg: 'fedora container was wrongly re-created'
|
fail_msg: 'fedora container was wrongly re-created'
|
||||||
success_msg: 'fedora container was not re-created'
|
success_msg: 'fedora container was not re-created'
|
||||||
|
when:
|
||||||
|
- not ansible_check_mode|bool
|
||||||
|
|
||||||
- name: Manage only one container
|
- name: Manage only one container
|
||||||
become: true
|
become: true
|
||||||
@ -133,6 +141,8 @@
|
|||||||
name: tripleo_container_manage
|
name: tripleo_container_manage
|
||||||
post_tasks:
|
post_tasks:
|
||||||
- name: Verify that all containers still exist
|
- name: Verify that all containers still exist
|
||||||
|
when:
|
||||||
|
- not ansible_check_mode|bool
|
||||||
block:
|
block:
|
||||||
- name: Check for fedora container
|
- name: Check for fedora container
|
||||||
command: podman container exists fedora
|
command: podman container exists fedora
|
||||||
@ -182,6 +192,8 @@
|
|||||||
name: tripleo_container_manage
|
name: tripleo_container_manage
|
||||||
post_tasks:
|
post_tasks:
|
||||||
- name: Verify that all containers still exist
|
- name: Verify that all containers still exist
|
||||||
|
when:
|
||||||
|
- not ansible_check_mode|bool
|
||||||
block:
|
block:
|
||||||
- name: Check for fedora container
|
- name: Check for fedora container
|
||||||
command: podman container exists fedora
|
command: podman container exists fedora
|
||||||
@ -226,6 +238,8 @@
|
|||||||
name: tripleo_container_manage
|
name: tripleo_container_manage
|
||||||
post_tasks:
|
post_tasks:
|
||||||
- name: Verify that all containers still exist
|
- name: Verify that all containers still exist
|
||||||
|
when:
|
||||||
|
- not ansible_check_mode|bool
|
||||||
block:
|
block:
|
||||||
- name: Check that fedora container was removed
|
- name: Check that fedora container was removed
|
||||||
command: podman container exists fedora
|
command: podman container exists fedora
|
||||||
@ -267,6 +281,8 @@
|
|||||||
name: tripleo_container_manage
|
name: tripleo_container_manage
|
||||||
post_tasks:
|
post_tasks:
|
||||||
- name: Verify that Fedora bis container was re-created correctly
|
- name: Verify that Fedora bis container was re-created correctly
|
||||||
|
when:
|
||||||
|
- not ansible_check_mode|bool
|
||||||
block:
|
block:
|
||||||
- name: Check for fedora_bis container
|
- name: Check for fedora_bis container
|
||||||
command: podman container exists fedora_bis
|
command: podman container exists fedora_bis
|
||||||
@ -282,6 +298,8 @@
|
|||||||
success_msg: 'fedora_bis container has the right image'
|
success_msg: 'fedora_bis container has the right image'
|
||||||
- name: Check for fedora_three container
|
- name: Check for fedora_three container
|
||||||
command: podman container exists fedora_three
|
command: podman container exists fedora_three
|
||||||
|
when:
|
||||||
|
- not ansible_check_mode|bool
|
||||||
|
|
||||||
- name: Test a container config override
|
- name: Test a container config override
|
||||||
become: true
|
become: true
|
||||||
@ -300,6 +318,8 @@
|
|||||||
name: tripleo_container_manage
|
name: tripleo_container_manage
|
||||||
post_tasks:
|
post_tasks:
|
||||||
- name: Verify that Fedora bis container was re-created correctly
|
- name: Verify that Fedora bis container was re-created correctly
|
||||||
|
when:
|
||||||
|
- not ansible_check_mode|bool
|
||||||
block:
|
block:
|
||||||
- name: Check for fedora_bis container
|
- name: Check for fedora_bis container
|
||||||
command: podman container exists fedora_bis
|
command: podman container exists fedora_bis
|
||||||
@ -315,3 +335,5 @@
|
|||||||
success_msg: 'fedora_bis container has the right image'
|
success_msg: 'fedora_bis container has the right image'
|
||||||
- name: Check for fedora_three container
|
- name: Check for fedora_three container
|
||||||
command: podman container exists fedora_three
|
command: podman container exists fedora_three
|
||||||
|
when:
|
||||||
|
- not ansible_check_mode|bool
|
||||||
|
@ -44,7 +44,7 @@ scenario:
|
|||||||
test_sequence:
|
test_sequence:
|
||||||
- prepare
|
- prepare
|
||||||
- converge
|
- converge
|
||||||
- verify
|
- check
|
||||||
|
|
||||||
verifier:
|
verifier:
|
||||||
name: testinfra
|
name: testinfra
|
||||||
|
Loading…
Reference in New Issue
Block a user