tests/test-history.sh: Make testing for working journalctl more robust

journalctl also prints something when the message didn't make it to
whatever journalctl connects to. Check for the specific message showing
up instead to make sure it all works as expected.
This commit is contained in:
Sebastian Wick
2025-11-24 17:38:35 +01:00
parent 9ebe43a0c7
commit e807ca3539

View File

@@ -15,13 +15,12 @@ skip_without_libsystemd
HISTORY_START_TIME=$(date +"%Y-%m-%d %H:%M:%S")
sleep 1
if ! logger "Checking whether Flatpak can use the journal..."; then
MESSAGE="Checking whether Flatpak can use the journal..."
if ! logger "${MESSAGE}"; then
skip "Cannot write to Journal with logger"
fi
messages="$(journalctl --user --since="${HISTORY_START_TIME}" || true)"
if [ -z "$messages" ]; then
if ! journalctl --user --since="${HISTORY_START_TIME}" | grep -q "${MESSAGE}"; then
skip "Cannot read back from Journal with journalctl"
fi