]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: sync journal before reading journal
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 17 May 2024 04:03:44 +0000 (13:03 +0900)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 17 May 2024 05:46:02 +0000 (07:46 +0200)
Otherwise, expected lines may not be processed or not sync()ed to disk.

Fixes #32712.

test/units/TEST-60-MOUNT-RATELIMIT.sh

index d205a93a86bf4464d144e906767b79e541548ab4..b01c5dc7bf09b92f5023d4abb20abcd1d7d388a9 100755 (executable)
@@ -286,8 +286,8 @@ done
 
 # Figure out if we have entered the rate limit state.
 # If the infra is slow we might not enter the rate limit state; in that case skip the exit check.
-if timeout 2m bash -c "until journalctl -u init.scope --since=$TS | grep -q '(mount-monitor-dispatch) entered rate limit'; do sleep 1; done"; then
-    timeout 2m bash -c "until journalctl -u init.scope --since=$TS | grep -q '(mount-monitor-dispatch) left rate limit'; do sleep 1; done"
+if timeout 2m bash -c "until journalctl -u init.scope --since=$TS | grep -q '(mount-monitor-dispatch) entered rate limit'; do journalctl --sync; sleep 1; done"; then
+    timeout 2m bash -c "until journalctl -u init.scope --since=$TS | grep -q '(mount-monitor-dispatch) left rate limit'; do journalctl --sync; sleep 1; done"
 fi
 
 # Verify that the mount units are always cleaned up at the end.