mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Use force_kill instead of stop_timeout to fasten container cleanup. (#48733)
This commit is contained in:
parent
e6ffc4f89a
commit
afded1c778
11 changed files with 210 additions and 194 deletions
|
@ -20,7 +20,7 @@
|
|||
docker_container:
|
||||
name: "{{ item }}"
|
||||
state: absent
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
with_items: "{{ cnames }}"
|
||||
- name: "Make sure all networks are removed"
|
||||
docker_network:
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
name: "{{ cname }}"
|
||||
state: started
|
||||
hostname: example.org
|
||||
force_kill: yes
|
||||
comparisons:
|
||||
hostname: ignore
|
||||
register: value_2
|
||||
|
@ -37,7 +38,7 @@
|
|||
name: "{{ cname }}"
|
||||
state: started
|
||||
hostname: example.org
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
comparisons:
|
||||
hostname: strict
|
||||
register: value_3
|
||||
|
@ -46,7 +47,7 @@
|
|||
docker_container:
|
||||
name: "{{ cname }}"
|
||||
state: absent
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
|
@ -77,6 +78,7 @@
|
|||
state: started
|
||||
dns_servers:
|
||||
- 9.9.9.9
|
||||
force_kill: yes
|
||||
comparisons:
|
||||
dns_servers: ignore
|
||||
register: list_2
|
||||
|
@ -89,16 +91,16 @@
|
|||
state: started
|
||||
dns_servers:
|
||||
- 9.9.9.9
|
||||
force_kill: yes
|
||||
comparisons:
|
||||
dns_servers: strict
|
||||
stop_timeout: 1
|
||||
register: list_3
|
||||
|
||||
- name: cleanup
|
||||
docker_container:
|
||||
name: "{{ cname }}"
|
||||
state: absent
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
|
@ -131,6 +133,7 @@
|
|||
- 1010
|
||||
- 1011
|
||||
- 1012
|
||||
force_kill: yes
|
||||
comparisons:
|
||||
groups: ignore
|
||||
register: set_2
|
||||
|
@ -145,9 +148,9 @@
|
|||
- 1010
|
||||
- 1011
|
||||
- 1012
|
||||
force_kill: yes
|
||||
comparisons:
|
||||
groups: allow_more_present
|
||||
stop_timeout: 1
|
||||
register: set_3
|
||||
|
||||
- name: set (change, allow_more_present)
|
||||
|
@ -159,9 +162,9 @@
|
|||
groups:
|
||||
- 1010
|
||||
- 1012
|
||||
force_kill: yes
|
||||
comparisons:
|
||||
groups: allow_more_present
|
||||
stop_timeout: 1
|
||||
register: set_4
|
||||
|
||||
- name: set (change, strict)
|
||||
|
@ -173,16 +176,16 @@
|
|||
groups:
|
||||
- 1010
|
||||
- 1012
|
||||
force_kill: yes
|
||||
comparisons:
|
||||
groups: strict
|
||||
stop_timeout: 1
|
||||
register: set_5
|
||||
|
||||
- name: cleanup
|
||||
docker_container:
|
||||
name: "{{ cname }}"
|
||||
state: absent
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
|
@ -217,6 +220,7 @@
|
|||
- "/dev/random:/dev/virt-random:rwm"
|
||||
- "/dev/urandom:/dev/virt-urandom:rwm"
|
||||
- "/dev/null:/dev/virt-null:rwm"
|
||||
force_kill: yes
|
||||
comparisons:
|
||||
devices: ignore
|
||||
register: set_dict_2
|
||||
|
@ -231,9 +235,9 @@
|
|||
- "/dev/random:/dev/virt-random:rwm"
|
||||
- "/dev/urandom:/dev/virt-urandom:rwm"
|
||||
- "/dev/null:/dev/virt-null:rwm"
|
||||
force_kill: yes
|
||||
comparisons:
|
||||
devices: allow_more_present
|
||||
stop_timeout: 1
|
||||
register: set_dict_3
|
||||
|
||||
- name: set(dict) (change, allow_more_present)
|
||||
|
@ -245,9 +249,9 @@
|
|||
devices:
|
||||
- "/dev/random:/dev/virt-random:rwm"
|
||||
- "/dev/null:/dev/virt-null:rwm"
|
||||
force_kill: yes
|
||||
comparisons:
|
||||
devices: allow_more_present
|
||||
stop_timeout: 1
|
||||
register: set_dict_4
|
||||
|
||||
- name: set(dict) (change, strict)
|
||||
|
@ -259,16 +263,16 @@
|
|||
devices:
|
||||
- "/dev/random:/dev/virt-random:rwm"
|
||||
- "/dev/null:/dev/virt-null:rwm"
|
||||
force_kill: yes
|
||||
comparisons:
|
||||
devices: strict
|
||||
stop_timeout: 1
|
||||
register: set_dict_5
|
||||
|
||||
- name: cleanup
|
||||
docker_container:
|
||||
name: "{{ cname }}"
|
||||
state: absent
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
|
@ -303,6 +307,7 @@
|
|||
ansible.test.1: hello
|
||||
ansible.test.2: world
|
||||
ansible.test.3: ansible
|
||||
force_kill: yes
|
||||
comparisons:
|
||||
labels: ignore
|
||||
register: dict_2
|
||||
|
@ -317,9 +322,9 @@
|
|||
ansible.test.1: hello
|
||||
ansible.test.2: world
|
||||
ansible.test.3: ansible
|
||||
force_kill: yes
|
||||
comparisons:
|
||||
labels: allow_more_present
|
||||
stop_timeout: 1
|
||||
register: dict_3
|
||||
|
||||
- name: dict (change, allow_more_present)
|
||||
|
@ -331,9 +336,9 @@
|
|||
labels:
|
||||
ansible.test.1: hello
|
||||
ansible.test.3: ansible
|
||||
force_kill: yes
|
||||
comparisons:
|
||||
labels: allow_more_present
|
||||
stop_timeout: 1
|
||||
register: dict_4
|
||||
|
||||
- name: dict (change, strict)
|
||||
|
@ -345,16 +350,16 @@
|
|||
labels:
|
||||
ansible.test.1: hello
|
||||
ansible.test.3: ansible
|
||||
force_kill: yes
|
||||
comparisons:
|
||||
labels: strict
|
||||
stop_timeout: 1
|
||||
register: dict_5
|
||||
|
||||
- name: cleanup
|
||||
docker_container:
|
||||
name: "{{ cname }}"
|
||||
state: absent
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
|
@ -399,6 +404,7 @@
|
|||
labels:
|
||||
ansible.test.1: hello
|
||||
ansible.test.4: ignore
|
||||
force_kill: yes
|
||||
comparisons:
|
||||
'*': ignore
|
||||
register: wildcard_2
|
||||
|
@ -415,6 +421,7 @@
|
|||
ansible.test.1: hello
|
||||
ansible.test.2: world
|
||||
ansible.test.3: ansible
|
||||
force_kill: yes
|
||||
comparisons:
|
||||
'*': strict
|
||||
register: wildcard_3
|
||||
|
@ -431,6 +438,7 @@
|
|||
ansible.test.1: hello
|
||||
ansible.test.2: world
|
||||
ansible.test.3: ansible
|
||||
force_kill: yes
|
||||
comparisons:
|
||||
'*': strict
|
||||
register: wildcard_4
|
||||
|
@ -439,7 +447,7 @@
|
|||
docker_container:
|
||||
name: "{{ cname }}"
|
||||
state: absent
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
image: "{{ image_facts.images[0].Id }}"
|
||||
name: "{{ cname }}"
|
||||
state: present
|
||||
force_kill: yes
|
||||
register: create_1
|
||||
|
||||
- name: Create container with hello-world image via ID (idempotent)
|
||||
|
@ -41,6 +42,7 @@
|
|||
image: "{{ image_facts.images[0].Id }}"
|
||||
name: "{{ cname }}"
|
||||
state: present
|
||||
force_kill: yes
|
||||
register: create_2
|
||||
|
||||
- name: Create container with alpine image via ID
|
||||
|
@ -48,6 +50,7 @@
|
|||
image: "{{ image_facts.images[1].Id }}"
|
||||
name: "{{ cname }}"
|
||||
state: present
|
||||
force_kill: yes
|
||||
register: create_3
|
||||
|
||||
- name: Create container with alpine image via ID (idempotent)
|
||||
|
@ -55,13 +58,14 @@
|
|||
image: "{{ image_facts.images[1].Id }}"
|
||||
name: "{{ cname }}"
|
||||
state: present
|
||||
force_kill: yes
|
||||
register: create_4
|
||||
|
||||
- name: Cleanup
|
||||
docker_container:
|
||||
name: "{{ cname }}"
|
||||
state: absent
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -18,7 +18,7 @@
|
|||
- 8081
|
||||
published_ports:
|
||||
- all
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
register: published_ports_1
|
||||
|
||||
- name: published_ports -- all (idempotency)
|
||||
|
@ -32,7 +32,7 @@
|
|||
- 8081
|
||||
published_ports:
|
||||
- all
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
register: published_ports_2
|
||||
|
||||
- name: published_ports -- all (writing out 'all')
|
||||
|
@ -47,7 +47,7 @@
|
|||
published_ports:
|
||||
- 8080
|
||||
- 8081
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
register: published_ports_3
|
||||
|
||||
- name: published_ports -- all (idempotency 2)
|
||||
|
@ -62,7 +62,7 @@
|
|||
published_ports:
|
||||
- 8080
|
||||
- 8081
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
register: published_ports_4
|
||||
|
||||
- name: published_ports -- all (switching back to 'all')
|
||||
|
@ -76,14 +76,14 @@
|
|||
- 8081
|
||||
published_ports:
|
||||
- all
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
register: published_ports_5
|
||||
|
||||
- name: cleanup
|
||||
docker_container:
|
||||
name: "{{ cname }}"
|
||||
state: absent
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
|
@ -109,7 +109,7 @@
|
|||
published_ports:
|
||||
- 8080:8080
|
||||
- 5000-5040:5000-5040
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
register: published_ports_1
|
||||
|
||||
- name: published_ports -- port range (idempotency)
|
||||
|
@ -124,7 +124,7 @@
|
|||
published_ports:
|
||||
- 8080:8080
|
||||
- 5000-5040:5000-5040
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
register: published_ports_2
|
||||
|
||||
- name: published_ports -- port range (different range)
|
||||
|
@ -139,14 +139,14 @@
|
|||
published_ports:
|
||||
- 8080:8080
|
||||
- 5010-5050:5010-5050
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
register: published_ports_3
|
||||
|
||||
- name: cleanup
|
||||
docker_container:
|
||||
name: "{{ cname }}"
|
||||
state: absent
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
|
@ -166,7 +166,7 @@
|
|||
state: started
|
||||
published_ports:
|
||||
- "[::1]:8080:8080"
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
register: published_ports_1
|
||||
|
||||
- name: published_ports -- IPv6 (idempotency)
|
||||
|
@ -177,7 +177,7 @@
|
|||
state: started
|
||||
published_ports:
|
||||
- "[::1]:8080:8080"
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
register: published_ports_2
|
||||
|
||||
- name: published_ports -- IPv6 (different IP)
|
||||
|
@ -188,7 +188,7 @@
|
|||
state: started
|
||||
published_ports:
|
||||
- 127.0.0.1:8080:8080
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
register: published_ports_3
|
||||
|
||||
- name: published_ports -- IPv6 (hostname)
|
||||
|
@ -199,7 +199,7 @@
|
|||
state: started
|
||||
published_ports:
|
||||
- localhost:8080:8080
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
register: published_ports_4
|
||||
ignore_errors: yes
|
||||
|
||||
|
@ -207,7 +207,7 @@
|
|||
docker_container:
|
||||
name: "{{ cname }}"
|
||||
state: absent
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
- name: Stop container with a lot of invalid options
|
||||
docker_container:
|
||||
name: "{{ cname }}"
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
# Some options with "invalid" values, which would
|
||||
# have to be parsed. The values are "invalid" because
|
||||
# the containers and networks listed here do not exist.
|
||||
|
|
|
@ -122,12 +122,13 @@
|
|||
docker_container:
|
||||
name: "{{ cname }}"
|
||||
state: absent
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
|
||||
- name: Start container from scratch (check)
|
||||
docker_container:
|
||||
image: alpine:3.8
|
||||
command: '/bin/sh -c "sleep 10m"'
|
||||
stop_timeout: 1
|
||||
name: "{{ cname }}"
|
||||
state: started
|
||||
check_mode: yes
|
||||
|
@ -137,6 +138,7 @@
|
|||
docker_container:
|
||||
image: alpine:3.8
|
||||
command: '/bin/sh -c "sleep 10m"'
|
||||
stop_timeout: 1
|
||||
name: "{{ cname }}"
|
||||
state: started
|
||||
register: start_scratch_2
|
||||
|
@ -145,6 +147,7 @@
|
|||
docker_container:
|
||||
image: alpine:3.8
|
||||
command: '/bin/sh -c "sleep 10m"'
|
||||
stop_timeout: 1
|
||||
name: "{{ cname }}"
|
||||
state: started
|
||||
register: start_scratch_3
|
||||
|
@ -153,6 +156,7 @@
|
|||
docker_container:
|
||||
image: alpine:3.8
|
||||
command: '/bin/sh -c "sleep 10m"'
|
||||
stop_timeout: 1
|
||||
name: "{{ cname }}"
|
||||
state: started
|
||||
check_mode: yes
|
||||
|
@ -262,7 +266,7 @@
|
|||
docker_container:
|
||||
name: "{{ cname }}"
|
||||
state: absent
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
check_mode: yes
|
||||
register: remove_from_running_1
|
||||
|
||||
|
@ -270,21 +274,21 @@
|
|||
docker_container:
|
||||
name: "{{ cname }}"
|
||||
state: absent
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
register: remove_from_running_2
|
||||
|
||||
- name: Remove container from running (idempotent)
|
||||
docker_container:
|
||||
name: "{{ cname }}"
|
||||
state: absent
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
register: remove_from_running_3
|
||||
|
||||
- name: Remove container from running (idempotent check)
|
||||
docker_container:
|
||||
name: "{{ cname }}"
|
||||
state: absent
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
check_mode: yes
|
||||
register: remove_from_running_4
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
docker_container:
|
||||
name: "{{ cname }}"
|
||||
state: absent
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
|
||||
- name: Inspect a non-present container
|
||||
docker_container_facts:
|
||||
|
@ -28,7 +28,7 @@
|
|||
command: '/bin/sh -c "sleep 10m"'
|
||||
state: started
|
||||
auto_remove: yes
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
|
||||
- name: Inspect a present container
|
||||
docker_container_facts:
|
||||
|
@ -49,7 +49,7 @@
|
|||
docker_container:
|
||||
name: "{{ cname }}"
|
||||
state: absent
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
docker_container:
|
||||
name: "{{ item }}"
|
||||
state: absent
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
with_items: "{{ cnames }}"
|
||||
|
||||
# Skip for CentOS 6
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
docker_container:
|
||||
name: "{{ item }}"
|
||||
state: absent
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
loop: "{{ cnames }}"
|
||||
- name: "Make sure all networks are removed"
|
||||
docker_network:
|
||||
|
|
|
@ -125,7 +125,7 @@
|
|||
docker_container:
|
||||
name: "{{ container_name }}"
|
||||
state: absent
|
||||
stop_timeout: 1
|
||||
force_kill: yes
|
||||
loop:
|
||||
- "{{ cname_1 }}"
|
||||
- "{{ cname_2 }}"
|
||||
|
|
Loading…
Reference in a new issue