|
| 1 | +--- |
| 2 | +# Copyright Red Hat, Inc. |
| 3 | +# All Rights Reserved. |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 6 | +# not use this file except in compliance with the License. You may obtain |
| 7 | +# a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 13 | +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 14 | +# License for the specific language governing permissions and limitations |
| 15 | +# under the License. |
| 16 | + |
| 17 | + |
| 18 | +- name: Verify inspect_namespace fallback handling |
| 19 | + hosts: all |
| 20 | + tasks: |
| 21 | + - name: Check that logs directory exists |
| 22 | + ansible.builtin.stat: |
| 23 | + path: "{{ ansible_user_dir }}/test-output/logs" |
| 24 | + register: logs_dir |
| 25 | + |
| 26 | + - name: Assert logs directory was created |
| 27 | + ansible.builtin.assert: |
| 28 | + that: |
| 29 | + - logs_dir.stat.exists |
| 30 | + - logs_dir.stat.isdir |
| 31 | + fail_msg: "Logs directory not found" |
| 32 | + success_msg: "Logs directory exists" |
| 33 | + |
| 34 | + - name: Find must-gather script log |
| 35 | + ansible.builtin.find: |
| 36 | + paths: "{{ ansible_user_dir }}/test-output/logs" |
| 37 | + patterns: "ci_script_*_run_openstack_must_gather.log" |
| 38 | + register: must_gather_logs |
| 39 | + |
| 40 | + - name: Assert must-gather log was created |
| 41 | + ansible.builtin.assert: |
| 42 | + that: |
| 43 | + - must_gather_logs.matched > 0 |
| 44 | + fail_msg: "Must-gather log file not found" |
| 45 | + success_msg: "Must-gather log file exists" |
| 46 | + |
| 47 | + - name: Read must-gather log |
| 48 | + ansible.builtin.slurp: |
| 49 | + src: "{{ must_gather_logs.files[0].path }}" |
| 50 | + register: log_content |
| 51 | + when: must_gather_logs.matched > 0 |
| 52 | + |
| 53 | + - name: Verify must-gather failed with non-timeout error |
| 54 | + ansible.builtin.assert: |
| 55 | + that: |
| 56 | + - "'Error: Image pull failed' in (log_content.content | b64decode)" |
| 57 | + when: must_gather_logs.matched > 0 |
| 58 | + |
| 59 | + - name: Check that oc_inspect directory was created |
| 60 | + ansible.builtin.stat: |
| 61 | + path: "{{ ansible_user_dir }}/test-output/logs/oc_inspect" |
| 62 | + register: oc_inspect_dir |
| 63 | + |
| 64 | + - name: Assert oc_inspect directory exists |
| 65 | + ansible.builtin.assert: |
| 66 | + that: |
| 67 | + - oc_inspect_dir.stat.exists |
| 68 | + - oc_inspect_dir.stat.isdir |
| 69 | + fail_msg: "oc_inspect directory not found - fallback didn't run" |
| 70 | + success_msg: "oc_inspect directory exists - fallback was triggered" |
| 71 | + |
| 72 | + - name: Find inspect script logs |
| 73 | + ansible.builtin.find: |
| 74 | + paths: "{{ ansible_user_dir }}/test-output/logs" |
| 75 | + patterns: "ci_script_*_inspect_namespaces_as_fallback*.log" |
| 76 | + register: inspect_logs |
| 77 | + |
| 78 | + - name: Verify inspect commands were executed |
| 79 | + ansible.builtin.assert: |
| 80 | + that: |
| 81 | + - inspect_logs.matched > 0 |
| 82 | + fail_msg: "No inspect logs found - oc adm inspect fallback didn't run" |
| 83 | + success_msg: "Inspect logs found - oc adm inspect fallback executed" |
0 commit comments