52 lines
1.8 KiB
Diff
52 lines
1.8 KiB
Diff
|
From 85782b1fb964e3b67a0276881bdba4ca9881dec3 Mon Sep 17 00:00:00 2001
|
||
|
From: Eric Garver <eric@garver.life>
|
||
|
Date: Thu, 2 Apr 2020 15:21:58 -0400
|
||
|
Subject: [PATCH 5/6] test: log: verify logging still works after truncate
|
||
|
|
||
|
The log policy we ship presumes firewalld opens log files in append
|
||
|
mode. This is because the logrotate policy uses "copytruncate". Lets
|
||
|
verify that it actually works as expected.
|
||
|
|
||
|
(cherry picked from commit e887c16512abd6a3051b0519ee9af344c9f08827)
|
||
|
(cherry picked from commit 2ab7f9e793a51c9aebe08fff6226c38159ae2312)
|
||
|
---
|
||
|
src/tests/regression/gh599.at | 16 ++++++++++++++++
|
||
|
src/tests/regression/regression.at | 1 +
|
||
|
2 files changed, 17 insertions(+)
|
||
|
create mode 100644 src/tests/regression/gh599.at
|
||
|
|
||
|
diff --git a/src/tests/regression/gh599.at b/src/tests/regression/gh599.at
|
||
|
new file mode 100644
|
||
|
index 000000000000..472f228ba2a9
|
||
|
--- /dev/null
|
||
|
+++ b/src/tests/regression/gh599.at
|
||
|
@@ -0,0 +1,16 @@
|
||
|
+FWD_START_TEST([writing to log after copytruncate])
|
||
|
+AT_KEYWORDS(gh599)
|
||
|
+
|
||
|
+AT_SKIP_IF([! NS_CMD([which truncate >/dev/null 2>&1])])
|
||
|
+AT_SKIP_IF([! NS_CMD([which wc >/dev/null 2>&1])])
|
||
|
+
|
||
|
+dnl Verify we continue to write to the log file after it's truncated. That is,
|
||
|
+dnl simulate logrotate's copytruncate.
|
||
|
+NS_CHECK([truncate -s 0 ./firewalld.log])
|
||
|
+
|
||
|
+dnl generate some logs, anything will do since we have debug enabled.
|
||
|
+FWD_CHECK([--list-all], 0, [ignore], [ignore])
|
||
|
+
|
||
|
+NS_CHECK([sh -c 'let "$(cat ./firewalld.log | wc -c) > 0"'])
|
||
|
+
|
||
|
+FWD_END_TEST
|
||
|
diff --git a/src/tests/regression/regression.at b/src/tests/regression/regression.at
|
||
|
index 8042c3a27f89..2528ddd3fede 100644
|
||
|
--- a/src/tests/regression/regression.at
|
||
|
+++ b/src/tests/regression/regression.at
|
||
|
@@ -27,3 +27,4 @@ m4_include([regression/gh509.at])
|
||
|
m4_include([regression/gh567.at])
|
||
|
m4_include([regression/rhbz1779835.at])
|
||
|
m4_include([regression/gh330.at])
|
||
|
+m4_include([regression/gh599.at])
|
||
|
--
|
||
|
2.23.0
|
||
|
|