Skip to content

Commit

Permalink
Improve and fix tests (#36)
Browse files Browse the repository at this point in the history
* Parameterize test images.

* Use different images, similar to ansible/ansible#72698.
  • Loading branch information
felixfontein authored Nov 23, 2020
1 parent 1fa2c3b commit 219c6b3
Show file tree
Hide file tree
Showing 55 changed files with 804 additions and 778 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

- name: value
docker_container:
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
state: started
Expand All @@ -21,7 +21,7 @@

- name: value (change, ignore)
docker_container:
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
state: started
Expand All @@ -33,7 +33,7 @@

- name: value (change, strict)
docker_container:
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
state: started
Expand Down Expand Up @@ -62,7 +62,7 @@

- name: list
docker_container:
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
state: started
Expand All @@ -73,7 +73,7 @@

- name: list (change, ignore)
docker_container:
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
state: started
Expand All @@ -86,7 +86,7 @@

- name: list (change, strict)
docker_container:
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
state: started
Expand Down Expand Up @@ -116,7 +116,7 @@

- name: set
docker_container:
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
state: started
Expand All @@ -127,7 +127,7 @@

- name: set (change, ignore)
docker_container:
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
state: started
Expand All @@ -142,7 +142,7 @@

- name: set (change, allow_more_present)
docker_container:
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
state: started
Expand All @@ -157,7 +157,7 @@

- name: set (change, allow_more_present)
docker_container:
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
state: started
Expand All @@ -171,7 +171,7 @@

- name: set (change, strict)
docker_container:
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
state: started
Expand Down Expand Up @@ -204,7 +204,7 @@

- name: set(dict)
docker_container:
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
state: started
Expand All @@ -215,7 +215,7 @@

- name: set(dict) (change, ignore)
docker_container:
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
state: started
Expand All @@ -230,7 +230,7 @@

- name: set(dict) (change, allow_more_present)
docker_container:
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
state: started
Expand All @@ -245,7 +245,7 @@

- name: set(dict) (change, allow_more_present)
docker_container:
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
state: started
Expand All @@ -259,7 +259,7 @@

- name: set(dict) (change, strict)
docker_container:
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
state: started
Expand Down Expand Up @@ -292,7 +292,7 @@

- name: dict
docker_container:
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
state: started
Expand All @@ -303,7 +303,7 @@

- name: dict (change, ignore)
docker_container:
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
state: started
Expand All @@ -318,7 +318,7 @@

- name: dict (change, allow_more_present)
docker_container:
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
state: started
Expand All @@ -333,7 +333,7 @@

- name: dict (change, allow_more_present)
docker_container:
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
state: started
Expand All @@ -347,7 +347,7 @@

- name: dict (change, strict)
docker_container:
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
state: started
Expand Down Expand Up @@ -378,15 +378,15 @@
## wildcard ########################################################
####################################################################

- name: Pull hello-world image to make sure wildcard_2 test succeeds
- name: Pull {{ docker_test_image_hello_world }} image to make sure wildcard_2 test succeeds
# If the image isn't there, it will pull it and return 'changed'.
docker_image:
name: hello-world
name: "{{ docker_test_image_hello_world }}"
source: pull

- name: wildcard
docker_container:
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
state: started
Expand All @@ -400,7 +400,7 @@

- name: wildcard (change, ignore)
docker_container:
image: hello-world
image: "{{ docker_test_image_hello_world }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
state: started
Expand All @@ -416,7 +416,7 @@

- name: wildcard (change, strict)
docker_container:
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
state: started
Expand All @@ -433,7 +433,7 @@

- name: wildcard (no change, strict)
docker_container:
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
state: started
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
- name: Start container (check)
docker_container:
name: "{{ cname }}"
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
state: started
container_default_behavior: compatibility
Expand All @@ -23,7 +23,7 @@
- name: Start container
docker_container:
name: "{{ cname }}"
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
state: started
container_default_behavior: compatibility
Expand All @@ -32,7 +32,7 @@
- name: Start container (idempotent)
docker_container:
name: "{{ cname }}"
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
state: started
container_default_behavior: compatibility
Expand All @@ -41,7 +41,7 @@
- name: Start container (idempotent check)
docker_container:
name: "{{ cname }}"
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
state: started
container_default_behavior: compatibility
check_mode: yes
Expand All @@ -68,7 +68,7 @@
- name: Start container (check)
docker_container:
name: "{{ cname }}"
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
state: started
container_default_behavior: no_defaults
Expand All @@ -78,7 +78,7 @@
- name: Start container
docker_container:
name: "{{ cname }}"
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
state: started
container_default_behavior: no_defaults
Expand All @@ -87,7 +87,7 @@
- name: Start container (idempotent)
docker_container:
name: "{{ cname }}"
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
state: started
container_default_behavior: no_defaults
Expand All @@ -96,7 +96,7 @@
- name: Start container (idempotent check)
docker_container:
name: "{{ cname }}"
image: alpine:3.8
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
state: started
container_default_behavior: no_defaults
Expand Down
Loading

0 comments on commit 219c6b3

Please sign in to comment.