From 3b514ad5f379b6f81ecc51ea2f6a44a48e5369ee Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 27 Apr 2026 01:05:20 +0100 Subject: [PATCH] test(docker): run mounted harnesses with image tsx --- scripts/e2e/crestodian-first-run-docker.sh | 2 +- scripts/e2e/crestodian-planner-docker.sh | 2 +- scripts/e2e/crestodian-rescue-docker.sh | 2 +- scripts/e2e/cron-mcp-cleanup-docker.sh | 4 ++-- scripts/e2e/docker-observability-smoke.sh | 2 +- scripts/e2e/mcp-channels-docker.sh | 4 ++-- scripts/e2e/npm-telegram-live-docker.sh | 2 +- scripts/e2e/openai-image-auth-docker.sh | 2 +- scripts/e2e/pi-bundle-mcp-tools-docker.sh | 2 +- scripts/e2e/session-runtime-context-docker.sh | 2 +- scripts/qa-otel-smoke.ts | 24 +++++++++++-------- 11 files changed, 26 insertions(+), 22 deletions(-) diff --git a/scripts/e2e/crestodian-first-run-docker.sh b/scripts/e2e/crestodian-first-run-docker.sh index f9292c3b17a..4614a680ddb 100644 --- a/scripts/e2e/crestodian-first-run-docker.sh +++ b/scripts/e2e/crestodian-first-run-docker.sh @@ -28,7 +28,7 @@ docker run --rm \ "${DOCKER_E2E_HARNESS_ARGS[@]}" \ "$IMAGE_NAME" \ bash -lc "set -euo pipefail - node --import tsx scripts/e2e/crestodian-first-run-docker-client.ts + tsx scripts/e2e/crestodian-first-run-docker-client.ts " >"$RUN_LOG" 2>&1 status=${PIPESTATUS[0]} set -e diff --git a/scripts/e2e/crestodian-planner-docker.sh b/scripts/e2e/crestodian-planner-docker.sh index cad3272ad48..559ee5161ae 100755 --- a/scripts/e2e/crestodian-planner-docker.sh +++ b/scripts/e2e/crestodian-planner-docker.sh @@ -28,7 +28,7 @@ docker run --rm \ "${DOCKER_E2E_HARNESS_ARGS[@]}" \ "$IMAGE_NAME" \ bash -lc "set -euo pipefail - node --import tsx scripts/e2e/crestodian-planner-docker-client.ts + tsx scripts/e2e/crestodian-planner-docker-client.ts " >"$RUN_LOG" 2>&1 status=${PIPESTATUS[0]} set -e diff --git a/scripts/e2e/crestodian-rescue-docker.sh b/scripts/e2e/crestodian-rescue-docker.sh index 4db23f4be82..efaa230d52e 100755 --- a/scripts/e2e/crestodian-rescue-docker.sh +++ b/scripts/e2e/crestodian-rescue-docker.sh @@ -28,7 +28,7 @@ docker run --rm \ "${DOCKER_E2E_HARNESS_ARGS[@]}" \ "$IMAGE_NAME" \ bash -lc "set -euo pipefail - node --import tsx scripts/e2e/crestodian-rescue-docker-client.ts + tsx scripts/e2e/crestodian-rescue-docker-client.ts " >"$RUN_LOG" 2>&1 status=${PIPESTATUS[0]} set -e diff --git a/scripts/e2e/cron-mcp-cleanup-docker.sh b/scripts/e2e/cron-mcp-cleanup-docker.sh index eca96a8f175..7b579e74df7 100644 --- a/scripts/e2e/cron-mcp-cleanup-docker.sh +++ b/scripts/e2e/cron-mcp-cleanup-docker.sh @@ -48,7 +48,7 @@ docker run --rm \ export OPENCLAW_DOCKER_OPENAI_BASE_URL=\"http://127.0.0.1:\$MOCK_PORT/v1\" node scripts/e2e/mock-openai-server.mjs >/tmp/cron-mcp-cleanup-mock-openai.log 2>&1 & mock_pid=\$! - node --import tsx scripts/e2e/cron-mcp-cleanup-seed.ts >/tmp/cron-mcp-cleanup-seed.log + tsx scripts/e2e/cron-mcp-cleanup-seed.ts >/tmp/cron-mcp-cleanup-seed.log node \"\$entry\" gateway --port $PORT --bind loopback --allow-unconfigured >/tmp/cron-mcp-cleanup-gateway.log 2>&1 & gateway_pid=\$! stop_process() { @@ -101,7 +101,7 @@ docker run --rm \ tail -n 120 /tmp/cron-mcp-cleanup-gateway.log 2>/dev/null || true exit 1 fi - node --import tsx scripts/e2e/cron-mcp-cleanup-docker-client.ts + tsx scripts/e2e/cron-mcp-cleanup-docker-client.ts " >"$CLIENT_LOG" 2>&1 status=${PIPESTATUS[0]} set -e diff --git a/scripts/e2e/docker-observability-smoke.sh b/scripts/e2e/docker-observability-smoke.sh index fce34dd8c2d..caa08d1b5c1 100644 --- a/scripts/e2e/docker-observability-smoke.sh +++ b/scripts/e2e/docker-observability-smoke.sh @@ -49,7 +49,7 @@ for i in $(seq 1 "$loops"); do --output-dir "$iteration_dir/otel" echo "== docker observability loop $i/$loops: prometheus ==" - pnpm openclaw qa suite \ + node openclaw.mjs qa suite \ --provider-mode mock-openai \ --scenario docker-prometheus-smoke \ --concurrency 1 \ diff --git a/scripts/e2e/mcp-channels-docker.sh b/scripts/e2e/mcp-channels-docker.sh index d8d214ef2c2..0553f8b1225 100644 --- a/scripts/e2e/mcp-channels-docker.sh +++ b/scripts/e2e/mcp-channels-docker.sh @@ -53,7 +53,7 @@ docker run --rm \ sleep 0.1 done node -e \"fetch('http://127.0.0.1:' + process.argv[1] + '/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))\" \"\$mock_port\" - node --import tsx scripts/e2e/mcp-channels-seed.ts >/tmp/mcp-channels-seed.log + tsx scripts/e2e/mcp-channels-seed.ts >/tmp/mcp-channels-seed.log node \"\$entry\" gateway --port $PORT --bind loopback --allow-unconfigured >/tmp/mcp-channels-gateway.log 2>&1 & gateway_pid=\$! stop_process() { @@ -96,7 +96,7 @@ docker run --rm \ tail -n 120 /tmp/mcp-channels-gateway.log 2>/dev/null || true exit 1 fi - node --import tsx scripts/e2e/mcp-channels-docker-client.ts + tsx scripts/e2e/mcp-channels-docker-client.ts " >"$CLIENT_LOG" 2>&1 status=${PIPESTATUS[0]} set -e diff --git a/scripts/e2e/npm-telegram-live-docker.sh b/scripts/e2e/npm-telegram-live-docker.sh index 9fdb21b9432..5cb4335973c 100755 --- a/scripts/e2e/npm-telegram-live-docker.sh +++ b/scripts/e2e/npm-telegram-live-docker.sh @@ -207,7 +207,7 @@ fi export OPENCLAW_NPM_TELEGRAM_SUT_COMMAND="$(command -v openclaw)" trap - ERR -node --import tsx scripts/e2e/npm-telegram-live-runner.ts +tsx scripts/e2e/npm-telegram-live-runner.ts EOF echo "published npm Telegram live Docker E2E passed ($PACKAGE_SPEC)" diff --git a/scripts/e2e/openai-image-auth-docker.sh b/scripts/e2e/openai-image-auth-docker.sh index 059c78aa60a..f2b22cb1b62 100644 --- a/scripts/e2e/openai-image-auth-docker.sh +++ b/scripts/e2e/openai-image-auth-docker.sh @@ -27,5 +27,5 @@ export OPENCLAW_SKIP_GMAIL_WATCHER=1 export OPENCLAW_SKIP_CRON=1 export OPENCLAW_SKIP_CANVAS_HOST=1 -node --import tsx scripts/e2e/openai-image-auth-docker-client.ts +tsx scripts/e2e/openai-image-auth-docker-client.ts ' diff --git a/scripts/e2e/pi-bundle-mcp-tools-docker.sh b/scripts/e2e/pi-bundle-mcp-tools-docker.sh index 20f9c7ad699..a303a3f7dc5 100755 --- a/scripts/e2e/pi-bundle-mcp-tools-docker.sh +++ b/scripts/e2e/pi-bundle-mcp-tools-docker.sh @@ -27,7 +27,7 @@ docker run --rm \ "${DOCKER_E2E_HARNESS_ARGS[@]}" \ "$IMAGE_NAME" \ bash -lc "set -euo pipefail - node --import tsx scripts/e2e/pi-bundle-mcp-tools-docker-client.ts + tsx scripts/e2e/pi-bundle-mcp-tools-docker-client.ts " >"$RUN_LOG" 2>&1 status=${PIPESTATUS[0]} set -e diff --git a/scripts/e2e/session-runtime-context-docker.sh b/scripts/e2e/session-runtime-context-docker.sh index 27a97814564..fb0e9eec10a 100644 --- a/scripts/e2e/session-runtime-context-docker.sh +++ b/scripts/e2e/session-runtime-context-docker.sh @@ -27,7 +27,7 @@ docker run --rm \ -e COREPACK_ENABLE_DOWNLOAD_PROMPT=0 \ "${DOCKER_E2E_HARNESS_ARGS[@]}" \ "$IMAGE_NAME" \ - bash -lc 'set -euo pipefail; node --import tsx scripts/e2e/session-runtime-context-docker-client.ts' \ + bash -lc 'set -euo pipefail; tsx scripts/e2e/session-runtime-context-docker-client.ts' \ >"$RUN_LOG" 2>&1 status=$? set -e diff --git a/scripts/qa-otel-smoke.ts b/scripts/qa-otel-smoke.ts index 6849c864845..0df2099309d 100644 --- a/scripts/qa-otel-smoke.ts +++ b/scripts/qa-otel-smoke.ts @@ -1,6 +1,7 @@ #!/usr/bin/env -S node --import tsx import { spawn, type ChildProcess } from "node:child_process"; +import { existsSync } from "node:fs"; import { mkdir, writeFile } from "node:fs/promises"; import { createServer, type IncomingMessage, type ServerResponse } from "node:http"; import { createRequire } from "node:module"; @@ -285,15 +286,19 @@ function startLocalOtlpTraceReceiver() { }; } -function spawnPnpm(args: string[], env: NodeJS.ProcessEnv): ChildProcess { - const npmExecPath = process.env.npm_execpath?.trim(); - if (npmExecPath) { - return spawn(process.execPath, [npmExecPath, ...args], { - env, - stdio: ["ignore", "pipe", "pipe"], - }); +function openClawEntryArgs(): string[] { + if ( + existsSync(path.join(process.cwd(), "openclaw.mjs")) && + (existsSync(path.join(process.cwd(), "dist", "entry.js")) || + existsSync(path.join(process.cwd(), "dist", "entry.mjs"))) + ) { + return ["openclaw.mjs"]; } - return spawn(process.platform === "win32" ? "pnpm.cmd" : "pnpm", args, { + return ["scripts/run-node.mjs"]; +} + +function spawnOpenClaw(args: string[], env: NodeJS.ProcessEnv): ChildProcess { + return spawn(process.execPath, [...openClawEntryArgs(), ...args], { env, stdio: ["ignore", "pipe", "pipe"], }); @@ -321,7 +326,6 @@ function buildQaEnv(port: number): NodeJS.ProcessEnv { function buildQaArgs(options: CliOptions): string[] { const args = [ - "openclaw", "qa", "suite", "--provider-mode", @@ -434,7 +438,7 @@ async function main() { let childExitCode = 1; try { - const child = spawnPnpm(buildQaArgs(options), buildQaEnv(port)); + const child = spawnOpenClaw(buildQaArgs(options), buildQaEnv(port)); child.stdout?.on("data", (chunk) => process.stdout.write(chunk)); child.stderr?.on("data", (chunk) => process.stderr.write(chunk)); childExitCode = await waitForChild(child);