mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-11-21 20:01:46 +00:00
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.
This commit is contained in:
1 parent
e1bc9c0140
commit
dac2f48003
1 file changed
+11
-4
+11
-4
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user