summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorHannes Ljungberg <hannes@5monkeys.se>2019-03-05 19:59:49 +0100
committerJohn R Barker <john@johnrbarker.com>2019-03-05 19:59:49 +0100
commit7a130d5446147fecd602c5759f0ac5b38ef5b07d (patch)
treea0c65344ab6ea7065670db1bddf95eddddb8fcf3 /test
parentdocker_*: enable RHEL8 tests (#53313) (diff)
downloadansible-7a130d5446147fecd602c5759f0ac5b38ef5b07d.tar.xz
ansible-7a130d5446147fecd602c5759f0ac5b38ef5b07d.zip
docker_swarm_service: Add hosts option (#53290)
* Add hosts option * Add changelog fragment
Diffstat (limited to 'test')
-rw-r--r--test/integration/targets/docker_swarm_service/tasks/tests/options.yml52
-rw-r--r--test/integration/targets/docker_swarm_service/vars/main.yml1
2 files changed, 53 insertions, 0 deletions
diff --git a/test/integration/targets/docker_swarm_service/tasks/tests/options.yml b/test/integration/targets/docker_swarm_service/tasks/tests/options.yml
index 98e0915303..cc4c36e81b 100644
--- a/test/integration/targets/docker_swarm_service/tasks/tests/options.yml
+++ b/test/integration/targets/docker_swarm_service/tasks/tests/options.yml
@@ -1065,6 +1065,58 @@
when: docker_api_version is version('1.25', '<')
###################################################################
+## hosts ##########################################################
+###################################################################
+
+- name: hosts
+ docker_swarm_service:
+ name: "{{ service_name }}"
+ image: alpine:3.8
+ command: '/bin/sh -v -c "sleep 10m"'
+ hosts:
+ example.com: 1.2.3.4
+ example.org: 4.3.2.1
+ register: hosts_1
+
+- name: hosts (idempotency)
+ docker_swarm_service:
+ name: "{{ service_name }}"
+ image: alpine:3.8
+ command: '/bin/sh -v -c "sleep 10m"'
+ hosts:
+ example.com: 1.2.3.4
+ example.org: 4.3.2.1
+ register: hosts_2
+
+- name: hosts (change)
+ docker_swarm_service:
+ name: "{{ service_name }}"
+ image: alpine:3.8
+ command: '/bin/sh -v -c "sleep 10m"'
+ hosts:
+ example.com: 1.2.3.4
+ register: hosts_3
+
+- name: cleanup
+ docker_swarm_service:
+ name: "{{ service_name }}"
+ state: absent
+ diff: no
+
+- assert:
+ that:
+ - hosts_1 is changed
+ - hosts_2 is not changed
+ - hosts_3 is changed
+ when: docker_api_version is version('1.25', '>=')
+- assert:
+ that:
+ - hosts_1 is failed
+ - "('version is ' ~ docker_api_version ~'. Minimum version required is 1.25') in hosts_1.msg"
+ when: docker_api_version is version('1.25', '<')
+
+
+###################################################################
## image ##########################################################
###################################################################
diff --git a/test/integration/targets/docker_swarm_service/vars/main.yml b/test/integration/targets/docker_swarm_service/vars/main.yml
index ca4e3f0ae7..cfabafed9a 100644
--- a/test/integration/targets/docker_swarm_service/vars/main.yml
+++ b/test/integration/targets/docker_swarm_service/vars/main.yml
@@ -16,6 +16,7 @@ service_expected_output:
healthcheck: null
healthcheck_disabled: null
hostname: null
+ hosts: null
image: busybox
labels: null
limit_cpu: null