test: Write more data to fill socket buffer (#2433)

This commit is contained in:
Ayaz Salikhov
2025-08-14 12:02:10 +01:00
committed by GitHub
parent 7558348d14
commit af284dda37

View File

@@ -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);
});