test: add test case for issue #31776

This commit is contained in:
Yu Watanabe
2024-03-21 04:44:39 +09:00
parent cb2be36650
commit bf995423fd
+8
View File
@@ -275,3 +275,11 @@ hello
world
EOF
rm -f "$CURSOR_FILE"
# Check that --until works with --after-cursor and --lines/-n
# See: https://github.com/systemd/systemd/issues/31776
CURSOR_FILE="$(mktemp)"
journalctl -q -n 0 --cursor-file="$CURSOR_FILE"
TIMESTAMP="$(journalctl -q -n 1 --cursor="$(<"$CURSOR_FILE")" --output=short-unix | cut -d ' ' -f 1 | cut -d '.' -f 1)"
[[ -z "$(journalctl -q -n 10 --after-cursor="$(<"$CURSOR_FILE")" --until "@$((TIMESTAMP - 3))")" ]]
rm -f "$CURSOR_FILE"