mirror of
https://github.com/ansible-collections/community.docker.git
synced 2026-03-15 19:58:28 +00:00
Adjust load tests.
This commit is contained in:
parent
44a1dd33c2
commit
e1f8c40273
@ -73,11 +73,17 @@
|
||||
loop: "{{ all_images }}"
|
||||
when: remove_all_images is failed
|
||||
|
||||
- name: Show all images
|
||||
ansible.builtin.command: docker image ls
|
||||
|
||||
- name: Load all images (IDs)
|
||||
community.docker.docker_image_load:
|
||||
path: "{{ remote_tmp_dir }}/archive-2.tar"
|
||||
register: result
|
||||
|
||||
- name: Show all images
|
||||
ansible.builtin.command: docker image ls
|
||||
|
||||
- name: Print loaded image names
|
||||
ansible.builtin.debug:
|
||||
var: result.image_names
|
||||
@ -110,11 +116,17 @@
|
||||
name: "{{ item }}"
|
||||
loop: "{{ all_images }}"
|
||||
|
||||
- name: Show all images
|
||||
ansible.builtin.command: docker image ls
|
||||
|
||||
- name: Load all images (mixed images and IDs)
|
||||
community.docker.docker_image_load:
|
||||
path: "{{ remote_tmp_dir }}/archive-3.tar"
|
||||
register: result
|
||||
|
||||
- name: Show all images
|
||||
ansible.builtin.command: docker image ls
|
||||
|
||||
- name: Print loading log
|
||||
ansible.builtin.debug:
|
||||
var: result.stdout_lines
|
||||
@ -127,10 +139,14 @@
|
||||
that:
|
||||
- result is changed
|
||||
# For some reason, *sometimes* only the named image is found; in fact, in that case, the log only mentions that image and nothing else
|
||||
- "result.images | length == 3 or ('Loaded image: ' ~ docker_test_image_hello_world) == result.stdout"
|
||||
- (result.image_names | sort) in [[image_names[0], image_ids[0], image_ids[1]] | sort, [image_names[0]]]
|
||||
- result.images | length in [1, 3]
|
||||
- (result.images | map(attribute='Id') | sort) in [[image_ids[0], image_ids[0], image_ids[1]] | sort, [image_ids[0]]]
|
||||
# With Docker 29, a third possibility appears: just two entries.
|
||||
- >-
|
||||
result.images | length == 3
|
||||
or ('Loaded image: ' ~ docker_test_image_hello_world) == result.stdout
|
||||
or result.images | length == 2
|
||||
- (result.image_names | sort) in [[image_names[0], image_ids[0], image_ids[1]] | sort, [image_names[0], image_ids[1]] | sort, [image_names[0]]]
|
||||
- result.images | length in [1, 2, 3]
|
||||
- (result.images | map(attribute='Id') | sort) in [[image_ids[0], image_ids[0], image_ids[1]] | sort, [image_ids[0], image_ids[1]] | sort, [image_ids[0]]]
|
||||
|
||||
# Same image twice
|
||||
|
||||
@ -139,11 +155,17 @@
|
||||
name: "{{ item }}"
|
||||
loop: "{{ all_images }}"
|
||||
|
||||
- name: Show all images
|
||||
ansible.builtin.command: docker image ls
|
||||
|
||||
- name: Load all images (same image twice)
|
||||
community.docker.docker_image_load:
|
||||
path: "{{ remote_tmp_dir }}/archive-4.tar"
|
||||
register: result
|
||||
|
||||
- name: Show all images
|
||||
ansible.builtin.command: docker image ls
|
||||
|
||||
- name: Print loaded image names
|
||||
ansible.builtin.debug:
|
||||
var: result.image_names
|
||||
@ -151,10 +173,11 @@
|
||||
- ansible.builtin.assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.image_names | length == 1
|
||||
- result.image_names[0] == image_names[0]
|
||||
- result.images | length == 1
|
||||
- result.image_names | length in [1, 2]
|
||||
- (result.image_names | sort) in [[image_names[0]], [image_names[0], image_ids[0]] | sort]
|
||||
- result.images | length in [1, 2]
|
||||
- result.images[0].Id == image_ids[0]
|
||||
- result.images[1].Id | default(image_ids[0]) == image_ids[0]
|
||||
|
||||
# Single image by ID
|
||||
|
||||
@ -163,11 +186,17 @@
|
||||
name: "{{ item }}"
|
||||
loop: "{{ all_images }}"
|
||||
|
||||
- name: Show all images
|
||||
ansible.builtin.command: docker image ls
|
||||
|
||||
- name: Load all images (single image by ID)
|
||||
community.docker.docker_image_load:
|
||||
path: "{{ remote_tmp_dir }}/archive-5.tar"
|
||||
register: result
|
||||
|
||||
- name: Show all images
|
||||
ansible.builtin.command: docker image ls
|
||||
|
||||
- name: Print loaded image names
|
||||
ansible.builtin.debug:
|
||||
var: result.image_names
|
||||
@ -197,11 +226,17 @@
|
||||
name: "{{ item }}"
|
||||
loop: "{{ all_images }}"
|
||||
|
||||
- name: Show all images
|
||||
ansible.builtin.command: docker image ls
|
||||
|
||||
- name: Load all images (names)
|
||||
community.docker.docker_image_load:
|
||||
path: "{{ remote_tmp_dir }}/archive-1.tar"
|
||||
register: result
|
||||
|
||||
- name: Show all images
|
||||
ansible.builtin.command: docker image ls
|
||||
|
||||
- name: Print loaded image names
|
||||
ansible.builtin.debug:
|
||||
var: result.image_names
|
||||
|
||||
Loading…
Reference in New Issue
Block a user