|
55 | 55 | register: openshell_cli |
56 | 56 | changed_when: false |
57 | 57 |
|
| 58 | + # Every test boot restarts the gateway, and some installers take minutes to |
| 59 | + # recover. Wait once here; the runner's per-scenario preflight stays short. |
| 60 | + - name: Wait for the registered gateway |
| 61 | + ansible.builtin.command: |
| 62 | + argv: [timeout, 10s, "{{ openshell_cli.stdout }}", status, --output, json] |
| 63 | + register: gateway_status |
| 64 | + changed_when: false |
| 65 | + until: >- |
| 66 | + gateway_status.rc == 0 and |
| 67 | + (gateway_status.stdout | from_json).status == 'connected' |
| 68 | + retries: 60 |
| 69 | + delay: 5 |
| 70 | + ignore_errors: true |
| 71 | + |
58 | 72 | - name: Run OpenShell conformance archive |
59 | 73 | ansible.builtin.command: |
60 | 74 | argv: |
|
77 | 91 | register: conformance_result |
78 | 92 | changed_when: false |
79 | 93 | failed_when: false |
| 94 | + when: gateway_status is succeeded |
80 | 95 |
|
81 | 96 | # Preserve both streams for failures without adding passing-test output to |
82 | 97 | # every tmachine run. |
83 | 98 | - name: Show OpenShell conformance diagnostics |
84 | 99 | ansible.builtin.debug: |
85 | 100 | var: conformance_result |
86 | | - when: conformance_result.rc != 0 |
| 101 | + when: conformance_result.rc | default(0) != 0 |
87 | 102 |
|
88 | 103 | - name: Read OpenShell gateway logs |
89 | 104 | become: true |
|
99 | 114 | register: openshell_gateway_logs |
100 | 115 | changed_when: false |
101 | 116 | failed_when: false |
102 | | - when: conformance_result.rc != 0 |
| 117 | + when: conformance_result.rc | default(1) != 0 |
103 | 118 |
|
104 | 119 | - name: Show OpenShell gateway logs |
105 | 120 | ansible.builtin.debug: |
106 | 121 | var: openshell_gateway_logs.stdout_lines |
107 | | - when: conformance_result.rc != 0 |
| 122 | + when: conformance_result.rc | default(1) != 0 |
108 | 123 |
|
109 | 124 | - name: Collect K3s conformance diagnostics |
110 | 125 | ansible.builtin.include_role: |
111 | 126 | name: openshell_k3s_diagnostics |
112 | | - when: conformance_result.rc != 0 |
| 127 | + when: conformance_result.rc | default(1) != 0 |
| 128 | + |
| 129 | + - name: Require a connected gateway |
| 130 | + ansible.builtin.assert: |
| 131 | + that: |
| 132 | + - gateway_status is succeeded |
| 133 | + fail_msg: OpenShell gateway did not connect before conformance; see gateway diagnostics |
113 | 134 |
|
114 | 135 | - name: Require OpenShell conformance success |
115 | 136 | ansible.builtin.assert: |
|
0 commit comments