summaryrefslogtreecommitdiff
path: root/test/integration/targets/docker_swarm
diff options
context:
space:
mode:
authorHannes Ljungberg <hannes@5monkeys.se>2019-04-01 13:19:18 +0200
committerJohn R Barker <john@johnrbarker.com>2019-04-01 12:19:18 +0100
commite58f23b73e5a194f79f47727f1b4723832f195d9 (patch)
tree65c0f2509c045c8d87820a9795a80ca2d9a4ecca /test/integration/targets/docker_swarm
parent21c8650180f3ad5fd248a24a116a672805ce4dce (diff)
downloadansible-e58f23b73e5a194f79f47727f1b4723832f195d9.tar.gz
docker_swarm: Return UnlockKey (#54490)
* Return UnlockKey * Add changelog fragment * Add method to check if a parameter exists in diffs * Add method to get swarm unlock key * Add option unlock_key * Only return unlock key when created or changed * Rename difference check * Extend unlock key example * Assert that unlock_key is a string * Fix docker_swarm_info authors * Don’t silence APIErrors * Test unlock_key on unlocked swarm * Catch APIError when retrieving unlock key * Better return value description * Lint * Fix UnlockKey return value documentation Co-Authored-By: hannseman <hannes@5monkeys.se> * Get unlock key safely Co-Authored-By: hannseman <hannes@5monkeys.se> * Return None on empty UnlockKey * Assert swarm_unlock_key is undefined if unqueried * Add documentation about swarm_info unlock_key * Add change log fragment for unlock_key option * Revert "Add change log fragment for unlock_key option" This reverts commit e3cb2325b552e5d14cc3f42b33a86bf3ee84d3b9. * Use generator expression instead * Restart docker more decisively * Use systemctl kill Co-Authored-By: hannseman <hannes@5monkeys.se> * Try to restart docker daemon
Diffstat (limited to 'test/integration/targets/docker_swarm')
-rw-r--r--test/integration/targets/docker_swarm/tasks/main.yml5
-rw-r--r--test/integration/targets/docker_swarm/tasks/tests/options.yml19
2 files changed, 24 insertions, 0 deletions
diff --git a/test/integration/targets/docker_swarm/tasks/main.yml b/test/integration/targets/docker_swarm/tasks/main.yml
index 5bddee1e14..867bbbd1ee 100644
--- a/test/integration/targets/docker_swarm/tasks/main.yml
+++ b/test/integration/targets/docker_swarm/tasks/main.yml
@@ -13,11 +13,16 @@
diff: no
ignore_errors: yes
+ - name: Kill docker daemon
+ command: systemctl kill -s 9 docker
+ become: yes
+
- name: Restart docker daemon
service:
name: docker
state: restarted
become: yes
+
- name: Wait for docker daemon to be fully restarted
command: docker ps
diff --git a/test/integration/targets/docker_swarm/tasks/tests/options.yml b/test/integration/targets/docker_swarm/tasks/tests/options.yml
index 0cb19b11c8..85f8223ddb 100644
--- a/test/integration/targets/docker_swarm/tasks/tests/options.yml
+++ b/test/integration/targets/docker_swarm/tasks/tests/options.yml
@@ -61,6 +61,15 @@
register: output_6
ignore_errors: yes
+- name: autolock_managers (force new swarm)
+ docker_swarm:
+ state: present
+ force: yes
+ autolock_managers: yes
+ diff: yes
+ register: output_7
+ ignore_errors: yes
+
- name: assert autolock_managers changes
assert:
that:
@@ -89,6 +98,16 @@
- 'output_6.diff.before is defined'
- 'output_6.diff.after is defined'
when: docker_py_version is version('2.6.0', '>=')
+
+- name: assert UnlockKey in swarm_facts
+ assert:
+ that:
+ - 'output_2.swarm_facts.UnlockKey'
+ - 'output_3.swarm_facts.UnlockKey is none'
+ - 'output_6.swarm_facts.UnlockKey is none'
+ - 'output_7.swarm_facts.UnlockKey'
+ when: docker_py_version is version('2.7.0', '>=')
+
- assert:
that:
- output_1 is failed