Skip to content

Commit 9e131c9

Browse files
committed
test: add integration tests for first-boot warning fix
Signed-off-by: Sarita Mahajan <sarmahaj@redhat.com>
1 parent fa0cafe commit 9e131c9

2 files changed

Lines changed: 103 additions & 0 deletions

File tree

tests/greenboot-bootc.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,29 @@
119119
set_fact:
120120
failed_counter: "{{ failed_counter | int + 1 }}"
121121

122+
# case: check rollback detection still works on non-first boot
123+
- name: check rollback detection works correctly on non-first boot
124+
block:
125+
- name: get greenboot-healthcheck log from current boot (post-rollback)
126+
command: journalctl -b -0 -u greenboot-healthcheck.service --no-pager
127+
become: yes
128+
register: result_healthcheck_post_rollback
129+
130+
- assert:
131+
that:
132+
- "'FALLBACK BOOT DETECTED!' in result_healthcheck_post_rollback.stdout"
133+
- "'journalctl command failed' not in result_healthcheck_post_rollback.stdout"
134+
fail_msg: "Rollback detection failed on non-first boot or misleading warning found"
135+
success_msg: "Rollback correctly detected on non-first boot with no misleading warnings"
136+
137+
always:
138+
- set_fact:
139+
total_counter: "{{ total_counter | int + 1 }}"
140+
rescue:
141+
- name: failed count + 1
142+
set_fact:
143+
failed_counter: "{{ failed_counter | int + 1 }}"
144+
122145
# case: check greenboot-set-rollback-trigger log at first boot
123146
- name: check greenboot-set-rollback-trigger at first boot
124147
block:
@@ -142,6 +165,34 @@
142165
set_fact:
143166
failed_counter: "{{ failed_counter | int + 1 }}"
144167

168+
# case: check no misleading journalctl warning on first boot
169+
- name: check greenboot-healthcheck produces no warning on first boot
170+
block:
171+
- name: get earliest boot ID
172+
shell: journalctl --list-boots --no-pager | awk '$2 ~ /^[0-9a-f]{32}$/{print $2; exit}'
173+
become: yes
174+
register: first_boot_id
175+
176+
- name: get greenboot-healthcheck log from first boot
177+
command: "journalctl -b {{ first_boot_id.stdout }} -u greenboot-healthcheck.service --no-pager"
178+
become: yes
179+
register: result_healthcheck_first_boot
180+
181+
- assert:
182+
that:
183+
- "'journalctl command failed' not in result_healthcheck_first_boot.stdout"
184+
- "'FALLBACK BOOT DETECTED!' not in result_healthcheck_first_boot.stdout"
185+
fail_msg: "Misleading journalctl warning or false rollback detection found on first boot"
186+
success_msg: "No misleading warning and no false rollback detection on first boot"
187+
188+
always:
189+
- set_fact:
190+
total_counter: "{{ total_counter | int + 1 }}"
191+
rescue:
192+
- name: failed count + 1
193+
set_fact:
194+
failed_counter: "{{ failed_counter | int + 1 }}"
195+
145196
# case: check greenboot-set-rollback-trigger log at boot after upgrade
146197
- name: check greenboot-set-rollback-trigger at boot after upgrade
147198
block:

tests/greenboot-ostree.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,34 @@
7171
set_fact:
7272
failed_counter: "{{ failed_counter | int + 1 }}"
7373

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+
74102
- name: check /boot mount status
75103
shell: findmnt -r -o OPTIONS -n /boot | awk -F "," '{print $1}'
76104
register: result_boot_mount_before
@@ -212,6 +240,30 @@
212240
failed_counter: "{{ failed_counter | int + 1 }}"
213241
when: result_rollback is defined and result_rollback is succeeded
214242

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+
215267
# case: check boot-complete.target status
216268
- name: boot-complete.target should be active
217269
block:

0 commit comments

Comments
 (0)