summaryrefslogtreecommitdiff
path: root/test/test-ingest.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan.goodliffe@octal.co.uk>2026-03-19 12:33:48 +0000
committerDan Goodliffe <dan.goodliffe@octal.co.uk>2026-03-19 12:33:48 +0000
commit8c6fecd356003309f8eebec30374344272ca6072 (patch)
tree023f79e07a3abd0829c91bfffd5d2a5657d8a225 /test/test-ingest.cpp
parentee01cb7017e3895419544a0385f90f8eb0498680 (diff)
downloadwebstat-8c6fecd356003309f8eebec30374344272ca6072.tar.bz2
webstat-8c6fecd356003309f8eebec30374344272ca6072.tar.xz
webstat-8c6fecd356003309f8eebec30374344272ca6072.zip
Gracefully handle SIGTERM
Apache sends SIGTERM to the logger process to it shutdown. Honestly I thought it would just close stdin and I should have checked.
Diffstat (limited to 'test/test-ingest.cpp')
-rw-r--r--test/test-ingest.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/test-ingest.cpp b/test/test-ingest.cpp
index 41b3690..be3be56 100644
--- a/test/test-ingest.cpp
+++ b/test/test-ingest.cpp
@@ -249,6 +249,19 @@ BOOST_AUTO_TEST_CASE(StoreLog, *boost::unit_test::depends_on("I/StoreLogLine"))
BOOST_CHECK_EQUAL(linesDiscarded, 0);
}
+BOOST_AUTO_TEST_CASE(TerminateHandler, *boost::unit_test::timeout(5))
+{
+ WebStat::FilePtr input {fopen("/dev/null", "r")};
+ BOOST_REQUIRE(input);
+ BOOST_REQUIRE(!terminated);
+ raise(SIGTERM);
+ BOOST_REQUIRE(terminated);
+ ingestLog(input.get());
+ BOOST_CHECK_EQUAL(linesRead, 0);
+ BOOST_CHECK_EQUAL(linesParsed, 0);
+ BOOST_CHECK_EQUAL(linesDiscarded, 0);
+}
+
BOOST_AUTO_TEST_CASE(ParkLogLine)
{
parkLogLine(LOGLINE1);