diff --git a/core/tests/test_api_client.cpp b/core/tests/test_api_client.cpp index 456a32a..b03973e 100644 --- a/core/tests/test_api_client.cpp +++ b/core/tests/test_api_client.cpp @@ -463,7 +463,17 @@ void testPlatformBackendTimeout() const auto elapsed = std::chrono::steady_clock::now() - start; const long long ms = std::chrono::duration_cast(elapsed).count(); - const bool gave_up = !response.ok() && ms < 4000; + // 4000 was the old bound, chosen when nothing bounded the wait. The + // code now promises a hard ceiling of 2x the caller's budget + // (RequestDeadline in http_winhttp.cpp), so assert THAT -- 1400ms + // here, plus slack for a loaded runner. This is also the only signal + // that survives a green run: CTest prints nothing on success, so if + // WinHTTP's own erratic cancellation (measured at 1490-4506ms for + // this same 700ms budget) were doing the work instead of the + // watchdog, roughly half the attempts would land above this bound and + // say so, instead of quietly passing under a 4s ceiling. + constexpr long long kCeilingMs = 2500; + const bool gave_up = !response.ok() && ms < kCeilingMs; if (gave_up) ++timed_out; @@ -480,7 +490,7 @@ void testPlatformBackendTimeout() gave_up ? "gave up (expected)" : "WAITED OUT THE STALL"); ST_ASSERT(!response.ok()); - ST_ASSERT(ms < 4000); + ST_ASSERT(ms < kCeilingMs); } std::fprintf(stderr, " [timeout-probe] %d/%d attempts honoured the %ldms timeout\n", timed_out, kProbes, kTimeoutMs);