|
71 | 71 | set_fact: |
72 | 72 | failed_counter: "{{ failed_counter | int + 1 }}" |
73 | 73 |
|
| 74 | + # case: check no misleading journalctl warning on first boot |
| 75 | + - name: check greenboot-healthcheck produces no warning on first boot |
| 76 | + block: |
| 77 | + - name: get earliest boot ID |
| 78 | + shell: journalctl --list-boots --no-pager | awk '$2 ~ /^[0-9a-f]{32}$/{print $2; exit}' |
| 79 | + become: yes |
| 80 | + register: first_boot_id |
| 81 | + |
| 82 | + - name: get greenboot-healthcheck log from first boot |
| 83 | + command: "journalctl -b {{ first_boot_id.stdout }} -u greenboot-healthcheck.service --no-pager" |
| 84 | + become: yes |
| 85 | + register: result_healthcheck_first_boot |
| 86 | + |
| 87 | + - assert: |
| 88 | + that: |
| 89 | + - "'journalctl command failed' not in result_healthcheck_first_boot.stdout" |
| 90 | + - "'FALLBACK BOOT DETECTED!' not in result_healthcheck_first_boot.stdout" |
| 91 | + fail_msg: "Misleading journalctl warning or false rollback detection found on first boot" |
| 92 | + success_msg: "No misleading warning and no false rollback detection on first boot" |
| 93 | + |
| 94 | + always: |
| 95 | + - set_fact: |
| 96 | + total_counter: "{{ total_counter | int + 1 }}" |
| 97 | + rescue: |
| 98 | + - name: failed count + 1 |
| 99 | + set_fact: |
| 100 | + failed_counter: "{{ failed_counter | int + 1 }}" |
| 101 | + |
74 | 102 | - name: check /boot mount status |
75 | 103 | shell: findmnt -r -o OPTIONS -n /boot | awk -F "," '{print $1}' |
76 | 104 | register: result_boot_mount_before |
|
212 | 240 | failed_counter: "{{ failed_counter | int + 1 }}" |
213 | 241 | when: result_rollback is defined and result_rollback is succeeded |
214 | 242 |
|
| 243 | + # case: check rollback detection still works on non-first boot |
| 244 | + - name: check rollback detection works correctly on non-first boot |
| 245 | + block: |
| 246 | + - name: get greenboot-healthcheck log from current boot (post-rollback) |
| 247 | + command: journalctl -b -0 -u greenboot-healthcheck.service --no-pager |
| 248 | + become: yes |
| 249 | + register: result_healthcheck_post_rollback |
| 250 | + |
| 251 | + - assert: |
| 252 | + that: |
| 253 | + - "'FALLBACK BOOT DETECTED!' in result_healthcheck_post_rollback.stdout" |
| 254 | + - "'journalctl command failed' not in result_healthcheck_post_rollback.stdout" |
| 255 | + fail_msg: "Rollback detection failed on non-first boot or misleading warning found" |
| 256 | + success_msg: "Rollback correctly detected on non-first boot with no misleading warnings" |
| 257 | + |
| 258 | + always: |
| 259 | + - set_fact: |
| 260 | + total_counter: "{{ total_counter | int + 1 }}" |
| 261 | + rescue: |
| 262 | + - name: failed count + 1 |
| 263 | + set_fact: |
| 264 | + failed_counter: "{{ failed_counter | int + 1 }}" |
| 265 | + when: result_rollback is defined and result_rollback is succeeded |
| 266 | + |
215 | 267 | # case: check boot-complete.target status |
216 | 268 | - name: boot-complete.target should be active |
217 | 269 | block: |
|
0 commit comments