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