d264bf4f4e
* Add option tests * Check for api version on publish * Enable configs tests * Remove unsupported test * Let main.yml hande creation/destruction of swarms * Revert "Remove unsupported test" This reverts commit50f46bb04e
. * Revert "Enable configs tests" This reverts commita94054b0bb
. * Fix typo to properly clear secrets
104 lines
2.1 KiB
YAML
104 lines
2.1 KiB
YAML
---
|
|
|
|
- name: Create a swarm service without name
|
|
register: output
|
|
docker_swarm_service:
|
|
state: present
|
|
ignore_errors: yes
|
|
|
|
- name: assert failure when name not set
|
|
assert:
|
|
that:
|
|
- output is failed
|
|
- 'output.msg == "missing required arguments: name"'
|
|
|
|
- name: Remove an non-existing service
|
|
register: output
|
|
docker_swarm_service:
|
|
state: absent
|
|
name: non_existing_service
|
|
|
|
- name: assert output not changed when deleting non-existing service
|
|
assert:
|
|
that:
|
|
- output is not changed
|
|
|
|
- name: create sample service
|
|
register: output
|
|
docker_swarm_service:
|
|
name: test_service
|
|
endpoint_mode: dnsrr
|
|
image: busybox
|
|
args:
|
|
- sleep
|
|
- "3600"
|
|
|
|
- name: assert sample service is created
|
|
assert:
|
|
that:
|
|
- output is changed
|
|
|
|
- name: change service args
|
|
register: output
|
|
docker_swarm_service:
|
|
name: test_service
|
|
image: busybox
|
|
args:
|
|
- sleep
|
|
- "1800"
|
|
|
|
- name: assert service args are correct
|
|
assert:
|
|
that:
|
|
- output.ansible_docker_service.args == ['sleep', '1800']
|
|
|
|
- name: set service mode to global
|
|
register: output
|
|
docker_swarm_service:
|
|
name: test_service
|
|
image: busybox
|
|
endpoint_mode: vip
|
|
mode: global
|
|
args:
|
|
- sleep
|
|
- "1800"
|
|
|
|
- name: assert service mode changed caused service rebuild
|
|
assert:
|
|
that:
|
|
- output.rebuilt
|
|
|
|
- name: add published ports to service
|
|
register: output
|
|
docker_swarm_service:
|
|
name: test_service
|
|
image: busybox
|
|
mode: global
|
|
args:
|
|
- sleep
|
|
- "1800"
|
|
endpoint_mode: vip
|
|
publish:
|
|
- protocol: tcp
|
|
published_port: 60001
|
|
target_port: 60001
|
|
- protocol: udp
|
|
published_port: 60001
|
|
target_port: 60001
|
|
|
|
- name: assert service matches expectations
|
|
assert:
|
|
that:
|
|
- output.ansible_docker_service == service_expected_output
|
|
|
|
- name: delete sample service
|
|
register: output
|
|
docker_swarm_service:
|
|
name: test_service
|
|
state: absent
|
|
|
|
- name: assert service deletion returns changed
|
|
assert:
|
|
that:
|
|
- output is success
|
|
- output is changed
|