From c703c1c2e40cb0bc62a0c2d44ec6951d87cb1cef Mon Sep 17 00:00:00 2001 From: Johannes Schmidt Date: Wed, 22 Apr 2026 11:31:01 +0200 Subject: [PATCH] Relax all timeouts for PerfdataWriterConnection test-cases This isn't strictly necessary, but since tests are now running in parallel, it doesn't hurt to give slower machines more time to complete these tests and this gives a little more headroom for potential changes that subtly affect the behavor of the components involved (like boost new versions). --- test/perfdata-elasticsearchwriter.cpp | 4 ++-- test/perfdata-gelfwriter.cpp | 4 ++-- test/perfdata-graphitewriter.cpp | 4 ++-- test/perfdata-influxdbwriter.cpp | 2 +- test/perfdata-opentsdbwriter.cpp | 4 ++-- test/perfdata-perfdatawriterconnection.cpp | 28 +++++++++++----------- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/test/perfdata-elasticsearchwriter.cpp b/test/perfdata-elasticsearchwriter.cpp index ac6abac8d..4cb387356 100644 --- a/test/perfdata-elasticsearchwriter.cpp +++ b/test/perfdata-elasticsearchwriter.cpp @@ -45,13 +45,13 @@ BOOST_AUTO_TEST_CASE(pause_with_pending_work) ResumeWriter(); // Process check-results until the writer is stuck. - BOOST_REQUIRE_MESSAGE(GetWriterStuck(10s), "Failed to get Writer stuck."); + BOOST_REQUIRE_MESSAGE(GetWriterStuck(20s), "Failed to get Writer stuck."); // Now try to pause. PauseWriter(); REQUIRE_LOG_MESSAGE("Connection stopped\\.", 10s); - REQUIRE_LOG_MESSAGE("'ElasticsearchWriter' paused\\.", 10s); + REQUIRE_LOG_MESSAGE("'ElasticsearchWriter' paused\\.", 1s); } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/perfdata-gelfwriter.cpp b/test/perfdata-gelfwriter.cpp index 8da07bc4a..0d98423e5 100644 --- a/test/perfdata-gelfwriter.cpp +++ b/test/perfdata-gelfwriter.cpp @@ -36,12 +36,12 @@ BOOST_AUTO_TEST_CASE(pause_with_pending_work) ResumeWriter(); // Process check-results until the writer is stuck. - BOOST_REQUIRE_MESSAGE(GetWriterStuck(10s), "Failed to get Writer stuck."); + BOOST_REQUIRE_MESSAGE(GetWriterStuck(20s), "Failed to get Writer stuck."); // Now stop reading and try to pause OpenTsdbWriter. PauseWriter(); - REQUIRE_LOG_MESSAGE("Connection stopped\\.", 1s); + REQUIRE_LOG_MESSAGE("Connection stopped\\.", 10s); REQUIRE_LOG_MESSAGE("'GelfWriter' paused\\.", 1s); } diff --git a/test/perfdata-graphitewriter.cpp b/test/perfdata-graphitewriter.cpp index 9b5789fe2..a175ba1c5 100644 --- a/test/perfdata-graphitewriter.cpp +++ b/test/perfdata-graphitewriter.cpp @@ -35,13 +35,13 @@ BOOST_AUTO_TEST_CASE(pause_with_pending_work) ResumeWriter(); // Process check-results until the writer is stuck. - BOOST_REQUIRE_MESSAGE(GetWriterStuck(10s), "Failed to get Writer stuck."); + BOOST_REQUIRE_MESSAGE(GetWriterStuck(20s), "Failed to get Writer stuck."); // Now stop reading and try to pause OpenTsdbWriter. PauseWriter(); REQUIRE_LOG_MESSAGE("Connection stopped\\.", 10s); - REQUIRE_LOG_MESSAGE("'GraphiteWriter' paused\\.", 10s); + REQUIRE_LOG_MESSAGE("'GraphiteWriter' paused\\.", 1s); } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/perfdata-influxdbwriter.cpp b/test/perfdata-influxdbwriter.cpp index 43837b50f..a10229a2c 100644 --- a/test/perfdata-influxdbwriter.cpp +++ b/test/perfdata-influxdbwriter.cpp @@ -38,7 +38,7 @@ BOOST_AUTO_TEST_CASE(pause_with_pending_work) ResumeWriter(); // Process check-results until the writer is stuck. - BOOST_REQUIRE_MESSAGE(GetWriterStuck(10s), "Failed to get Writer stuck."); + BOOST_REQUIRE_MESSAGE(GetWriterStuck(20s), "Failed to get Writer stuck."); // Now try to pause. PauseWriter(); diff --git a/test/perfdata-opentsdbwriter.cpp b/test/perfdata-opentsdbwriter.cpp index c3ec47d6d..5a3fb8d62 100644 --- a/test/perfdata-opentsdbwriter.cpp +++ b/test/perfdata-opentsdbwriter.cpp @@ -41,13 +41,13 @@ BOOST_AUTO_TEST_CASE(pause_with_pending_work) ResumeWriter(); // Process check-results until the writer is stuck. - BOOST_REQUIRE_MESSAGE(GetWriterStuck(10s), "Failed to get Writer stuck."); + BOOST_REQUIRE_MESSAGE(GetWriterStuck(20s), "Failed to get Writer stuck."); // Now stop reading and try to pause OpenTsdbWriter. PauseWriter(); REQUIRE_LOG_MESSAGE("Connection stopped\\.", 10s); - REQUIRE_LOG_MESSAGE("'OpenTsdbWriter' paused\\.", 10s); + REQUIRE_LOG_MESSAGE("'OpenTsdbWriter' paused\\.", 1s); } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/perfdata-perfdatawriterconnection.cpp b/test/perfdata-perfdatawriterconnection.cpp index 0f2435198..cd1d90b31 100644 --- a/test/perfdata-perfdatawriterconnection.cpp +++ b/test/perfdata-perfdatawriterconnection.cpp @@ -56,14 +56,14 @@ BOOST_AUTO_TEST_CASE(connection_refused) std::promise p; TestThread timeoutThread{[&]() { auto f = p.get_future(); - GetConnection().CancelAfterTimeout(f, 50ms); + GetConnection().CancelAfterTimeout(f, 250ms); }}; BOOST_REQUIRE_THROW( GetConnection().Send(boost::asio::const_buffer{"foobar", 7}), PerfdataWriterConnection::Stopped ); - REQUIRE_JOINS_WITHIN(timeoutThread, 1s); + REQUIRE_JOINS_WITHIN(timeoutThread, 10s); } /* The PerfdataWriterConnection connects automatically when sending the first data. @@ -86,7 +86,7 @@ BOOST_AUTO_TEST_CASE(ensure_connected) BOOST_REQUIRE_NO_THROW(GetConnection().Disconnect()); disconnectedPromise.set_value(); - REQUIRE_JOINS_WITHIN(mockTargetThread, 1s); + REQUIRE_JOINS_WITHIN(mockTargetThread, 10s); } /* Verify that data can still be sent while CancelAfterTimeout is waiting and the timeout @@ -113,15 +113,15 @@ BOOST_AUTO_TEST_CASE(finish_during_timeout) TestThread timeoutThread{[&]() { auto f = p.get_future(); - GetConnection().CancelAfterTimeout(f, 50ms); + GetConnection().CancelAfterTimeout(f, 250ms); BOOST_REQUIRE(f.wait_for(0ms) == std::future_status::ready); BOOST_REQUIRE(!GetConnection().IsConnected()); }}; GetConnection().Send(boost::asio::const_buffer{"foobar", 7}); - REQUIRE_JOINS_WITHIN(timeoutThread, 1s); - REQUIRE_JOINS_WITHIN(mockTargetThread, 1s); + REQUIRE_JOINS_WITHIN(timeoutThread, 10s); + REQUIRE_JOINS_WITHIN(mockTargetThread, 10s); } /* For the client, even a hanging server will accept the connection immediately, since it's done @@ -134,7 +134,7 @@ BOOST_AUTO_TEST_CASE(stuck_in_handshake) TestThread timeoutThread{[&]() { Accept(); auto f = p.get_future(); - GetConnection().CancelAfterTimeout(f, 50ms); + GetConnection().CancelAfterTimeout(f, 250ms); BOOST_REQUIRE(f.wait_for(0ms) == std::future_status::timeout); }}; @@ -142,7 +142,7 @@ BOOST_AUTO_TEST_CASE(stuck_in_handshake) GetConnection().Send(boost::asio::const_buffer{"foobar", 7}), PerfdataWriterConnection::Stopped ); - REQUIRE_JOINS_WITHIN(timeoutThread, 1s); + REQUIRE_JOINS_WITHIN(timeoutThread, 10s); } /* When the disconnect timeout runs out while sending something to a slow or blocking server, we @@ -185,8 +185,8 @@ BOOST_AUTO_TEST_CASE(stuck_sending) BOOST_REQUIRE_THROW(GetConnection().Send(buf), PerfdataWriterConnection::Stopped); shutdownPromise.set_value(); - REQUIRE_JOINS_WITHIN(timeoutThread, 1s); - REQUIRE_JOINS_WITHIN(mockTargetThread, 1s); + REQUIRE_JOINS_WITHIN(timeoutThread, 10s); + REQUIRE_JOINS_WITHIN(mockTargetThread, 10s); } /* This simulates a server that is stuck after receiving a HTTP request and before sending their @@ -226,8 +226,8 @@ BOOST_AUTO_TEST_CASE(stuck_reading_response) BOOST_REQUIRE_THROW(GetConnection().Send(request), PerfdataWriterConnection::Stopped); shutdownPromise.set_value(); - REQUIRE_JOINS_WITHIN(timeoutThread, 1s); - REQUIRE_JOINS_WITHIN(mockTargetThread, 1s); + REQUIRE_JOINS_WITHIN(timeoutThread, 10s); + REQUIRE_JOINS_WITHIN(mockTargetThread, 10s); } /* This test simulates a server that closes the connection and reappears at a later time. @@ -261,7 +261,7 @@ BOOST_AUTO_TEST_CASE(reconnect_failed) BOOST_REQUIRE_NO_THROW(GetConnection().Send(boost::asio::const_buffer{randomData.data(), randomData.size()})); BOOST_REQUIRE_NO_THROW(GetConnection().Disconnect()); - REQUIRE_JOINS_WITHIN(mockTargetThread, 1s); + REQUIRE_JOINS_WITHIN(mockTargetThread, 10s); } /* This tests if retrying an http send will reproducibly lead to the exact same message being @@ -329,7 +329,7 @@ BOOST_AUTO_TEST_CASE(http_send_retry) BOOST_REQUIRE_NO_THROW(GetConnection().Send(request)); BOOST_REQUIRE_NO_THROW(GetConnection().Disconnect()); - REQUIRE_JOINS_WITHIN(mockTargetThread, 1s); + REQUIRE_JOINS_WITHIN(mockTargetThread, 10s); } BOOST_AUTO_TEST_SUITE_END()