aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/test-noop-deploy.yml
diff options
context:
space:
mode:
authorClement Delafargue <clement.delafargue@fretlink.com>2020-06-30 09:33:18 +0200
committerClement Delafargue <clement.delafargue@fretlink.com>2020-06-30 16:26:19 +0200
commit75a2a2fbcc31766e2debab1c8bd5cdce42f14fb7 (patch)
tree969db0f1818a878a21b921d31eff555d7c9d4a5a /tests/test-noop-deploy.yml
parent783f91c2e0228ef9e057b810b4b60c4f669ebab4 (diff)
downloadansible-clever-75a2a2fbcc31766e2debab1c8bd5cdce42f14fb7.tar.gz
ansible-clever-75a2a2fbcc31766e2debab1c8bd5cdce42f14fb7.tar.zst
ansible-clever-75a2a2fbcc31766e2debab1c8bd5cdce42f14fb7.zip
add a test for `noop-if-up-to-date`
It makes sure `clever deploy` is _not_ called if the application is up-to-date on clever cloud
Diffstat (limited to 'tests/test-noop-deploy.yml')
-rw-r--r--tests/test-noop-deploy.yml35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/test-noop-deploy.yml b/tests/test-noop-deploy.yml
new file mode 100644
index 0000000..13eed20
--- /dev/null
+++ b/tests/test-noop-deploy.yml
@@ -0,0 +1,35 @@
1---
2- name: Do nothing if the app is up-to-date on clever
3 hosts: localhost
4 remote_user: root
5 pre_tasks:
6 - file:
7 state: absent
8 path: ../clever-commands
9 roles:
10 - role: clever
11 vars:
12 clever_token: 123abc
13 clever_secret: cba321
14 clever_app: app_00000000-0000-0000-0000-000000000000
15 environment:
16 PRETEND_REMOTE_COMMIT: aaa000aaa000aaa000aaa000aaa000aaa000aaa0
17 post_tasks:
18 - name: Check stubbed commands
19 shell: "{{ item.cmd }}"
20 ignore_errors: true
21 with_list:
22 - cmd: "! grep deploy ../clever-commands"
23 display: "Expected 'clever deploy' command to NOT be called"
24 vars:
25 display: "{{ item.display }}"
26 register: tests_results
27 - name: show results
28 debug:
29 msg:
30 - "failed_results: {{ failed_results }}"
31 - "success_results: {{ success_results }}"
32 failed_when: tests_results is failed
33 vars:
34 failed_results: "{{ tests_results.results | selectattr('failed') | map(attribute='item.display') | list }}"
35 success_results: "{{ tests_results.results | rejectattr('failed') | map(attribute='item.display') | list }}"