mirror of
https://github.com/ansible-collections/community.docker.git
synced 2026-07-29 11:55:04 +00:00
Fix idempotency of docker_compose_v2_pull. (#814)
This commit is contained in:
@@ -105,6 +105,10 @@
|
||||
policy: missing
|
||||
register: pull_2
|
||||
|
||||
- name: Make sure image is not around
|
||||
docker_image_remove:
|
||||
name: '{{ docker_test_image_alpine }}'
|
||||
|
||||
- name: Pull with policy=always (check)
|
||||
docker_compose_v2_pull:
|
||||
project_src: '{{ project_src }}'
|
||||
@@ -118,26 +122,35 @@
|
||||
policy: always
|
||||
register: pull_3
|
||||
|
||||
- name: Pull with policy=always (check, idempotent)
|
||||
docker_compose_v2_pull:
|
||||
project_src: '{{ project_src }}'
|
||||
policy: always
|
||||
check_mode: true
|
||||
register: pull_4_check
|
||||
|
||||
- name: Pull with policy=always (idempotent)
|
||||
docker_compose_v2_pull:
|
||||
project_src: '{{ project_src }}'
|
||||
policy: always
|
||||
register: pull_4
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- pull_1_check is changed
|
||||
- pull_1_check.actions | selectattr('status', 'eq', 'Pulling') | first
|
||||
- pull_1_check.actions | selectattr('status', 'eq', 'Creating') | length == 0
|
||||
- pull_1_check.actions | selectattr('status', 'eq', 'Recreating') | length == 0
|
||||
- pull_1 is changed
|
||||
- pull_1.actions | selectattr('status', 'eq', 'Pulling') | first
|
||||
- pull_1.actions | selectattr('status', 'eq', 'Creating') | length == 0
|
||||
- pull_1.actions | selectattr('status', 'eq', 'Recreating') | length == 0
|
||||
- pull_2_check is not changed
|
||||
- pull_2 is not changed
|
||||
- pull_3_check is changed
|
||||
- pull_3_check.actions | selectattr('status', 'eq', 'Pulling') | first
|
||||
- pull_3_check.actions | selectattr('status', 'eq', 'Creating') | length == 0
|
||||
- pull_3_check.actions | selectattr('status', 'eq', 'Recreating') | length == 0
|
||||
- pull_3 is changed
|
||||
- pull_3.actions | selectattr('status', 'eq', 'Pulling') | first
|
||||
- pull_3.actions | selectattr('status', 'eq', 'Creating') | length == 0
|
||||
- pull_3.actions | selectattr('status', 'eq', 'Recreating') | length == 0
|
||||
- pull_4_check is changed
|
||||
- pull_4_check.actions | selectattr('status', 'eq', 'Pulling') | first
|
||||
- pull_4 is not changed
|
||||
- pull_4.actions | selectattr('status', 'eq', 'Pulling') | first
|
||||
|
||||
- when: docker_compose_version is version('2.22.0', '<')
|
||||
block:
|
||||
@@ -171,17 +184,9 @@
|
||||
that:
|
||||
- pull_1_check is changed
|
||||
- pull_1_check.actions | selectattr('status', 'eq', 'Pulling') | first
|
||||
- pull_1_check.actions | selectattr('status', 'eq', 'Creating') | length == 0
|
||||
- pull_1_check.actions | selectattr('status', 'eq', 'Recreating') | length == 0
|
||||
- pull_1 is changed
|
||||
- pull_1.actions | selectattr('status', 'eq', 'Pulling') | first
|
||||
- pull_1.actions | selectattr('status', 'eq', 'Creating') | length == 0
|
||||
- pull_1.actions | selectattr('status', 'eq', 'Recreating') | length == 0
|
||||
- pull_2_check is changed
|
||||
- pull_2_check.actions | selectattr('status', 'eq', 'Pulling') | first
|
||||
- pull_2_check.actions | selectattr('status', 'eq', 'Creating') | length == 0
|
||||
- pull_2_check.actions | selectattr('status', 'eq', 'Recreating') | length == 0
|
||||
- pull_2 is changed
|
||||
- pull_2 is not changed
|
||||
- pull_2.actions | selectattr('status', 'eq', 'Pulling') | first
|
||||
- pull_2.actions | selectattr('status', 'eq', 'Creating') | length == 0
|
||||
- pull_2.actions | selectattr('status', 'eq', 'Recreating') | length == 0
|
||||
|
||||
Reference in New Issue
Block a user