fix(e2e): validate kitchen sink fixture wait attempts

This commit is contained in:
Vincent Koc
2026-06-18 23:21:23 +02:00
parent a98bfdb2b7
commit 392f5b75bf
2 changed files with 44 additions and 1 deletions

View File

@@ -109,7 +109,8 @@ start_kitchen_sink_clawhub_fixture_server() {
KITCHEN_SINK_CLAWHUB_FIXTURE_DIR="$fixture_dir"
KITCHEN_SINK_CLAWHUB_PID_FILE="$server_pid_file"
local wait_attempts="${OPENCLAW_CLAWHUB_FIXTURE_WAIT_ATTEMPTS:-600}"
local wait_attempts
wait_attempts="$(openclaw_e2e_read_positive_int_env OPENCLAW_CLAWHUB_FIXTURE_WAIT_ATTEMPTS 600)" || return $?
for _ in $(seq 1 "$wait_attempts"); do
if [[ -s "$server_port_file" ]]; then
export OPENCLAW_CLAWHUB_URL="http://127.0.0.1:$(cat "$server_port_file")"

View File

@@ -717,6 +717,48 @@ test -d "$SCRATCH_ROOT"
}
});
it("rejects invalid ClawHub fixture wait attempts before starting the server", () => {
const parent = mkdtempSync(path.join(tmpdir(), "openclaw-kitchen-sink-clawhub-attempts-"));
const fakeBin = path.join(parent, "bin");
const scratchRoot = path.join(parent, "scratch");
const fixtureDir = path.join(scratchRoot, "clawhub-fixture");
const nodeShim = path.join(fakeBin, "node");
try {
mkdirSync(fakeBin, { recursive: true });
mkdirSync(fixtureDir, { recursive: true });
writeFileSync(nodeShim, "#!/usr/bin/env bash\necho node should not run >&2\nexit 1\n");
chmodSync(nodeShim, 0o755);
const result = runSweepShell(
`
set -euo pipefail
export PATH="$FAKE_BIN:$PATH"
export KITCHEN_SINK_SWEEP_SOURCE_ONLY=1
export KITCHEN_SINK_TMP_DIR="$SCRATCH_ROOT"
export OPENCLAW_CLAWHUB_FIXTURE_WAIT_ATTEMPTS=2x
source scripts/e2e/lib/kitchen-sink-plugin/sweep.sh
set +e
start_kitchen_sink_clawhub_fixture_server "$FIXTURE_DIR"
status="$?"
set -e
cleanup_kitchen_sink_sweep
exit "$status"
`,
{
FAKE_BIN: fakeBin,
FIXTURE_DIR: fixtureDir,
SCRATCH_ROOT: scratchRoot,
},
);
expect(result.status).toBe(2);
expect(result.stderr).toContain("invalid OPENCLAW_CLAWHUB_FIXTURE_WAIT_ATTEMPTS: 2x");
expect(result.stderr).not.toContain("node should not run");
} finally {
rmSync(parent, { force: true, recursive: true });
}
});
it("bounds ClawHub fixture server logs on startup timeout", () => {
const parent = mkdtempSync(path.join(tmpdir(), "openclaw-kitchen-sink-clawhub-log-"));
const fakeBin = path.join(parent, "bin");