fix(qa): reject invalid qa lab ports
Some checks failed
CI / checks-node-compat-node22 (push) Blocked by required conditions
CI / -3 (push) Blocked by required conditions
CI / check-dependencies (push) Blocked by required conditions
CI / check-guards (push) Blocked by required conditions
CI / check-lint (push) Blocked by required conditions
CI / check-prod-types (push) Blocked by required conditions
CI / check-shrinkwrap (push) Blocked by required conditions
CI / check-test-types (push) Blocked by required conditions
CI / check-additional-boundaries-a (push) Blocked by required conditions
CI / check-additional-boundaries-bcd (push) Blocked by required conditions
CI / check-additional-extension-bundled (push) Blocked by required conditions
CI / check-additional-extension-channels (push) Blocked by required conditions
CI / check-additional-extension-package-boundary (push) Blocked by required conditions
CI / check-additional-runtime-topology-architecture (push) Blocked by required conditions
CI / check-session-accessor-boundary (push) Blocked by required conditions
CI / check-session-transcript-reader-boundary (push) Blocked by required conditions
CI / check-docs (push) Blocked by required conditions
CI / build-artifacts (push) Blocked by required conditions
CI / (push) Blocked by required conditions
CI / -1 (push) Blocked by required conditions
CI / -2 (push) Blocked by required conditions
CI / preflight (push) Waiting to run
CI / security-fast (push) Waiting to run
CI / pnpm-store-warmup (push) Blocked by required conditions
CI / skills-python (push) Blocked by required conditions
CI / -4 (push) Blocked by required conditions
CI / -5 (push) Blocked by required conditions
CI / macos-swift (push) Blocked by required conditions
CI / -6 (push) Blocked by required conditions
CI / ci-timings-summary (push) Blocked by required conditions
ClawSweeper Dispatch / dispatch (push) Waiting to run
CodeQL / Security High (actions) (push) Waiting to run
CodeQL / Security High (channel-runtime-boundary) (push) Waiting to run
CodeQL / Security High (core-auth-secrets) (push) Waiting to run
CodeQL / Security High (mcp-process-tool-boundary) (push) Waiting to run
CodeQL / Security High (network-ssrf-boundary) (push) Waiting to run
CodeQL / Security High (plugin-trust-boundary) (push) Waiting to run
Docs Sync Publish Repo / sync-publish-repo (push) Waiting to run
Docs / docs (push) Waiting to run
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Waiting to run
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Blocked by required conditions
Plugin NPM Release / preview_plugins_npm (push) Waiting to run
Plugin NPM Release / Validate release publish approval (push) Blocked by required conditions
Plugin NPM Release / preview_plugin_pack (push) Blocked by required conditions
Plugin NPM Release / publish_plugins_npm (push) Blocked by required conditions
Workflow Sanity / no-tabs (push) Waiting to run
Workflow Sanity / actionlint (push) Waiting to run
Workflow Sanity / generated-doc-baselines (push) Waiting to run
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled

This commit is contained in:
Vincent Koc 2026-06-18 19:38:58 +02:00
parent ae655345c4
commit 46d359237e
No known key found for this signature in database
2 changed files with 21 additions and 1 deletions

View file

@ -73,6 +73,9 @@ async function runQaLabUp(argv: readonly string[], deps: QaLabUpDeps = {}): Prom
if (parsed === undefined) {
throw new Error(`${flag} must be a positive integer.`);
}
if (parsed > 65535) {
throw new Error(`${flag} must be a TCP port from 1 to 65535.`);
}
return parsed;
};

View file

@ -34,12 +34,29 @@ describe("scripts/qa-lab-up", () => {
);
});
it("accepts the maximum TCP port before loading the Docker runtime", async () => {
const runQaDockerUpCommand = vi.fn(async () => {});
const loadRuntime = vi.fn(async () => ({ runQaDockerUpCommand }));
await expect(
qaLabUpTesting.runQaLabUp(["--gateway-port", "65535", "--qa-lab-port", "65535"], {
loadRuntime,
}),
).resolves.toBe(0);
expect(runQaDockerUpCommand).toHaveBeenCalledWith(
expect.objectContaining({ gatewayPort: 65535, qaLabPort: 65535 }),
);
});
it.each([
[["--gateway-port", "1.5"], "--gateway-port must be a positive integer."],
[["--gateway-port", "0x1000"], "--gateway-port must be a positive integer."],
[["--gateway-port", "0"], "--gateway-port must be a positive integer."],
[["--gateway-port", "65536"], "--gateway-port must be a TCP port from 1 to 65535."],
[["--qa-lab-port", "1e4"], "--qa-lab-port must be a positive integer."],
])("rejects non-decimal positive integer ports: %j", async (args, errorMessage) => {
[["--qa-lab-port", "65536"], "--qa-lab-port must be a TCP port from 1 to 65535."],
])("rejects invalid TCP ports: %j", async (args, errorMessage) => {
const loadRuntime = vi.fn(async () => ({ runQaDockerUpCommand: vi.fn(async () => {}) }));
await expect(qaLabUpTesting.runQaLabUp(args, { loadRuntime })).rejects.toThrow(errorMessage);