test(docker): run mounted harnesses with image tsx

This commit is contained in:
Peter Steinberger
2026-04-27 01:05:20 +01:00
parent 82b928232e
commit 3b514ad5f3
11 changed files with 26 additions and 22 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 \

View File

@@ -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

View File

@@ -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)"

View File

@@ -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
'

View File

@@ -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

View File

@@ -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

View File

@@ -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);