valeriyvdovin / rpms / systemd

Forked from rpms/systemd 4 years ago
Clone

Blame SOURCES/0805-tests-add-regression-test-for-systemctl-restart-syst.patch

ff2b41
From e3468af46bd16e3550c25a0770f47f0bf21780f3 Mon Sep 17 00:00:00 2001
ff2b41
From: Evgeny Vereshchagin <evvers@ya.ru>
ff2b41
Date: Wed, 30 Dec 2015 03:33:43 +0000
ff2b41
Subject: [PATCH] tests: add regression test for `systemctl restart
ff2b41
 systemd-journald`
ff2b41
ff2b41
See https://github.com/systemd/systemd/issues/2236
ff2b41
ff2b41
(cherry picked from commit 3889613ec6bc54b9e02955f62b9d5c5b571c3d4b)
ff2b41
(cherry picked from commit 4dc893c03fe9c56a3d3070fb8583f5584014aa49)
ff2b41
Resolves: #1803802
ff2b41
---
ff2b41
 test/TEST-04-JOURNAL/test-journal.sh | 8 ++++++++
ff2b41
 test/TEST-04-JOURNAL/test.sh         | 9 +++++++++
ff2b41
 2 files changed, 17 insertions(+)
ff2b41
ff2b41
diff --git a/test/TEST-04-JOURNAL/test-journal.sh b/test/TEST-04-JOURNAL/test-journal.sh
ff2b41
index c75f396ceb..701b0cf724 100755
ff2b41
--- a/test/TEST-04-JOURNAL/test-journal.sh
ff2b41
+++ b/test/TEST-04-JOURNAL/test-journal.sh
ff2b41
@@ -14,5 +14,13 @@ journalctl --flush
ff2b41
 journalctl -b -o cat -t "$ID" >/output
ff2b41
 cmp /expected /output
ff2b41
 
ff2b41
+# Don't lose streams on restart
ff2b41
+systemctl start forever-print-hola
ff2b41
+sleep 3
ff2b41
+systemctl restart systemd-journald
ff2b41
+sleep 3
ff2b41
+systemctl stop forever-print-hola
ff2b41
+[[ ! -f "/i-lose-my-logs" ]]
ff2b41
+
ff2b41
 touch /testok
ff2b41
 exit 0
ff2b41
diff --git a/test/TEST-04-JOURNAL/test.sh b/test/TEST-04-JOURNAL/test.sh
ff2b41
index e37cb7d412..6aea67ba4e 100755
ff2b41
--- a/test/TEST-04-JOURNAL/test.sh
ff2b41
+++ b/test/TEST-04-JOURNAL/test.sh
ff2b41
@@ -55,6 +55,15 @@ After=multi-user.target
ff2b41
 [Service]
ff2b41
 ExecStart=/test-journal.sh
ff2b41
 Type=oneshot
ff2b41
+EOF
ff2b41
+
ff2b41
+        cat >$initdir/etc/systemd/system/forever-print-hola.service <
ff2b41
+[Unit]
ff2b41
+Description=ForeverPrintHola service
ff2b41
+
ff2b41
+[Service]
ff2b41
+Type=simple
ff2b41
+ExecStart=/bin/sh -x -c 'while :; do printf "Hola\n" || touch /i-lose-my-logs; sleep 1; done'
ff2b41
 EOF
ff2b41
 
ff2b41
         cp test-journal.sh $initdir/