diff options
-rwxr-xr-x | tests/fake.sh | 1 | ||||
-rw-r--r-- | tests/test-configure-app.yml | 30 | ||||
-rw-r--r-- | tests/test-restart-app.yml | 27 | ||||
-rw-r--r-- | tests/test-scalability.yml | 27 |
4 files changed, 85 insertions, 0 deletions
diff --git a/tests/fake.sh b/tests/fake.sh index 75bc051..bbb4380 100755 --- a/tests/fake.sh +++ b/tests/fake.sh | |||
@@ -10,5 +10,6 @@ elif [ "${binary}" = "clever" ] && [ "${1}" = "activity" ]; then | |||
10 | elif [ "${binary}" = "git" ]; then | 10 | elif [ "${binary}" = "git" ]; then |
11 | echo "${fakeCommit}" | 11 | echo "${fakeCommit}" |
12 | else | 12 | else |
13 | echo "${1}" >> "${binary}-commands" | ||
13 | echo "${binary} called with arguments: ${*}" | 14 | echo "${binary} called with arguments: ${*}" |
14 | fi | 15 | fi |
diff --git a/tests/test-configure-app.yml b/tests/test-configure-app.yml index 06e5e92..15987fd 100644 --- a/tests/test-configure-app.yml +++ b/tests/test-configure-app.yml | |||
@@ -2,6 +2,10 @@ | |||
2 | - name: Deploy an app & configure system details on clever | 2 | - name: Deploy an app & configure system details on clever |
3 | hosts: localhost | 3 | hosts: localhost |
4 | remote_user: root | 4 | remote_user: root |
5 | pre_tasks: | ||
6 | - file: | ||
7 | state: absent | ||
8 | path: ../clever-commands | ||
5 | roles: | 9 | roles: |
6 | - role: clever | 10 | - role: clever |
7 | vars: | 11 | vars: |
@@ -16,3 +20,29 @@ | |||
16 | fail: | 20 | fail: |
17 | msg: "CC_RUN_COMMAND env variable should not be present in the environment dict" | 21 | msg: "CC_RUN_COMMAND env variable should not be present in the environment dict" |
18 | when: clever_env.CC_RUN_COMMAND is defined | 22 | when: clever_env.CC_RUN_COMMAND is defined |
23 | - name: Check stubbed commands | ||
24 | command: "{{ item.cmd }}" | ||
25 | ignore_errors: true | ||
26 | vars: | ||
27 | display: "{{ item.display }}" | ||
28 | with_list: | ||
29 | - cmd: "grep deploy ../clever-commands" | ||
30 | display: "Expected 'clever deploy' command to be called" | ||
31 | - cmd: "grep scale ../clever-commands" | ||
32 | display: "Expected 'clever scale' command to be called" | ||
33 | - cmd: "grep domain ../clever-commands" | ||
34 | display: "Expected 'clever domain' command to be called" | ||
35 | - cmd: "grep drain ../clever-commands" | ||
36 | display: "Expected 'clever drain' command to be called" | ||
37 | - cmd: "grep -v restart ../clever-commands" | ||
38 | display: "Expected 'clever restart' command to NOT be called" | ||
39 | register: tests_results | ||
40 | - name: show results | ||
41 | debug: | ||
42 | msg: | ||
43 | - "failed_results: {{ failed_results }}" | ||
44 | - "success_results: {{ success_results }}" | ||
45 | failed_when: tests_results is failed | ||
46 | vars: | ||
47 | failed_results: "{{ tests_results.results | selectattr('failed') | map(attribute='item.display') | list }}" | ||
48 | success_results: "{{ tests_results.results | rejectattr('failed') | map(attribute='item.display') | list }}" | ||
diff --git a/tests/test-restart-app.yml b/tests/test-restart-app.yml index 09d9936..4c13a14 100644 --- a/tests/test-restart-app.yml +++ b/tests/test-restart-app.yml | |||
@@ -2,6 +2,10 @@ | |||
2 | - name: Restart app on clever | 2 | - name: Restart app on clever |
3 | hosts: localhost | 3 | hosts: localhost |
4 | remote_user: root | 4 | remote_user: root |
5 | pre_tasks: | ||
6 | - file: | ||
7 | state: absent | ||
8 | path: ../clever-commands | ||
5 | roles: | 9 | roles: |
6 | - role: clever | 10 | - role: clever |
7 | vars: | 11 | vars: |
@@ -9,3 +13,26 @@ | |||
9 | clever_secret: cba321 | 13 | clever_secret: cba321 |
10 | clever_app: app_00000000-0000-0000-0000-000000000000 | 14 | clever_app: app_00000000-0000-0000-0000-000000000000 |
11 | clever_restart_only: true | 15 | clever_restart_only: true |
16 | post_tasks: | ||
17 | - name: Check stubbed commands | ||
18 | command: "{{ item.cmd }}" | ||
19 | ignore_errors: true | ||
20 | vars: | ||
21 | display: "{{ item.display }}" | ||
22 | with_list: | ||
23 | - cmd: "grep restart ../clever-commands" | ||
24 | display: "Expected 'clever restart' command to be called" | ||
25 | - cmd: "grep -v deploy ../clever-commands" | ||
26 | display: "Expected 'clever deploy' command to NOT be called" | ||
27 | - cmd: "grep -v scale ../clever-commands" | ||
28 | display: "Expected 'clever scale' command to NOT be called" | ||
29 | register: tests_results | ||
30 | - name: show results | ||
31 | debug: | ||
32 | msg: | ||
33 | - "failed_results: {{ failed_results }}" | ||
34 | - "success_results: {{ success_results }}" | ||
35 | failed_when: tests_results is failed | ||
36 | vars: | ||
37 | failed_results: "{{ tests_results.results | selectattr('failed') | map(attribute='item.display') | list }}" | ||
38 | success_results: "{{ tests_results.results | rejectattr('failed') | map(attribute='item.display') | list }}" | ||
diff --git a/tests/test-scalability.yml b/tests/test-scalability.yml index fefc86c..6bb90d2 100644 --- a/tests/test-scalability.yml +++ b/tests/test-scalability.yml | |||
@@ -15,6 +15,10 @@ | |||
15 | - name: Configure scalability (no instances and ranged flavors) | 15 | - name: Configure scalability (no instances and ranged flavors) |
16 | hosts: localhost | 16 | hosts: localhost |
17 | remote_user: root | 17 | remote_user: root |
18 | pre_tasks: | ||
19 | - file: | ||
20 | state: absent | ||
21 | path: ../clever-commands | ||
18 | roles: | 22 | roles: |
19 | - role: clever | 23 | - role: clever |
20 | vars: | 24 | vars: |
@@ -23,6 +27,29 @@ | |||
23 | clever_app: app_00000000-0000-0000-0000-000000000000 | 27 | clever_app: app_00000000-0000-0000-0000-000000000000 |
24 | clever_scaling: | 28 | clever_scaling: |
25 | flavors: { min: "nano", max: "XS" } | 29 | flavors: { min: "nano", max: "XS" } |
30 | post_tasks: | ||
31 | - name: Check stubbed commands | ||
32 | command: "{{ item.cmd }}" | ||
33 | ignore_errors: true | ||
34 | vars: | ||
35 | display: "{{ item.display }}" | ||
36 | with_list: | ||
37 | - cmd: "grep deploy ../clever-commands" | ||
38 | display: "Expected 'clever deploy' command to be called" | ||
39 | - cmd: "grep scale ../clever-commands" | ||
40 | display: "Expected 'clever scale' command to be called" | ||
41 | - cmd: "grep -v restart ../clever-commands" | ||
42 | display: "Expected 'clever restart' command to NOT be called" | ||
43 | register: tests_results | ||
44 | - name: show results | ||
45 | debug: | ||
46 | msg: | ||
47 | - "failed_results: {{ failed_results }}" | ||
48 | - "success_results: {{ success_results }}" | ||
49 | failed_when: tests_results is failed | ||
50 | vars: | ||
51 | failed_results: "{{ tests_results.results | selectattr('failed') | map(attribute='item.display') | list }}" | ||
52 | success_results: "{{ tests_results.results | rejectattr('failed') | map(attribute='item.display') | list }}" | ||
26 | 53 | ||
27 | - name: Configure scalability (incomplete flavors) | 54 | - name: Configure scalability (incomplete flavors) |
28 | hosts: localhost | 55 | hosts: localhost |