Skip to content

Commit 6fedea4

Browse files
nonassaAlan Lan
authored andcommitted
Fix QFP-3B flaky TestRequest test root cause: two-step sleep race condition (TICKET_489)
Previous fix widened sleep margin but didn't address the actual race: on loaded macOS CI runners, sleep_for(1100ms) can overshoot past the 1500ms TestRequest threshold, causing the first on_timer_tick() to send a TestRequest that capture.clear() then erases. Replace two-step sleep with single 1700ms sleep.
1 parent ccac5a4 commit 6fedea4

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

tests/test_quickfix_parity.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -683,11 +683,11 @@ TEST_CASE("QFP-3B: TestRequest sent after 1.5x HeartBtInt no receive",
683683
REQUIRE(session.state() == SessionState::Active);
684684
capture.clear();
685685

686-
std::this_thread::sleep_for(std::chrono::milliseconds(1100));
687-
session.on_timer_tick();
688-
capture.clear();
689-
690-
std::this_thread::sleep_for(std::chrono::milliseconds(800));
686+
// Sleep past 1.5x HeartBtInt (1500ms) but under 2x (2000ms) timeout.
687+
// Single sleep avoids the flaky two-step approach where OS scheduling
688+
// jitter on CI could push the first sleep past the TestRequest threshold,
689+
// causing capture.clear() to erase it.
690+
std::this_thread::sleep_for(std::chrono::milliseconds(1700));
691691
session.on_timer_tick();
692692

693693
REQUIRE(capture.has_msg_type(msg_type::TestRequest));

0 commit comments

Comments
 (0)