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