Debian Codegraph @

test/integration/targets/ansible-test-debugging/tasks/main.yml

raw
1 - name: Define supported debuggers
2 set_fact:
3 debuggers:
4 - pydevd
5 - debugpy
6
7 - name: Run without debugging features enabled
8 command: ansible-test shell -v -- env
9 register: result
10
11 - assert:
12 that:
13 - result.stderr_lines is not contains 'Debugging'
14
15 - name: Run a command which does not support debugging
16 command: ansible-test env -v
17 register: result
18
19 - assert:
20 that:
21 - result.stderr_lines is not contains 'Debugging'
22
23 - name: Verify on-demand debugging gracefully handles not running under a debugger
24 command: ansible-test shell -v --dev-debug-on-demand -- env
25 register: result
26
27 - assert:
28 that:
29 - result.stderr_lines is contains 'Debugging disabled because no debugger was detected.'
30
31 - name: Verify manual debugging gracefully handles lack of configuration
32 command: ansible-test shell -v --dev-debug-cli -- env
33 register: result
34
35 - assert:
36 that:
37 - result.stderr_lines is contains 'Debugging disabled because no debugger configuration was provided.'
38
39 - name: Verify invalid debugger configuration is handled
40 command: ansible-test shell --dev-debug-cli -- env
41 environment: >
42 {% set key = "ANSIBLE_TEST_REMOTE_DEBUGGER_" + item.upper() %}{{ ('{"' + key + '": "{\"invalid_key\": true}"}') | from_json }}
43 register: result
44 loop: "{{ debuggers }}"
45 ignore_errors: yes
46
47 - assert:
48 that:
49 - item.stderr is search("Invalid " + item.item + " settings.*invalid_key")
50 loop: "{{ result.results }}"
51
52 - name: Verify CLI debugger can be manually enabled (shell)
53 command: ansible-test shell --dev-debug-cli -- env
54 environment: >
55 {% set key = "ANSIBLE_TEST_REMOTE_DEBUGGER_" + item.upper() %}{{ ('{"' + key + '": ""}') | from_json }}
56 register: result
57 loop: "{{ debuggers }}"
58
59 - assert:
60 that:
61 - item.stdout is contains "ANSIBLE_TEST_DEBUGGER_CONFIG"
62 loop: "{{ result.results }}"
63
64 - name: Verify CLI debugger can be manually enabled (integration)
65 command: ansible-test integration ansible-test-debugging-env --dev-debug-cli
66 environment: >
67 {% set key = "ANSIBLE_TEST_REMOTE_DEBUGGER_" + item.upper() %}{{ ('{"' + key + '": ""}') | from_json }}
68 register: result
69 loop: "{{ debuggers }}"
70
71 - assert:
72 that:
73 - item.stdout is contains "ANSIBLE_TEST_DEBUGGER_CONFIG"
74 loop: "{{ result.results }}"
75
76 - name: Verify AnsiballZ debugger can be manually enabled (shell)
77 command: ansible-test shell --dev-debug-ansiballz -- env
78 environment: >
79 {% set key = "ANSIBLE_TEST_REMOTE_DEBUGGER_" + item.upper() %}{{ ('{"' + key + '": ""}') | from_json }}
80 register: result
81 loop: "{{ debuggers }}"
82
83 - assert:
84 that:
85 - item.stdout is contains("_ANSIBLE_ANSIBALLZ_" + item.item.upper() + "_CONFIG")
86 loop: "{{ result.results }}"
87
88 - name: Verify AnsiballZ debugger can be manually enabled (integration)
89 command: ansible-test integration ansible-test-debugging-inventory --dev-debug-ansiballz
90 environment: >
91 {% set key = "ANSIBLE_TEST_REMOTE_DEBUGGER_" + item.upper() %}{{ ('{"' + key + '": ""}') | from_json }}
92 register: result
93 loop: "{{ debuggers }}"
94
95 - assert:
96 that:
97 - item.stdout is contains("_ansible_ansiballz_" + item.item + "_config")
98 loop: "{{ result.results }}"