Skip to content

Commit

Permalink
test: make TEST-04 stable once again
Browse files Browse the repository at this point in the history
Wait a bit if necessary for the cursor file to appear.

Follow-up fb35fea.

(cherry picked from commit 57130ca)

Related: RHEL-30567
  • Loading branch information
mrc0mmand authored and dtardon committed Apr 10, 2024
1 parent 887be88 commit 0f2aa61
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/units/testsuite-04.sh
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,15 @@ set -o pipefail

# https://github.com/systemd/systemd/issues/26746
rm -f /tmp/issue-26746-log /tmp/issue-26746-cursor
ID=$(systemd-id128 new)
ID="$(systemd-id128 new)"
journalctl -t "$ID" --follow --cursor-file=/tmp/issue-26746-cursor | tee /tmp/issue-26746-log &
systemd-cat -t "$ID" /bin/sh -c 'echo hogehoge'
# shellcheck disable=SC2016
timeout 10 bash -c 'while ! [[ -f /tmp/issue-26746-log && "$(cat /tmp/issue-26746-log)" =~ hogehoge ]]; do sleep .5; done'
pkill -TERM journalctl
test -f /tmp/issue-26746-cursor
CURSOR_FROM_FILE=$(cat /tmp/issue-26746-cursor)
CURSOR_FROM_JOURNAL=$(journalctl -t "$ID" --output export MESSAGE=hogehoge | sed -n -e '/__CURSOR=/ { s/__CURSOR=//; p }')
timeout 10 bash -c 'while ! test -f /tmp/issue-26746-cursor; do sleep .5; done'
CURSOR_FROM_FILE="$(cat /tmp/issue-26746-cursor)"
CURSOR_FROM_JOURNAL="$(journalctl -t "$ID" --output=export MESSAGE=hogehoge | sed -n -e '/__CURSOR=/ { s/__CURSOR=//; p }')"
test "$CURSOR_FROM_FILE" = "$CURSOR_FROM_JOURNAL"


Expand Down

0 comments on commit 0f2aa61

Please sign in to comment.