From 46eacf705c2404fb4301ecaa4f8c4df02a5a6af0 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Tue, 21 May 2024 01:53:02 +0900
Subject: [PATCH 0662/1160] test: call journalctl --sync just before reading
 journals

Otherwise, journal entries comes during sleep may not be read.

Follow-up for c22a112883a46e302dae587b809c459647363ceb.

(cherry picked from commit 123acb25605f904c9a52c67f00dfff2b299a7a58)
---
 test/units/testsuite-60.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/units/testsuite-60.sh b/test/units/testsuite-60.sh
index 6f4cba8319..c1afeddcd0 100755
--- a/test/units/testsuite-60.sh
+++ b/test/units/testsuite-60.sh
@@ -295,9 +295,9 @@ 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.
 journalctl --sync
-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
+if timeout 2m bash -c "until journalctl -u init.scope --since=$TS | grep -q '(mount-monitor-dispatch) entered rate limit'; do sleep 1; journalctl --sync; done"; then
     journalctl --sync
-    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"
+    timeout 2m bash -c "until journalctl -u init.scope --since=$TS | grep -q '(mount-monitor-dispatch) left rate limit'; do sleep 1; journalctl --sync; done"
 fi
 
 # Verify that the mount units are always cleaned up at the end.
-- 
2.33.0