From 4838e704a0d6129cdb81d2e0db29eeec93b241f8 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Tue, 26 May 2026 11:23:29 +0200 Subject: [PATCH] fix(e2e): route focused docker smokes through run helper --- scripts/e2e/npm-telegram-live-docker.sh | 2 +- scripts/e2e/npm-telegram-rtt-docker.sh | 4 ++-- scripts/e2e/plugin-binding-command-escape-docker.sh | 4 ++-- scripts/e2e/qr-import-docker.sh | 3 ++- test/scripts/docker-build-helper.test.ts | 12 ++++++++++++ test/scripts/npm-telegram-live.test.ts | 2 ++ test/scripts/rtt-harness.test.ts | 2 ++ 7 files changed, 23 insertions(+), 6 deletions(-) diff --git a/scripts/e2e/npm-telegram-live-docker.sh b/scripts/e2e/npm-telegram-live-docker.sh index 80c3e70a3d26..e8ce37b364cd 100755 --- a/scripts/e2e/npm-telegram-live-docker.sh +++ b/scripts/e2e/npm-telegram-live-docker.sh @@ -221,7 +221,7 @@ run_logged() { } echo "Running package Telegram live Docker E2E ($PACKAGE_LABEL)..." -run_logged docker run --rm \ +run_logged docker_e2e_docker_run_cmd run --rm \ -e COREPACK_ENABLE_DOWNLOAD_PROMPT=0 \ -e OPENCLAW_NPM_TELEGRAM_INSTALL_SOURCE="$package_install_source" \ -e OPENCLAW_NPM_TELEGRAM_PACKAGE_LABEL="$PACKAGE_LABEL" \ diff --git a/scripts/e2e/npm-telegram-rtt-docker.sh b/scripts/e2e/npm-telegram-rtt-docker.sh index 3d9973120ed6..67aaf7c6179a 100755 --- a/scripts/e2e/npm-telegram-rtt-docker.sh +++ b/scripts/e2e/npm-telegram-rtt-docker.sh @@ -249,7 +249,7 @@ run_logged() { } echo "Installing ${PACKAGE_LABEL} from ${package_install_source}..." -run_logged docker run --rm \ +run_logged docker_e2e_docker_run_cmd run --rm \ "${install_env[@]}" \ ${package_mount_args[@]+"${package_mount_args[@]}"} \ -v "$npm_prefix_host:/npm-global" \ @@ -269,7 +269,7 @@ node -p "require('/npm-global/lib/node_modules/openclaw/package.json').version" EOF echo "Running package Telegram RTT Docker E2E ($PACKAGE_LABEL)..." -run_logged docker run --rm \ +run_logged docker_e2e_docker_run_cmd run --rm \ "${docker_env[@]}" \ -v "$ROOT_DIR/scripts:/app/scripts:ro" \ -v "$ROOT_DIR/.artifacts:/app/.artifacts" \ diff --git a/scripts/e2e/plugin-binding-command-escape-docker.sh b/scripts/e2e/plugin-binding-command-escape-docker.sh index ced9c05b449c..9056562249d6 100644 --- a/scripts/e2e/plugin-binding-command-escape-docker.sh +++ b/scripts/e2e/plugin-binding-command-escape-docker.sh @@ -13,7 +13,7 @@ RUN_LOG="$(mktemp -t openclaw-plugin-binding-command-escape-log.XXXXXX)" FOCUSED_TEST_REGEX="lets authorized plugin-owned binding commands fall through to command processing|keeps authorized unknown slash text in a plugin-owned binding routed to the bound plugin|keeps unauthorized plugin-owned binding slash text routed to the bound plugin" cleanup() { - docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true + docker_e2e_docker_cmd rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true rm -f "$RUN_LOG" } trap cleanup EXIT @@ -26,7 +26,7 @@ docker_e2e_build_or_reuse \ echo "Running plugin binding command escape Docker E2E..." set +e -docker run --rm \ +docker_e2e_docker_run_cmd run --rm \ --name "$CONTAINER_NAME" \ -e COREPACK_ENABLE_DOWNLOAD_PROMPT=0 \ -e "FOCUSED_TEST_REGEX=$FOCUSED_TEST_REGEX" \ diff --git a/scripts/e2e/qr-import-docker.sh b/scripts/e2e/qr-import-docker.sh index d1f07d58c0b7..d17a45c0033b 100755 --- a/scripts/e2e/qr-import-docker.sh +++ b/scripts/e2e/qr-import-docker.sh @@ -3,6 +3,7 @@ set -euo pipefail ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" source "$ROOT_DIR/scripts/lib/docker-build.sh" +source "$ROOT_DIR/scripts/lib/docker-e2e-container.sh" IMAGE_NAME="${OPENCLAW_QR_SMOKE_IMAGE:-openclaw-qr-smoke}" DOCKER_BUILD_ARGS=() @@ -22,4 +23,4 @@ docker_build_run qr-import-build \ "$ROOT_DIR" echo "Running qrcode import smoke..." -run_logged qr-import-run docker run --rm -t "$IMAGE_NAME" node -e "import('qrcode').then(async (m)=>{const q=m.default??m;process.stdout.write(await q.toString('qr-smoke',{small:true,type:'terminal'}))})" +run_logged qr-import-run docker_e2e_docker_run_cmd run --rm -t "$IMAGE_NAME" node -e "import('qrcode').then(async (m)=>{const q=m.default??m;process.stdout.write(await q.toString('qr-smoke',{small:true,type:'terminal'}))})" diff --git a/test/scripts/docker-build-helper.test.ts b/test/scripts/docker-build-helper.test.ts index b881392cc385..3b5c9c9d9461 100644 --- a/test/scripts/docker-build-helper.test.ts +++ b/test/scripts/docker-build-helper.test.ts @@ -32,6 +32,7 @@ const PLUGIN_BINDING_COMMAND_ESCAPE_DOCKER_E2E_PATH = "scripts/e2e/plugin-binding-command-escape-docker.sh"; const PLUGIN_BINDING_COMMAND_ESCAPE_DOCKERFILE_PATH = "scripts/e2e/plugin-binding-command-escape.Dockerfile"; +const QR_IMPORT_DOCKER_E2E_PATH = "scripts/e2e/qr-import-docker.sh"; const MULTI_NODE_UPDATE_DOCKER_E2E_PATH = "scripts/e2e/multi-node-update-docker.sh"; const BUNDLED_PLUGIN_INSTALL_UNINSTALL_E2E_PATH = "scripts/e2e/bundled-plugin-install-uninstall-docker.sh"; @@ -802,11 +803,22 @@ test -f "$TMPDIR/docker-cmd-seen" expect(runner).toContain("--reporter=verbose -t"); expect(runner).not.toContain("-- --reporter=verbose"); + expect(runner).toContain("docker_e2e_docker_run_cmd run --rm"); + expect(runner).toContain('docker_e2e_docker_cmd rm -f "$CONTAINER_NAME"'); + expect(runner).not.toMatch(/(^|\n)docker run --rm/u); expect(runner).toContain("expected focused Vitest summary for exactly 3 passed tests"); expect(dockerfile).toContain("OPENCLAW_DISABLE_BUNDLED_PLUGIN_POSTINSTALL=1"); expect(dockerfile).toContain("pnpm install --frozen-lockfile --ignore-scripts --filter openclaw"); }); + it("routes QR import Docker smoke through the timeout-aware run helper", () => { + const runner = readFileSync(QR_IMPORT_DOCKER_E2E_PATH, "utf8"); + + expect(runner).toContain("scripts/lib/docker-e2e-container.sh"); + expect(runner).toContain("run_logged qr-import-run docker_e2e_docker_run_cmd run --rm -t"); + expect(runner).not.toContain("run_logged qr-import-run docker run --rm"); + }); + it("covers plugin install/update sources in the Docker plugin sweep", () => { const sweep = readFileSync(PLUGINS_DOCKER_SWEEP_PATH, "utf8"); const clawhub = readFileSync(PLUGINS_DOCKER_CLAWHUB_PATH, "utf8"); diff --git a/test/scripts/npm-telegram-live.test.ts b/test/scripts/npm-telegram-live.test.ts index af4406253dd6..357c17b79187 100644 --- a/test/scripts/npm-telegram-live.test.ts +++ b/test/scripts/npm-telegram-live.test.ts @@ -43,6 +43,8 @@ describe("package Telegram live Docker E2E", () => { expect(installRun).toContain('npm install -g "$install_source" --no-fund --no-audit'); expect(installRun).toContain('"${package_mount_args[@]}"'); expect(installRun).not.toContain('"${docker_env[@]}"'); + expect(installRun).toContain("run_logged docker_e2e_docker_run_cmd run --rm"); + expect(installRun).not.toContain("run_logged docker run --rm"); expect(script).toContain("run_logged docker_e2e_run_with_harness"); expect(script).toContain('"${docker_env[@]}"'); expect(script).toContain('if [ -z "$credential_role" ] && [ -n "${CI:-}" ]'); diff --git a/test/scripts/rtt-harness.test.ts b/test/scripts/rtt-harness.test.ts index 63a0ea4e00a0..16118bd6bb07 100644 --- a/test/scripts/rtt-harness.test.ts +++ b/test/scripts/rtt-harness.test.ts @@ -143,6 +143,8 @@ describe("RTT harness", () => { expect(installEnvSnapshotIndex).toBeGreaterThanOrEqual(0); expect(convexSecretForwardIndex).toBeGreaterThan(installEnvSnapshotIndex); expect(packageInstallIndex).toBeLessThan(credentialAcquireIndex); + expect(script).toContain("run_logged docker_e2e_docker_run_cmd run --rm"); + expect(script).not.toContain("run_logged docker run --rm"); expect(heartbeatStartIndex).toBeGreaterThan(sourceIndex); expect(heartbeatStartIndex).toBeLessThan(driverIndex); expect(script).toContain("start_credential_heartbeat() {\n (\n set +e");