daandemeyer / rpms / systemd

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