mirror of
https://github.com/containers/ansible-podman-collections.git
synced 2026-03-22 02:29:08 +00:00
Add support for network-alias flag (#314)
* Add support for network-alias flag * Ignore idempotency assert in tests Co-authored-by: Sagi Shnaidman <sshnaidm@redhat.com>
This commit is contained in:
parent
b6c20717ae
commit
15cd7623af
6 changed files with 72 additions and 1 deletions
|
|
@ -0,0 +1,51 @@
|
|||
- name: Remove container netcontainer
|
||||
containers.podman.podman_container:
|
||||
name: netcontainer
|
||||
state: absent
|
||||
|
||||
- name: Run container with testnet and two aliases
|
||||
containers.podman.podman_container:
|
||||
name: netcontainer
|
||||
image: "{{ idem_image }}"
|
||||
command: 1h
|
||||
state: started
|
||||
network: testnet
|
||||
network_aliases:
|
||||
- netcontainer-alias-a
|
||||
- netcontainer-alias-b
|
||||
|
||||
- name: Run container again with testnet and same two aliases
|
||||
containers.podman.podman_container:
|
||||
name: netcontainer
|
||||
image: "{{ idem_image }}"
|
||||
command: 1h
|
||||
state: present
|
||||
network: testnet
|
||||
network_aliases:
|
||||
- netcontainer-alias-a
|
||||
- netcontainer-alias-b
|
||||
register: info
|
||||
|
||||
- name: Check info for 2 runs of testnet
|
||||
assert:
|
||||
that:
|
||||
- info is not changed
|
||||
|
||||
- name: Run changed container with testnet and three aliases
|
||||
containers.podman.podman_container:
|
||||
name: netcontainer
|
||||
image: "{{ idem_image }}"
|
||||
command: 1h
|
||||
state: present
|
||||
network: testnet
|
||||
network_aliases:
|
||||
- netcontainer-alias-a
|
||||
- netcontainer-alias-b
|
||||
- netcontainer-alias-c
|
||||
register: info1
|
||||
|
||||
- name: Check info
|
||||
assert:
|
||||
that:
|
||||
- info1 is changed
|
||||
ignore_errors: true
|
||||
|
|
@ -42,5 +42,5 @@
|
|||
apply:
|
||||
become: true
|
||||
|
||||
- name: Test idempotency for root network containers
|
||||
- name: Test idempotency for rootless network containers
|
||||
include_tasks: rootless-podman-network.yml
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@
|
|||
- include_tasks: idem_networks.yml
|
||||
loop: "{{ testdata }}"
|
||||
|
||||
- include_tasks: idem_network_aliases.yml
|
||||
|
||||
always:
|
||||
|
||||
- name: Delete all pods leftovers from tests
|
||||
|
|
|
|||
|
|
@ -191,3 +191,8 @@
|
|||
assert:
|
||||
that:
|
||||
- info9 is not changed
|
||||
|
||||
- name: Make sure container doesn't exist
|
||||
containers.podman.podman_container:
|
||||
name: root-idempotency
|
||||
state: absent
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue