refactor(qa-lab): merge scenario gateway env like config patches

This commit is contained in:
Ayaan Zaidi 2026-09-30 09:22:11 +05:30
parent dbc5955cd7
commit c8a2682be6
No known key found for this signature in database
2 changed files with 1 additions and 23 deletions

View file

@ -432,23 +432,6 @@ describe("qa suite planning helpers", () => {
});
});
it("merges scenario QA gateway env and rejects conflicting values", () => {
const stuck = makeQaSuiteTestScenario("stuck", {
gatewayRuntime: { env: { QA_DIAGNOSTIC_STUCK_SESSION_ABORT_MS: "30000" } },
});
expect(collectQaSuiteGatewayRuntimeOptions([makeQaSuiteTestScenario("plain"), stuck])).toEqual({
env: { QA_DIAGNOSTIC_STUCK_SESSION_ABORT_MS: "30000" },
});
expect(() =>
collectQaSuiteGatewayRuntimeOptions([
stuck,
makeQaSuiteTestScenario("slower", {
gatewayRuntime: { env: { QA_DIAGNOSTIC_STUCK_SESSION_ABORT_MS: "60000" } },
}),
]),
).toThrow(/QA_DIAGNOSTIC_STUCK_SESSION_ABORT_MS/);
});
it.each([
{
reason: "explicit scenario isolation",

View file

@ -262,12 +262,7 @@ function collectQaSuiteGatewayRuntimeOptions(scenarios: QaSeedScenario[]) {
allowUnhealthyStartup ||= scenario.gatewayRuntime?.allowUnhealthyStartup === true;
forwardHostHome ||= scenario.gatewayRuntime?.forwardHostHome === true;
preserveDebugArtifacts ||= scenario.gatewayRuntime?.preserveDebugArtifacts === true;
for (const [key, value] of Object.entries(scenario.gatewayRuntime?.env ?? {})) {
if (env[key] !== undefined && env[key] !== value) {
throw new Error(`conflicting QA gateway runtime env for ${key} in scenario ${scenario.id}`);
}
env[key] = value;
}
Object.assign(env, scenario.gatewayRuntime?.env);
}
const hasEnv = Object.keys(env).length > 0;
return allowUnhealthyStartup || forwardHostHome || preserveDebugArtifacts || hasEnv