1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 09:21:26 +03:00
systemd/test/units/testsuite-44.sh
Luca Boccassi cf9844ffab test: use systemd-run --wait in TEST-44-LOG-NAMESPACE
The test appears to be occasionally failing. It uses systemd-run to echo
'hello world' into a namespaced journal and then uses journalctl to look for it,
but it doesn't wait.
In the failed runs it can't find it, but the automated journal dump shows
the message at the end.

Use --wait to avoid races.
2021-04-15 08:16:19 +02:00

20 lines
436 B
Bash
Executable File

#!/usr/bin/env bash
set -eux
systemd-analyze log-level debug
systemd-run --wait -p LogNamespace=foobar echo "hello world"
journalctl --namespace=foobar --sync
journalctl -o cat --namespace=foobar >/tmp/hello-world
journalctl -o cat >/tmp/no-hello-world
grep "^hello world$" /tmp/hello-world
grep "^hello world$" /tmp/no-hello-world && { echo 'unexpected success'; exit 1; }
systemd-analyze log-level info
echo OK >/testok
exit 0