test: assert the 2x-budget ceiling the watchdog now guarantees, not 4s
Build / macOS (macos-latest) (push) Successful in 53s
Build / Linux (ubuntu-24.04) (push) Successful in 1m23s
Build / macOS (macos-latest) (pull_request) Successful in 46s
Build / Linux (ubuntu-24.04) (pull_request) Successful in 1m19s
Build / Windows (windows-latest) (push) Successful in 3m57s
Build / Windows (windows-latest) (pull_request) Successful in 3m59s
Build / macOS (macos-latest) (push) Successful in 53s
Build / Linux (ubuntu-24.04) (push) Successful in 1m23s
Build / macOS (macos-latest) (pull_request) Successful in 46s
Build / Linux (ubuntu-24.04) (pull_request) Successful in 1m19s
Build / Windows (windows-latest) (push) Successful in 3m57s
Build / Windows (windows-latest) (pull_request) Successful in 3m59s
The Windows job went green, but CTest prints test output only on failure, so a pass says nothing about WHAT cancelled the request. Under the old 4000ms bound a pass is ambiguous: the watchdog firing at ~1400ms and WinHTTP's own erratic cancellation (measured at 1490-4506ms for this same 700ms budget) both fit under it. So assert the guarantee the code actually makes now -- a hard ceiling of twice the caller's budget -- at 2500ms, which is 1400ms plus slack for a loaded runner. If the watchdog stops doing the work, roughly half the attempts land above this and print their elapsed time and error string, instead of quietly passing. Linux is unaffected: curl honours the 700ms budget exactly, 5/5 at ~701ms. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AzGnvQ6wfD7bw7PZN35ft9
This commit is contained in:
@@ -463,7 +463,17 @@ void testPlatformBackendTimeout()
|
||||
const auto elapsed = std::chrono::steady_clock::now() - start;
|
||||
const long long ms = std::chrono::duration_cast<std::chrono::milliseconds>(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);
|
||||
|
||||
Reference in New Issue
Block a user