|
2 | 2 | # Serial coda: serially run the ordered coda list after the main batch suite |
3 | 3 | # (Machine leak cluster, egressIP / prometheus, then topology AZ check |
4 | 4 | # before enable_topology=false mutator). |
5 | | -# Expects openstack_test_leak_cluster_path to already list the ordered tests. |
| 5 | +# Artifacts go to openstack_test_serial_coda/ (separate from batch |
| 6 | +# openstack-test-results/), same layout as lb_ovn / lb_amphora_*. |
| 7 | +# Expects openstack_test_leak_cluster_path and coda log/junit paths set. |
6 | 8 | - name: Stat machines leak-cluster serial list |
7 | 9 | ansible.builtin.stat: |
8 | 10 | path: "{{ openstack_test_leak_cluster_path }}" |
|
26 | 28 | (not (openstack_test_leak_cluster_stat.stat.exists | default(false))) |
27 | 29 | or ((openstack_test_leak_cluster_count.stdout | default('0') | trim | int) == 0) |
28 | 30 |
|
29 | | -- name: Run machines leak-cluster tests serially and merge into suite log/junit |
| 31 | +- name: Run machines leak-cluster tests serially into dedicated results dir |
30 | 32 | when: |
31 | 33 | - openstack_test_leak_cluster_stat.stat.exists | default(false) |
32 | 34 | - (openstack_test_leak_cluster_count.stdout | default('0') | trim | int) > 0 |
33 | 35 | block: |
34 | 36 | - name: Execute machines leak-cluster run-test loop |
35 | 37 | ansible.builtin.shell: | |
36 | 38 | set -o pipefail |
37 | | - suite_exit=0 |
38 | 39 | py_exit=0 |
39 | 40 | resolve="{{ openstack_test_ote_resolve_script }}" |
40 | | - leak_log="{{ openstack_test_results_dir }}/machines_leak_cluster.log" |
| 41 | + leak_log="{{ openstack_test_serial_coda_log_path }}" |
| 42 | + leak_junit="{{ openstack_test_serial_coda_junit_path }}" |
41 | 43 | leak_list="{{ openstack_test_leak_cluster_path }}" |
42 | 44 | # Pre-count from the list file (do not increment in-loop; avoids |
43 | 45 | # false UNSTABLE when resolvable!=expected after a successful coda). |
|
46 | 48 | while IFS= read -r tname || [ -n "${tname:-}" ]; do |
47 | 49 | [ -z "${tname// }" ] && continue |
48 | 50 | tmp=$(mktemp) |
49 | | - rc=0 |
| 51 | + # OTE often exits non-zero on pass/skip; ignore per-test rc — final |
| 52 | + # resolver counts are the source of truth (same as LB serial / batch). |
50 | 53 | {{ openstack_test_executable }} run-test --output=json -c 1 "$tname" \ |
51 | | - > "$tmp" 2>&1 || rc=$? |
| 54 | + > "$tmp" 2>&1 || true |
52 | 55 | cat "$tmp" >> "$leak_log" |
53 | | - cat "$tmp" >> {{ openstack_test_log_path }} |
54 | | - if [ "$rc" -ne 0 ]; then |
55 | | - failed=$(python3 "$resolve" count "$tmp" failed || echo 1) |
56 | | - skipped=$(python3 "$resolve" count "$tmp" skipped || echo 0) |
57 | | - passed=$(python3 "$resolve" count "$tmp" passed || echo 0) |
58 | | - unknown=$(python3 "$resolve" count "$tmp" unknown || echo 0) |
59 | | - if [ "$failed" -gt 0 ] || [ "$unknown" -gt 0 ]; then |
60 | | - suite_exit=1 |
61 | | - elif [ $((failed + skipped + passed + unknown)) -eq 0 ]; then |
62 | | - if grep -q 'FAIL!' "$tmp" 2>/dev/null; then |
63 | | - suite_exit=1 |
64 | | - elif ! grep -qE 'SUCCESS!|SKIP' "$tmp" 2>/dev/null; then |
65 | | - suite_exit=1 |
66 | | - fi |
67 | | - fi |
68 | | - fi |
69 | 56 | rm -f "$tmp" |
70 | 57 | done < "$leak_list" |
71 | | - python3 "$resolve" junit \ |
72 | | - "{{ openstack_test_log_path }}" "{{ openstack_test_junit_path }}" || py_exit=$? |
| 58 | + python3 "$resolve" junit "$leak_log" "$leak_junit" || py_exit=$? |
73 | 59 | failed_count=$(python3 "$resolve" count "$leak_log" failed || echo 0) |
74 | 60 | skipped_count=$(python3 "$resolve" count "$leak_log" skipped || echo 0) |
75 | 61 | passed_count=$(python3 "$resolve" count "$leak_log" passed || echo 0) |
76 | 62 | unknown_count=$(python3 "$resolve" count "$leak_log" unknown || echo 0) |
77 | 63 | resolvable=$(( ${passed_count:-0} + ${skipped_count:-0} + ${failed_count:-0} )) |
78 | 64 | echo "machines_leak_cluster counts: passed=${passed_count} failed=${failed_count} skipped=${skipped_count} unknown=${unknown_count} expected=${expected} resolvable=${resolvable}" |
79 | | - if [ "$suite_exit" -ne 0 ] || [ "$py_exit" -ne 0 ] \ |
| 65 | + if [ "$py_exit" -ne 0 ] \ |
80 | 66 | || [ "${failed_count:-0}" -gt 0 ] || [ "${unknown_count:-0}" -gt 0 ] \ |
81 | 67 | || [ "$resolvable" -ne "$expected" ]; then |
82 | 68 | exit 1 |
|
91 | 77 | register: openstack_test_leak_cluster_run |
92 | 78 |
|
93 | 79 | rescue: |
| 80 | + - name: Resolve machines leak-cluster serial failure counts |
| 81 | + ansible.builtin.command: |
| 82 | + argv: |
| 83 | + - python3 |
| 84 | + - "{{ openstack_test_ote_resolve_script }}" |
| 85 | + - count |
| 86 | + - "{{ openstack_test_serial_coda_log_path }}" |
| 87 | + - "{{ item }}" |
| 88 | + loop: |
| 89 | + - failed |
| 90 | + - passed |
| 91 | + - skipped |
| 92 | + - unknown |
| 93 | + register: openstack_test_leak_cluster_rescue_counts |
| 94 | + changed_when: false |
| 95 | + failed_when: false |
| 96 | + |
| 97 | + - name: Normalize machines leak-cluster rescue counts |
| 98 | + ansible.builtin.set_fact: |
| 99 | + openstack_test_leak_failed: >- |
| 100 | + {{ (openstack_test_leak_cluster_rescue_counts.results |
| 101 | + | selectattr('item', 'equalto', 'failed') |
| 102 | + | map(attribute='stdout') | first | default('0')) | trim }} |
| 103 | + openstack_test_leak_passed: >- |
| 104 | + {{ (openstack_test_leak_cluster_rescue_counts.results |
| 105 | + | selectattr('item', 'equalto', 'passed') |
| 106 | + | map(attribute='stdout') | first | default('0')) | trim }} |
| 107 | + openstack_test_leak_skipped: >- |
| 108 | + {{ (openstack_test_leak_cluster_rescue_counts.results |
| 109 | + | selectattr('item', 'equalto', 'skipped') |
| 110 | + | map(attribute='stdout') | first | default('0')) | trim }} |
| 111 | + openstack_test_leak_unknown: >- |
| 112 | + {{ (openstack_test_leak_cluster_rescue_counts.results |
| 113 | + | selectattr('item', 'equalto', 'unknown') |
| 114 | + | map(attribute='stdout') | first | default('0')) | trim }} |
| 115 | + openstack_test_leak_expected: >- |
| 116 | + {{ (openstack_test_leak_cluster_count.stdout | default('0')) | trim }} |
| 117 | +
|
| 118 | + - name: Compute machines leak-cluster resolvable count |
| 119 | + ansible.builtin.set_fact: |
| 120 | + openstack_test_leak_resolvable: >- |
| 121 | + {{ ( |
| 122 | + (openstack_test_leak_passed | int) |
| 123 | + + (openstack_test_leak_skipped | int) |
| 124 | + + (openstack_test_leak_failed | int) |
| 125 | + ) }} |
| 126 | +
|
| 127 | + - name: Print machines leak-cluster rescue counts |
| 128 | + ansible.builtin.debug: |
| 129 | + msg: >- |
| 130 | + machines_leak_cluster rescue counts: passed={{ openstack_test_leak_passed }}, |
| 131 | + failed={{ openstack_test_leak_failed }}, skipped={{ openstack_test_leak_skipped }}, |
| 132 | + unknown={{ openstack_test_leak_unknown }}, expected={{ openstack_test_leak_expected }}, |
| 133 | + resolvable={{ openstack_test_leak_resolvable }} |
| 134 | +
|
94 | 135 | - name: Mark openstack-test UNSTABLE after machines leak-cluster serial failure |
95 | 136 | ansible.builtin.include_role: |
96 | 137 | name: tools_stage_results |
|
99 | 140 | unstable_msg: >- |
100 | 141 | openstack_test serial coda failed (Machine leak cluster, egressIP / |
101 | 142 | prometheus resize, and/or topology enable_topology pair). |
| 143 | + when: > |
| 144 | + ((openstack_test_leak_failed | default('0')) | int > 0) |
| 145 | + or ((openstack_test_leak_unknown | default('0')) | int > 0) |
| 146 | + or ( |
| 147 | + (openstack_test_leak_resolvable | default('0')) | int |
| 148 | + != (openstack_test_leak_expected | default('0')) | int |
| 149 | + ) |
| 150 | +
|
| 151 | + always: |
| 152 | + # Publish coda results like lb_ovn when junit exists. No ignore_errors: |
| 153 | + # publish failure must fail the stage so results are not silently missing. |
| 154 | + - name: Stat serial-coda junit before post |
| 155 | + ansible.builtin.stat: |
| 156 | + path: "{{ openstack_test_serial_coda_junit_path }}" |
| 157 | + register: openstack_test_serial_coda_junit_stat |
| 158 | + failed_when: false |
| 159 | + when: |
| 160 | + - openstack_test_serial_coda_junit_path is defined |
| 161 | + - openstack_test_leak_cluster_stat.stat.exists | default(false) |
| 162 | + - (openstack_test_leak_cluster_count.stdout | default('0') | trim | int) > 0 |
| 163 | + |
| 164 | + - name: Post serial-coda openshift-test results |
| 165 | + ansible.builtin.include_role: |
| 166 | + name: tools_openshift_tests |
| 167 | + tasks_from: post_openshift_tests.yml |
| 168 | + vars: |
| 169 | + testsuite_name: "{{ openstack_test_serial_coda_testsuite_name }}" |
| 170 | + key_for_filtering_results: "openstack" |
| 171 | + test_name: "{{ openstack_test_name }}" |
| 172 | + results_dir: "{{ openstack_test_serial_coda_results_dir }}" |
| 173 | + when: |
| 174 | + - openstack_test_serial_coda_junit_stat.stat.exists | default(false) |
0 commit comments