summaryrefslogtreecommitdiff
path: root/test/integration/targets/docker_image
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration/targets/docker_image')
-rw-r--r--test/integration/targets/docker_image/aliases5
-rw-r--r--test/integration/targets/docker_image/files/Dockerfile3
-rw-r--r--test/integration/targets/docker_image/files/EtcHostsDockerfile3
-rw-r--r--test/integration/targets/docker_image/files/MyDockerfile5
-rw-r--r--test/integration/targets/docker_image/files/StagedDockerfile7
-rw-r--r--test/integration/targets/docker_image/meta/main.yml3
-rw-r--r--test/integration/targets/docker_image/tasks/main.yml3
-rw-r--r--test/integration/targets/docker_image/tasks/run-test.yml3
-rw-r--r--test/integration/targets/docker_image/tasks/test.yml34
-rw-r--r--test/integration/targets/docker_image/tasks/tests/basic.yml78
-rw-r--r--test/integration/targets/docker_image/tasks/tests/docker_image.yml152
-rw-r--r--test/integration/targets/docker_image/tasks/tests/old-options.yml48
-rw-r--r--test/integration/targets/docker_image/tasks/tests/options.yml300
13 files changed, 0 insertions, 644 deletions
diff --git a/test/integration/targets/docker_image/aliases b/test/integration/targets/docker_image/aliases
deleted file mode 100644
index 1187e123f1..0000000000
--- a/test/integration/targets/docker_image/aliases
+++ /dev/null
@@ -1,5 +0,0 @@
-shippable/posix/group5
-skip/aix
-skip/osx
-skip/freebsd
-destructive
diff --git a/test/integration/targets/docker_image/files/Dockerfile b/test/integration/targets/docker_image/files/Dockerfile
deleted file mode 100644
index c2951375fa..0000000000
--- a/test/integration/targets/docker_image/files/Dockerfile
+++ /dev/null
@@ -1,3 +0,0 @@
-FROM busybox
-ENV foo /bar
-WORKDIR ${foo}
diff --git a/test/integration/targets/docker_image/files/EtcHostsDockerfile b/test/integration/targets/docker_image/files/EtcHostsDockerfile
deleted file mode 100644
index 2dc01fadaa..0000000000
--- a/test/integration/targets/docker_image/files/EtcHostsDockerfile
+++ /dev/null
@@ -1,3 +0,0 @@
-FROM busybox
-# This should fail building if docker cannot resolve some-custom-host
-RUN ping -c1 some-custom-host
diff --git a/test/integration/targets/docker_image/files/MyDockerfile b/test/integration/targets/docker_image/files/MyDockerfile
deleted file mode 100644
index 605e8e0f8a..0000000000
--- a/test/integration/targets/docker_image/files/MyDockerfile
+++ /dev/null
@@ -1,5 +0,0 @@
-FROM alpine:3.7
-ENV INSTALL_PATH /newdata
-RUN mkdir -p $INSTALL_PATH
-
-WORKDIR $INSTALL_PATH
diff --git a/test/integration/targets/docker_image/files/StagedDockerfile b/test/integration/targets/docker_image/files/StagedDockerfile
deleted file mode 100644
index ebc4df42f0..0000000000
--- a/test/integration/targets/docker_image/files/StagedDockerfile
+++ /dev/null
@@ -1,7 +0,0 @@
-FROM busybox AS first
-ENV dir /first
-WORKDIR ${dir}
-
-FROM busybox AS second
-ENV dir /second
-WORKDIR ${dir}
diff --git a/test/integration/targets/docker_image/meta/main.yml b/test/integration/targets/docker_image/meta/main.yml
deleted file mode 100644
index 21d7a58f93..0000000000
--- a/test/integration/targets/docker_image/meta/main.yml
+++ /dev/null
@@ -1,3 +0,0 @@
----
-dependencies:
- - setup_docker_registry
diff --git a/test/integration/targets/docker_image/tasks/main.yml b/test/integration/targets/docker_image/tasks/main.yml
deleted file mode 100644
index 3b4f9357a6..0000000000
--- a/test/integration/targets/docker_image/tasks/main.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-- when: ansible_facts.distribution ~ ansible_facts.distribution_major_version not in ['CentOS6', 'RedHat6']
- include_tasks:
- file: test.yml
diff --git a/test/integration/targets/docker_image/tasks/run-test.yml b/test/integration/targets/docker_image/tasks/run-test.yml
deleted file mode 100644
index a299937014..0000000000
--- a/test/integration/targets/docker_image/tasks/run-test.yml
+++ /dev/null
@@ -1,3 +0,0 @@
----
-- name: "Loading tasks from {{ item }}"
- include_tasks: "{{ item }}"
diff --git a/test/integration/targets/docker_image/tasks/test.yml b/test/integration/targets/docker_image/tasks/test.yml
deleted file mode 100644
index 47c629860b..0000000000
--- a/test/integration/targets/docker_image/tasks/test.yml
+++ /dev/null
@@ -1,34 +0,0 @@
----
-- name: Create random name prefix
- set_fact:
- name_prefix: "{{ 'ansible-test-%0x' % ((2**32) | random) }}"
-- name: Create image and container list
- set_fact:
- inames: []
- cnames: []
-
-- debug:
- msg: "Using name prefix {{ name_prefix }}"
-
-- block:
- - include_tasks: run-test.yml
- with_fileglob:
- - "tests/*.yml"
-
- always:
- - name: "Make sure all images are removed"
- docker_image:
- name: "{{ item }}"
- state: absent
- with_items: "{{ inames }}"
- - name: "Make sure all containers are removed"
- docker_container:
- name: "{{ item }}"
- state: absent
- force_kill: yes
- with_items: "{{ cnames }}"
-
- when: docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.20', '>=')
-
-- fail: msg="Too old docker / docker-py version to run docker_image tests!"
- when: not(docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.20', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
diff --git a/test/integration/targets/docker_image/tasks/tests/basic.yml b/test/integration/targets/docker_image/tasks/tests/basic.yml
deleted file mode 100644
index 6f0bdd6935..0000000000
--- a/test/integration/targets/docker_image/tasks/tests/basic.yml
+++ /dev/null
@@ -1,78 +0,0 @@
----
-####################################################################
-## basic ###########################################################
-####################################################################
-
-- name: Make sure image is not there
- docker_image:
- name: "hello-world:latest"
- state: absent
- force_absent: yes
- register: absent_1
-
-- name: Make sure image is not there (idempotency)
- docker_image:
- name: "hello-world:latest"
- state: absent
- register: absent_2
-
-- assert:
- that:
- - absent_2 is not changed
-
-- name: Make sure image is there
- docker_image:
- name: "hello-world:latest"
- state: present
- source: pull
- register: present_1
-
-- name: Make sure image is there (idempotent)
- docker_image:
- name: "hello-world:latest"
- 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: "hello-world:alias"
- state: absent
-
-- name: Tag image with alias
- docker_image:
- source: local
- name: "hello-world:latest"
- repository: "hello-world:alias"
- register: tag_1
-
-- name: Tag image with alias (idempotent)
- docker_image:
- source: local
- name: "hello-world:latest"
- repository: "hello-world:alias"
- register: tag_2
-
-- name: Tag image with alias (force, still idempotent)
- docker_image:
- source: local
- name: "hello-world:latest"
- repository: "hello-world:alias"
- 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: "hello-world:alias"
- state: absent
diff --git a/test/integration/targets/docker_image/tasks/tests/docker_image.yml b/test/integration/targets/docker_image/tasks/tests/docker_image.yml
deleted file mode 100644
index 1959446aa5..0000000000
--- a/test/integration/targets/docker_image/tasks/tests/docker_image.yml
+++ /dev/null
@@ -1,152 +0,0 @@
----
-- name: Registering image name
- set_fact:
- iname: "{{ name_prefix ~ '-options' }}"
-
-- name: Determining pushed image names
- set_fact:
- hello_world_image_base: "{{ registry_address }}/test/hello-world"
- test_image_base: "{{ registry_address }}/test/{{ iname }}"
-
-- name: Registering image name
- set_fact:
- inames: "{{ inames + [iname, test_image_base ~ ':latest', hello_world_image_base ~ ':latest'] }}"
-
-####################################################################
-## interact with test registry #####################################
-####################################################################
-
-- name: Make sure image is not there
- docker_image:
- name: "{{ hello_world_image_base }}:latest"
- state: absent
- force_absent: yes
-
-- name: Make sure we have hello-world:latest
- docker_image:
- name: hello-world:latest
- source: pull
-
-- name: Push image to test registry
- docker_image:
- name: "hello-world:latest"
- repository: "{{ hello_world_image_base }}"
- push: yes
- source: local
- register: push_1
-
-- name: Push image to test registry (idempotent)
- docker_image:
- name: "hello-world:latest"
- repository: "{{ hello_world_image_base }}"
- push: yes
- source: local
- register: push_2
-
-- name: Push image to test registry (force, still idempotent)
- docker_image:
- name: "hello-world:latest"
- repository: "{{ hello_world_image_base }}"
- push: yes
- source: local
- force_tag: yes
- register: push_3
-
-- assert:
- that:
- - push_1 is changed
- - push_2 is not changed
- - push_3 is not changed
-
-- name: Get facts of local image
- docker_image_info:
- name: "{{ hello_world_image_base }}:latest"
- register: facts_1
-
-- name: Make sure image is not there
- docker_image:
- name: "{{ hello_world_image_base }}:latest"
- state: absent
- force_absent: yes
-
-- name: Get facts of local image (absent)
- docker_image_info:
- name: "{{ hello_world_image_base }}:latest"
- register: facts_2
-
-- name: Pull image from test registry
- docker_image:
- name: "{{ hello_world_image_base }}:latest"
- state: present
- source: pull
- register: pull_1
-
-- name: Pull image from test registry (idempotency)
- docker_image:
- name: "{{ hello_world_image_base }}:latest"
- state: present
- source: pull
- register: pull_2
-
-- name: Get facts of local image (present)
- docker_image_info:
- name: "{{ hello_world_image_base }}:latest"
- register: facts_3
-
-- assert:
- that:
- - pull_1 is changed
- - pull_2 is not changed
- - facts_1.images | length == 1
- - facts_2.images | length == 0
- - facts_3.images | length == 1
-
-####################################################################
-## repository ######################################################
-####################################################################
-
-- name: Make sure image is not there
- docker_image:
- name: "{{ test_image_base }}:latest"
- state: absent
- force_absent: yes
-
-- name: repository
- docker_image:
- name: "{{ iname }}"
- build:
- path: "{{ role_path }}/files"
- pull: no
- repository: "{{ test_image_base }}"
- source: build
- register: repository_1
-
-- name: repository (idempotent)
- docker_image:
- name: "{{ iname }}"
- build:
- path: "{{ role_path }}/files"
- pull: no
- repository: "{{ test_image_base }}"
- source: build
- register: repository_2
-
-- assert:
- that:
- - repository_1 is changed
- - repository_2 is not changed
-
-- name: Get facts of image
- docker_image_info:
- name: "{{ test_image_base }}:latest"
- register: facts_1
-
-- name: cleanup
- docker_image:
- name: "{{ test_image_base }}:latest"
- state: absent
- force_absent: yes
-
-- assert:
- that:
- - facts_1.images | length == 1
diff --git a/test/integration/targets/docker_image/tasks/tests/old-options.yml b/test/integration/targets/docker_image/tasks/tests/old-options.yml
deleted file mode 100644
index 5824a56d1f..0000000000
--- a/test/integration/targets/docker_image/tasks/tests/old-options.yml
+++ /dev/null
@@ -1,48 +0,0 @@
----
-- name: Registering image name
- set_fact:
- iname: "{{ name_prefix ~ '-old-options' }}"
-
-- name: Registering image name
- set_fact:
- inames: "{{ inames + [iname]}}"
-
-####################################################################
-## build ###########################################################
-####################################################################
-
-- name: build with old-style options
- docker_image:
- name: "{{ iname }}"
- path: "{{ role_path }}/files"
- dockerfile: Dockerfile
- http_timeout: 60
- nocache: yes
- pull: no
- rm: no
- buildargs:
- TEST1: val1
- TEST2: val2
- TEST3: "True"
- container_limits:
- memory: 5000000
- memswap: 7000000
- source: build
- register: build
-
-- name: cleanup
- docker_image:
- name: "{{ iname }}"
- state: absent
- force_absent: yes
-
-- assert:
- that:
- - '"Please specify build.container_limits instead of container_limits. The container_limits option has been renamed and will be removed in Ansible 2.12." in build.warnings'
- - '"Please specify build.dockerfile instead of dockerfile. The dockerfile option has been renamed and will be removed in Ansible 2.12." in build.warnings'
- - '"Please specify build.http_timeout instead of http_timeout. The http_timeout option has been renamed and will be removed in Ansible 2.12." in build.warnings'
- - '"Please specify build.nocache instead of nocache. The nocache option has been renamed and will be removed in Ansible 2.12." in build.warnings'
- - '"Please specify build.path instead of path. The path option has been renamed and will be removed in Ansible 2.12." in build.warnings'
- - '"Please specify build.pull instead of pull. The pull option has been renamed and will be removed in Ansible 2.12." in build.warnings'
- - '"Please specify build.rm instead of rm. The rm option has been renamed and will be removed in Ansible 2.12." in build.warnings'
- - '"Please specify build.args instead of buildargs. The buildargs option has been renamed and will be removed in Ansible 2.12." in build.warnings'
diff --git a/test/integration/targets/docker_image/tasks/tests/options.yml b/test/integration/targets/docker_image/tasks/tests/options.yml
deleted file mode 100644
index f21bbda910..0000000000
--- a/test/integration/targets/docker_image/tasks/tests/options.yml
+++ /dev/null
@@ -1,300 +0,0 @@
----
-- name: Registering image name
- set_fact:
- iname: "{{ name_prefix ~ '-options' }}"
- iname_1: "{{ name_prefix ~ '-options-1' }}"
-
-- name: Registering image name
- set_fact:
- inames: "{{ inames + [iname, iname_1] }}"
-
-####################################################################
-## build.args ######################################################
-####################################################################
-
-- name: cleanup
- docker_image:
- name: "{{ iname }}"
- state: absent
- force_absent: yes
-
-- name: buildargs
- docker_image:
- name: "{{ iname }}"
- build:
- path: "{{ role_path }}/files"
- args:
- TEST1: val1
- TEST2: val2
- TEST3: "True"
- pull: no
- source: build
- register: buildargs_1
-
-- name: buildargs (idempotency)
- docker_image:
- name: "{{ iname }}"
- build:
- path: "{{ role_path }}/files"
- args:
- TEST1: val1
- TEST2: val2
- TEST3: "True"
- pull: no
- source: build
- register: buildargs_2
-
-- name: cleanup
- docker_image:
- name: "{{ iname }}"
- state: absent
- force_absent: yes
-
-- assert:
- that:
- - buildargs_1 is changed
- - buildargs_2 is not changed
- when: docker_py_version is version('1.6.0', '>=')
-
-- assert:
- that:
- - buildargs_1 is failed
- - buildargs_2 is failed
- when: docker_py_version is version('1.6.0', '<')
-
-####################################################################
-## container_limits ################################################
-####################################################################
-
-- name: container_limits (Failed due to min memory limit)
- docker_image:
- name: "{{ iname }}"
- build:
- path: "{{ role_path }}/files"
- container_limits:
- memory: 4000
- pull: no
- source: build
- ignore_errors: yes
- register: container_limits_1
-
-- name: container_limits
- docker_image:
- name: "{{ iname }}"
- build:
- path: "{{ role_path }}/files"
- container_limits:
- memory: 5000000
- memswap: 7000000
- pull: no
- source: build
- register: container_limits_2
-
-- name: cleanup
- docker_image:
- name: "{{ iname }}"
- state: absent
- force_absent: yes
-
-- assert:
- that:
- # It *sometimes* happens that the first task does not fail.
- # For now, we work around this by
- # a) requiring that if it fails, the message must
- # contain 'Minimum memory limit allowed is 4MB', and
- # b) requiring that either the first task, or the second
- # task is changed, but not both.
- - "not container_limits_1 is failed or ('Minimum memory limit allowed is 4MB') in container_limits_1.msg"
- - "container_limits_1 is changed or container_limits_2 is changed and not (container_limits_1 is changed and container_limits_2 is changed)"
-
-####################################################################
-## dockerfile ######################################################
-####################################################################
-
-- name: dockerfile
- docker_image:
- name: "{{ iname }}"
- build:
- path: "{{ role_path }}/files"
- dockerfile: "MyDockerfile"
- pull: no
- source: build
- register: dockerfile_1
-
-- name: cleanup
- docker_image:
- name: "{{ iname }}"
- state: absent
- force_absent: yes
-
-- assert:
- that:
- - dockerfile_1 is changed
- - dockerfile_1['image']['Config']['WorkingDir'] == '/newdata'
-
-####################################################################
-## force ###########################################################
-####################################################################
-
-- name: Build an image
- docker_image:
- name: "{{ iname }}"
- build:
- path: "{{ role_path }}/files"
- pull: no
- source: build
-
-- name: force (changed)
- docker_image:
- name: "{{ iname }}"
- build:
- path: "{{ role_path }}/files"
- dockerfile: "MyDockerfile"
- pull: no
- source: build
- force_source: yes
- register: force_1
-
-- name: force (unchanged)
- docker_image:
- name: "{{ iname }}"
- build:
- path: "{{ role_path }}/files"
- dockerfile: "MyDockerfile"
- pull: no
- source: build
- force_source: yes
- register: force_2
-
-- name: cleanup
- docker_image:
- name: "{{ iname }}"
- state: absent
- force_absent: yes
-
-- assert:
- that:
- - force_1 is changed
- - force_2 is not changed
-
-####################################################################
-## load path #######################################################
-####################################################################
-
-- name: Archive image
- docker_image:
- name: "hello-world:latest"
- archive_path: "{{ output_dir }}/image.tar"
- source: pull
- register: archive_image
-
-- name: remove image
- docker_image:
- name: "hello-world:latest"
- state: absent
- force_absent: yes
-
-- name: load image (changed)
- docker_image:
- name: "hello-world:latest"
- load_path: "{{ output_dir }}/image.tar"
- source: load
- register: load_image
-
-- name: load image (idempotency)
- docker_image:
- name: "hello-world:latest"
- load_path: "{{ output_dir }}/image.tar"
- source: load
- register: load_image_1
-
-- assert:
- that:
- - load_image is changed
- - load_image_1 is not changed
- - archive_image['image']['Id'] == load_image['image']['Id']
-
-####################################################################
-## path ############################################################
-####################################################################
-
-- name: Build image
- docker_image:
- name: "{{ iname }}"
- build:
- path: "{{ role_path }}/files"
- pull: no
- source: build
- register: path_1
-
-- name: Build image (idempotency)
- docker_image:
- name: "{{ iname }}"
- build:
- path: "{{ role_path }}/files"
- pull: no
- source: build
- register: path_2
-
-- name: cleanup
- docker_image:
- name: "{{ iname }}"
- state: absent
- force_absent: yes
-
-- assert:
- that:
- - path_1 is changed
- - path_2 is not changed
-
-####################################################################
-## target ##########################################################
-####################################################################
-
-- name: Build multi-stage image
- docker_image:
- name: "{{ iname }}"
- build:
- path: "{{ role_path }}/files"
- dockerfile: "StagedDockerfile"
- target: first
- pull: no
- source: build
- register: dockerfile_2
-
-- name: cleanup
- docker_image:
- name: "{{ iname }}"
- state: absent
- force_absent: yes
-
-- assert:
- that:
- - dockerfile_2 is changed
- - dockerfile_2.image.Config.WorkingDir == '/first'
-
-####################################################################
-## build.etc_hosts #################################################
-####################################################################
-
-- name: Build image with custom etc_hosts
- docker_image:
- name: "{{ iname }}"
- build:
- path: "{{ role_path }}/files"
- dockerfile: "EtcHostsDockerfile"
- pull: no
- etc_hosts:
- some-custom-host: "127.0.0.1"
- source: build
- register: path_1
-
-- name: cleanup
- docker_image:
- name: "{{ iname }}"
- state: absent
- force_absent: yes
-
-- assert:
- that:
- - path_1 is changed