TEST-45-TIMEDATE: rotate journal before parsing log message

Similar to 04ade57a42.

Fixes the following failure (long line is wrapped):
```
TEST-45-TIMEDATE.sh[234]: + journalctl --sync
TEST-45-TIMEDATE.sh[234]: + for _ in {0..9}
TEST-45-TIMEDATE.sh[234]: + journalctl -q -n 1 '--since=2025-09-01 17:09:25.442936' -p info -t busctl --grep .
TEST-45-TIMEDATE.sh[363]: Sep 01 17:09:25 H busctl[351]: {"type":"signal","endian":"l","flags":1,"version":1,
  "cookie":67,"timestamp-realtime":1756746565578529,"sender":":1.11","path":"/org/freedesktop/timedate1",
  "interface":"org.freedesktop.DBus.Properties","member":"PropertiesChanged","payload":{"type":"sa{sv}as",
    "data":["org.freedesktop.timedate1",{"NTP":{"type":"b","data":false}},[]]}}
TEST-45-TIMEDATE.sh[366]: ++ journalctl -q -n 1 '--since=2025-09-01 17:09:25.442936' -p info -t busctl -o cat
TEST-45-TIMEDATE.sh[367]: ++ jq -r '.payload.data[1].NTP.data'
TEST-45-TIMEDATE.sh[366]: Journal file /run/log/journal/07946b7846564ac0ad1c86e8cabed329/system.journal is truncated, ignoring file.
TEST-45-TIMEDATE.sh[234]: + [[ '' == \f\a\l\s\e ]]
```
This commit is contained in:
Yu Watanabe
2025-09-02 08:34:26 +09:00
committed by Luca Boccassi
parent 5a8b9fd49f
commit cbbed2bd44

View File

@@ -224,6 +224,9 @@ assert_timedated_signal() {
for _ in {0..9}; do
if journalctl "${args[@]}" --grep .; then
# Make the found entry in the archived journal, to avoid the following failure:
# Journal file /run/log/journal/.../system.journal is truncated, ignoring file.
journalctl --rotate
[[ "$(journalctl "${args[@]}" -o cat | jq -r '.payload.data[1].NTP.data')" == "$value" ]];
return 0
fi
@@ -304,6 +307,9 @@ assert_timesyncd_signal() {
for _ in {0..9}; do
if journalctl "${args[@]}" --grep .; then
# Make the found entry in the archived journal, to avoid the following failure:
# Journal file /run/log/journal/.../system.journal is truncated, ignoring file.
journalctl --rotate
[[ "$(journalctl "${args[@]}" -o cat | jq -r ".payload.data[1].$property.data | join(\" \")")" == "$value" ]];
return 0
fi