]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: Synchronize journal before reading from it
authordann frazier <dann.frazier@canonical.com>
Tue, 28 Jan 2020 01:45:17 +0000 (18:45 -0700)
committerLennart Poettering <lennart@poettering.net>
Tue, 28 Jan 2020 14:11:58 +0000 (15:11 +0100)
There's a race condition in the sysuser test where it may try to read
entries from the journal before they are available. Fix it by adding a
`journalctl --sync` call.

BugLink: https://bugs.launchpad.net/bugs/1776654
test/TEST-21-SYSUSERS/test.sh

index a1a2e62ab1b0c55df2255c712cfacf09ae4a6e6f..add16ea19fe1f1ec16dc1866b40047facb48d6bb 100755 (executable)
@@ -114,6 +114,7 @@ test_run() {
         prepare_testdir ${f%.input}
         cp $f $TESTDIR/usr/lib/sysusers.d/test.conf
         systemd-sysusers --root=$TESTDIR 2> /dev/null
+        journalctl --sync
         journalctl -t systemd-sysusers -o cat | tail -n1 > $TESTDIR/tmp/err
         if ! diff -u $TESTDIR/tmp/err  ${f%.*}.expected-err; then
             echo "**** Unexpected error output for $f"