community.docker/tests/integration/targets/docker_image/tasks/tests/basic.yml
Felix Fontein a4539a309e
Move licenses to LICENSES/, use SPDX-License-Identifier, mention all licenses in galaxy.yml (#430)
* Move licenses to LICENSES/, use SPDX-License-Identifier, mention all licenses in galaxy.yml.

* ignore.txt lines cannot be empty or contain only a comment.

* Cleanup.

* This particular __init__.py seems to be crucial.

* Try extra newline.

* Markdown comments are a real mess. I hope this won't break Galaxy...

* More licenses.

* Add sanity test.

* Skip some files, lint.

* Make sure there is a copyright line everywhere.

* Also check for copyright line in sanity tests.

* Remove colon after 'Copyright'.

* Normalize lint script.

* Avoid colon after 'Copyright' in lint script.

* Improve license checker.

* Update README.md

Co-authored-by: Maxwell G <9920591+gotmax23@users.noreply.github.com>

* Remove superfluous space.

* Referencing target instead of symlink

Co-authored-by: Maxwell G <9920591+gotmax23@users.noreply.github.com>
2022-07-20 07:45:33 +02:00

140 lines
3.5 KiB
YAML

---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
####################################################################
## basic ###########################################################
####################################################################
- name: Make sure image is not there
docker_image:
name: "{{ docker_test_image_hello_world }}"
state: absent
force_absent: yes
register: absent_1
- name: Make sure image is not there (idempotency)
docker_image:
name: "{{ docker_test_image_hello_world }}"
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 }}"
state: present
source: pull
pull:
platform: amd64
register: present_1
- name: Make sure image is there (idempotent)
docker_image:
name: "{{ docker_test_image_hello_world }}"
state: present
source: pull
pull:
platform: amd64
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_base }}:alias"
state: absent
- name: Tag image with alias
docker_image:
source: local
name: "{{ docker_test_image_hello_world }}"
repository: "{{ docker_test_image_hello_world_base }}:alias"
register: tag_1
- name: Tag image with alias (idempotent)
docker_image:
source: local
name: "{{ docker_test_image_hello_world }}"
repository: "{{ docker_test_image_hello_world_base }}:alias"
register: tag_2
- name: Tag image with alias (force, still idempotent)
docker_image:
source: local
name: "{{ docker_test_image_hello_world }}"
repository: "{{ docker_test_image_hello_world_base }}:alias"
force_tag: yes
register: tag_3
- name: Tag image with ID instead of name
docker_image:
source: local
name: "{{ present_1.image.Id }}"
repository: "{{ docker_test_image_hello_world_base }}:alias"
register: tag_4
- assert:
that:
- tag_1 is changed
- tag_2 is not changed
- tag_3 is not changed
- tag_4 is not changed
- name: Cleanup alias tag
docker_image:
name: "{{ docker_test_image_hello_world_base }}:alias"
state: absent
- name: Tag image with ID instead of name (use ID for repository, must fail)
docker_image:
source: local
name: "{{ docker_test_image_hello_world }}"
repository: "{{ present_1.image.Id }}"
register: fail_1
ignore_errors: true
- name: Push image with ID (must fail)
docker_image:
source: local
name: "{{ present_1.image.Id }}"
push: true
register: fail_2
ignore_errors: true
- name: Pull image ID (must fail)
docker_image:
source: pull
name: "{{ present_1.image.Id }}"
force_source: true
register: fail_3
ignore_errors: true
- name: buildargs
docker_image:
source: build
name: "{{ present_1.image.Id }}"
build:
path: "{{ remote_tmp_dir }}/files"
force_source: true
register: fail_4
ignore_errors: yes
- assert:
that:
- fail_1 is failed
- "'`repository` must not be an image ID' in fail_1.msg"
- fail_2 is failed
- "'Cannot push an image by ID' in fail_2.msg"
- fail_3 is failed
- "'Image name must not be an image ID for source=pull' in fail_3.msg"
- fail_4 is failed
- "'Image name must not be an image ID for source=build' in fail_4.msg"