test(wp7-02): require bounded timeout retry evidence
Dada P0-A isolated Windows CI / validate-and-package (push) Failing after 1m25s
Dada P0-A isolated Windows CI / validate-and-package (push) Failing after 1m25s
This commit is contained in:
@@ -176,6 +176,34 @@ test("TDD-WP7-EXT-001 executes only five real success probes per model and keeps
|
|||||||
await assert.rejects(() => runControlledRealScenarios({ maxRealCalls: 121, modelConfig: models[0], token: "not-used" }), /WP7_02_REAL_CALL_LIMIT_INVALID/);
|
await assert.rejects(() => runControlledRealScenarios({ maxRealCalls: 121, modelConfig: models[0], token: "not-used" }), /WP7_02_REAL_CALL_LIMIT_INVALID/);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("TDD-WP7-EXT-001 retries one timeout once and records every real attempt", async () => {
|
||||||
|
let fetchCalls = 0;
|
||||||
|
const execution = await runControlledRealScenarios({
|
||||||
|
fetchImpl: async () => {
|
||||||
|
fetchCalls += 1;
|
||||||
|
if (fetchCalls === 1) {
|
||||||
|
const timeout = new Error("sanitized timeout fixture");
|
||||||
|
timeout.name = "AbortError";
|
||||||
|
throw timeout;
|
||||||
|
}
|
||||||
|
return new Response(JSON.stringify({
|
||||||
|
candidates: [{ content: { parts: [{ inlineData: { data: onePixelPng.toString("base64"), mimeType: "image/png" } }] } }],
|
||||||
|
}), { status: 200 });
|
||||||
|
},
|
||||||
|
maxRealCalls: 120,
|
||||||
|
modelConfig: models[0],
|
||||||
|
token: "controlled-secret-value-for-test-only",
|
||||||
|
});
|
||||||
|
assert.equal(fetchCalls, 6);
|
||||||
|
assert.equal(execution.real_calls, 6);
|
||||||
|
assert.equal(execution.calls.length, 5);
|
||||||
|
assert.equal(execution.attempts.length, 6);
|
||||||
|
assert.deepEqual(execution.attempts.slice(0, 2).map((attempt) => [attempt.scenario_id, attempt.attempt_no, attempt.error_code ?? attempt.status]), [
|
||||||
|
["real-1", 1, "WP7_02_UPSTREAM_TIMEOUT"],
|
||||||
|
["real-1", 2, "failed"],
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
test("TDD-WP7-EXT-001 describes only protocol structure and stops repeated contract-shape calls", async () => {
|
test("TDD-WP7-EXT-001 describes only protocol structure and stops repeated contract-shape calls", async () => {
|
||||||
let fetchCalls = 0;
|
let fetchCalls = 0;
|
||||||
const execution = await runControlledRealScenarios({
|
const execution = await runControlledRealScenarios({
|
||||||
|
|||||||
Reference in New Issue
Block a user