From dac2f480032438d8cbd422305522a5beb76403a0 Mon Sep 17 00:00:00 2001 From: yhirose Date: Sat, 21 Nov 2026 13:58:31 -0500 Subject: [PATCH] Make two keep-alive parking tests hold up on busy CI runners The backlog test queued two jobs before a worker could take the first, which a queue with room for one turns away. The zero-timeout test now tries a few connections, since one can miss the 10 ms floor on a busy machine. --- test/test.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/test/test.cc b/test/test.cc index fa85b233..7f26e98a 100644 --- a/test/test.cc +++ b/test/test.cc @@ -34447,11 +34447,12 @@ TEST(KeepAliveParkingTest, BacklogIsRetriedOnceTheQueueHasRoom) { auto a = socks.connect(running.port); ASSERT_TRUE(get_ok(a, 2000)); - // B and D take both workers, and C fills the queue. + // B and D take both workers, and C fills the queue. One at a time: the + // queue has room for one job only until a worker takes it. ASSERT_TRUE(send_get(socks.connect(running.port), "/first")); + ASSERT_TRUE(wait_until([&] { return first.entered() == 1; }, 2000)); ASSERT_TRUE(send_get(socks.connect(running.port), "/second")); - ASSERT_TRUE(wait_until( - [&] { return first.entered() == 1 && second.entered() == 1; }, 2000)); + ASSERT_TRUE(wait_until([&] { return second.entered() == 1; }, 2000)); ASSERT_TRUE(send_get(socks.connect(running.port), "/second")); ASSERT_TRUE(wait_until([&] { return queued == 4; }, 2000)); @@ -34477,7 +34478,13 @@ TEST(KeepAliveParkingTest, ZeroKeepAliveTimeoutServesTheFirstRequest) { RunningServer running(svr); Sockets socks; - EXPECT_TRUE(get_ok(socks.connect(running.port), 1000)); + // The request has to arrive within the 10 ms floor, which a busy machine + // can miss once. Without the floor every attempt fails. + auto served = false; + for (int i = 0; i < 5 && !served; i++) { + served = get_ok(socks.connect(running.port), 1000); + } + EXPECT_TRUE(served); } TEST(KeepAliveParkingTest, StopClosesParkedConnectionsPromptly) {