test: harden HTTP scenario execution evidence

This commit is contained in:
DongHyeonka
2026-08-02 11:36:27 +09:00
parent e08d8c2dd8
commit d2eb320936
6 changed files with 143 additions and 28 deletions
+20
View File
@@ -80,6 +80,26 @@ export const httpScenarioAssertionGroupsSchema = z
if (groups.retry.count !== groups.retry.reasons.length) {
fail(["retry", "count"], "must equal retry reasons length");
}
if (groups.retry.count !== groups.fetch.count - 1) {
fail(["retry", "count"], "must equal the non-final fetch attempt count");
}
for (const [index, reason] of groups.retry.reasons.entries()) {
const status = groups.status.attempts[index];
const expectedReason =
status === "NETWORK_REJECTION"
? "NETWORK_FAILURE"
: status === 429
? "HTTP_429"
: status === 503
? "HTTP_503"
: null;
if (reason !== expectedReason) {
fail(
["retry", "reasons", index],
"must match the corresponding non-final attempt status",
);
}
}
if (groups.fetch.count !== groups.status.attempts.length) {
fail(["fetch", "count"], "must equal status attempts length");
}