1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/tests/integration/targets/docker_image/tasks/tests/basic.yml

79 lines
2 KiB
YAML
Raw Normal View History

2020-03-09 10:11:07 +01:00
---
####################################################################
## basic ###########################################################
####################################################################
- name: Make sure image is not there
docker_image:
name: "{{ docker_test_image_hello_world }}:latest"
2020-03-09 10:11:07 +01:00
state: absent
force_absent: yes
register: absent_1
- name: Make sure image is not there (idempotency)
docker_image:
name: "{{ docker_test_image_hello_world }}:latest"
2020-03-09 10:11:07 +01:00
state: absent
register: absent_2
- assert:
that:
- absent_2 is not changed
- name: Make sure image is there
docker_image:
name: "{{ docker_test_image_hello_world }}:latest"
2020-03-09 10:11:07 +01:00
state: present
source: pull
register: present_1
- name: Make sure image is there (idempotent)
docker_image:
name: "{{ docker_test_image_hello_world }}:latest"
2020-03-09 10:11:07 +01:00
state: present
source: pull
register: present_2
- assert:
that:
- present_1 is changed
- present_2 is not changed
- name: Make sure tag is not there
docker_image:
name: "{{ docker_test_image_hello_world }}:alias"
2020-03-09 10:11:07 +01:00
state: absent
- name: Tag image with alias
docker_image:
source: local
name: "{{ docker_test_image_hello_world }}:latest"
repository: "{{ docker_test_image_hello_world }}:alias"
2020-03-09 10:11:07 +01:00
register: tag_1
- name: Tag image with alias (idempotent)
docker_image:
source: local
name: "{{ docker_test_image_hello_world }}:latest"
repository: "{{ docker_test_image_hello_world }}:alias"
2020-03-09 10:11:07 +01:00
register: tag_2
- name: Tag image with alias (force, still idempotent)
docker_image:
source: local
name: "{{ docker_test_image_hello_world }}:latest"
repository: "{{ docker_test_image_hello_world }}:alias"
2020-03-09 10:11:07 +01:00
force_tag: yes
register: tag_3
- assert:
that:
- tag_1 is changed
- tag_2 is not changed
- tag_3 is not changed
- name: Cleanup alias tag
docker_image:
name: "{{ docker_test_image_hello_world }}:alias"
2020-03-09 10:11:07 +01:00
state: absent