Fix idempotency of docker_compose_v2_pull. (#814)

This commit is contained in:
Felix Fontein
2024-03-13 13:20:11 +01:00
committed by GitHub
parent 6600f501ae
commit 4bab9a6b0e
5 changed files with 33 additions and 18 deletions
@@ -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