diff --git a/tests/unit/util/requests/WsConnectionTests.cpp b/tests/unit/util/requests/WsConnectionTests.cpp index d0856b88..7c1a37eb 100644 --- a/tests/unit/util/requests/WsConnectionTests.cpp +++ b/tests/unit/util/requests/WsConnectionTests.cpp @@ -170,9 +170,12 @@ TEST_F(WsConnectionTests, WriteTimeout) // Write is success even if the other side is not reading. // It seems we need to fill some socket buffer before the timeout occurs. - while (not error.has_value()) { - error = connection->write("hello", yield, std::chrono::milliseconds{1}); + size_t counter = 0; + while (not error.has_value() and counter < 100) { + error = connection->write(std::string(100'000, 'a'), yield, std::chrono::milliseconds{1}); + ++counter; } + EXPECT_LT(counter, 100); ASSERT_TRUE(error.has_value()); EXPECT_EQ(error->errorCode().value().value(), asio::error::timed_out); });