Skip to content

Commit

Permalink
tests: Work around systemd regression for boot id parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
cgwalters committed Nov 9, 2023
1 parent ce2a33e commit c668a8c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
12 changes: 7 additions & 5 deletions tests/kolainst/destructive/boot-automount.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ EOF
# Check that the finalize and hold services succeeded in the
# previous boot. Dump them to the test log to help debugging.
prepare_tmpdir
journalctl -b -1 -o short-monotonic \
prev_bootid=$(journalctl --list-boots -o json |jq -r '.[] | select(.index == -1) | .boot_id')
journalctl -b "${prev_bootid}" -o short-monotonic \
-u ostree-finalize-staged.service \
-u ostree-finalize-staged-hold.service \
-u boot.mount \
Expand All @@ -72,10 +73,11 @@ EOF

# Check that the hold service remained active and kept /boot mounted until
# the finalize service completed.
finalize_stopped=$(journalctl -b -1 -o json -g Stopped -u ostree-finalize-staged.service | tail -n1 | jq -r .__MONOTONIC_TIMESTAMP)
hold_stopping=$(journalctl -b -1 -o json -g Stopping -u ostree-finalize-staged-hold.service | tail -n1 | jq -r .__MONOTONIC_TIMESTAMP)
hold_stopped=$(journalctl -b -1 -o json -g Stopped -u ostree-finalize-staged-hold.service | tail -n1 | jq -r .__MONOTONIC_TIMESTAMP)
boot_unmounting=$(journalctl -b -1 -o json -g Unmounting -u boot.mount | tail -n1 | jq -r .__MONOTONIC_TIMESTAMP)
prev_bootid=$(journalctl --list-boots -o json |jq -r '.[] | select(.index == -1) | .boot_id')
finalize_stopped=$(journalctl -b $prev_bootid -o json -g Stopped -u ostree-finalize-staged.service | tail -n1 | jq -r .__MONOTONIC_TIMESTAMP)
hold_stopping=$(journalctl -b $prev_bootid -o json -g Stopping -u ostree-finalize-staged-hold.service | tail -n1 | jq -r .__MONOTONIC_TIMESTAMP)
hold_stopped=$(journalctl -b $prev_bootid -o json -g Stopped -u ostree-finalize-staged-hold.service | tail -n1 | jq -r .__MONOTONIC_TIMESTAMP)
boot_unmounting=$(journalctl -b $prev_bootid -o json -g Unmounting -u boot.mount | tail -n1 | jq -r .__MONOTONIC_TIMESTAMP)
test "${finalize_stopped}" -lt "${hold_stopping}"
test "${hold_stopped}" -lt "${boot_unmounting}"
;;
Expand Down
3 changes: 2 additions & 1 deletion tests/kolainst/destructive/staged-delay.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ rpm-ostree kargs --append=somedummykarg=1
;;

"2")
journalctl -b -1 -u ostree-finalize-staged > logs.txt
prev_bootid=$(journalctl --list-boots -o json |jq -r '.[] | select(.index == -1) | .boot_id')
journalctl -b $prev_bootid -u ostree-finalize-staged > logs.txt
assert_file_has_content_literal logs.txt 'ostree-finalize-staged found /boot/loader/entries'
# older systemd doesn't output the success message
if systemctl --version | head -1 | grep -qF -e 'systemd 239'; then
Expand Down
3 changes: 2 additions & 1 deletion tests/kolainst/destructive/staged-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ EOF
# Check that deploy-staged service worked
rpm-ostree status
# Assert that the previous boot had a journal entry for it
journalctl -b "-1" -u ostree-finalize-staged.service > svc.txt
prev_bootid=$(journalctl --list-boots -o json |jq -r '.[] | select(.index == -1) | .boot_id')
journalctl -b $prev_bootid -u ostree-finalize-staged.service > svc.txt
assert_file_has_content svc.txt 'Bootloader updated; bootconfig swap: yes;.*deployment count change: 1'
# Also validate ignoring socket and fifo
assert_file_has_content svc.txt 'Ignoring.*during /etc merge:.*sock-to-ignore'
Expand Down

0 comments on commit c668a8c

Please sign in to comment.