summaryrefslogtreecommitdiff
path: root/test/integration/targets
diff options
context:
space:
mode:
authorDave Bendit <David@ibendit.com>2018-12-06 12:50:45 -0600
committerJohn R Barker <john@johnrbarker.com>2018-12-06 18:50:45 +0000
commit73640a41907c56a9802c28a8305eec7b48b6437c (patch)
tree153f67ae0507ae8b660f53ff3357efa6c5688aa6 /test/integration/targets
parent4f9f1754b44aefd808536aeaf01262c84712659a (diff)
downloadansible-73640a41907c56a9802c28a8305eec7b48b6437c.tar.gz
[docker_network] Adding `scope` and `attachable` flags (#49562)
Incorporating the abandoned work from PRs #35288 and #45552. Also adding in the version checking from `docker_container.py`, which should be abstracted out to `docker_common.py`.
Diffstat (limited to 'test/integration/targets')
-rw-r--r--test/integration/targets/docker_network/tasks/tests/options.yml97
-rw-r--r--test/integration/targets/docker_swarm/tasks/test_swarm.yml2
2 files changed, 98 insertions, 1 deletions
diff --git a/test/integration/targets/docker_network/tasks/tests/options.yml b/test/integration/targets/docker_network/tasks/tests/options.yml
index d4ac563308..b3ac57b416 100644
--- a/test/integration/targets/docker_network/tasks/tests/options.yml
+++ b/test/integration/targets/docker_network/tasks/tests/options.yml
@@ -92,3 +92,100 @@
- driver_options_3 is not changed
- driver_options_4 is changed
- driver_options_5 is not changed
+
+####################################################################
+## scope ###########################################################
+####################################################################
+
+- block:
+ - name: scope
+ docker_network:
+ name: "{{ nname_1 }}"
+ driver: bridge
+ scope: local
+ register: scope_1
+
+ - name: scope (idempotency)
+ docker_network:
+ name: "{{ nname_1 }}"
+ driver: bridge
+ scope: local
+ register: scope_2
+
+ - name: swarm
+ docker_swarm:
+ state: present
+ advertise_addr: "{{ansible_default_ipv4.address}}"
+
+ # Driver change alongside scope is intentional - bridge doesn't appear to support anything but local, and overlay can't downgrade to local. Additionally, overlay reports as swarm for swarm OR global, so no change is reported in that case.
+ # Test output indicates that the scope is altered, at least, so manual inspection will be required to verify this going forward, unless we come up with a test driver that supports multiple scopes.
+ - name: scope (change)
+ docker_network:
+ name: "{{ nname_1 }}"
+ driver: overlay
+ scope: swarm
+ register: scope_3
+
+ - name: cleanup network
+ docker_network:
+ name: "{{ nname_1 }}"
+ state: absent
+ force: yes
+
+ - assert:
+ that:
+ - scope_1 is changed
+ - scope_2 is not changed
+ - scope_3 is changed
+
+ always:
+ - name: cleanup swarm
+ docker_swarm:
+ state: absent
+ force: yes
+
+ # Requirements for docker_swarm
+ when: docker_py_version is version('2.6.0', '>=') and docker_api_version is version('1.35', '>=')
+
+####################################################################
+## attachable ######################################################
+####################################################################
+
+- name: attachable
+ docker_network:
+ name: "{{ nname_1 }}"
+ attachable: true
+ register: attachable_1
+ ignore_errors: yes
+
+- name: attachable (idempotency)
+ docker_network:
+ name: "{{ nname_1 }}"
+ attachable: true
+ register: attachable_2
+ ignore_errors: yes
+
+- name: attachable (change)
+ docker_network:
+ name: "{{ nname_1 }}"
+ attachable: false
+ register: attachable_3
+ ignore_errors: yes
+
+- name: cleanup
+ docker_network:
+ name: "{{ nname_1 }}"
+ state: absent
+ force: yes
+
+- assert:
+ that:
+ - attachable_1 is changed
+ - attachable_2 is not changed
+ - attachable_3 is changed
+ when: docker_py_version is version('2.0.0', '>=')
+- assert:
+ that:
+ - attachable_1 is failed
+ - "('version is ' ~ docker_py_version ~'. Minimum version required is 2.0.0') in attachable_1.msg"
+ when: docker_py_version is version('2.0.0', '<')
diff --git a/test/integration/targets/docker_swarm/tasks/test_swarm.yml b/test/integration/targets/docker_swarm/tasks/test_swarm.yml
index eca815f1a4..f683de239f 100644
--- a/test/integration/targets/docker_swarm/tasks/test_swarm.yml
+++ b/test/integration/targets/docker_swarm/tasks/test_swarm.yml
@@ -52,7 +52,7 @@
assert:
that:
- 'output.changed'
- - 'output.actions[0] == "Node has leaved the swarm cluster"'
+ - 'output.actions[0] == "Node has left the swarm cluster"'
always:
- name: Cleanup