From 8c6fecd356003309f8eebec30374344272ca6072 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 19 Mar 2026 12:33:48 +0000 Subject: 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. --- test/test-ingest.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/test-ingest.cpp') 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); -- cgit v1.3