test(docker): reduce e2e log noise

This commit is contained in:
Peter Steinberger
2026-04-08 23:27:19 +01:00
parent ceb64dc07e
commit b76681f28d
4 changed files with 72 additions and 12 deletions

View File

@@ -23,7 +23,10 @@ COPY patches ./patches
COPY scripts/postinstall-bundled-plugins.mjs scripts/npm-runner.mjs scripts/windows-cmd-helpers.mjs ./scripts/
RUN --mount=type=cache,id=openclaw-pnpm-store,target=/root/.local/share/pnpm/store,sharing=locked \
corepack enable \
&& pnpm install --frozen-lockfile
&& if ! pnpm install --frozen-lockfile >/tmp/openclaw-cleanup-pnpm-install.log 2>&1; then \
cat /tmp/openclaw-cleanup-pnpm-install.log; \
exit 1; \
fi
COPY . .
COPY --chmod=755 scripts/docker/cleanup-smoke/run.sh /usr/local/bin/openclaw-cleanup-smoke

View File

@@ -80,7 +80,11 @@ LOGINCTL
echo "npm pack failed (expected /app/$pkg_tgz)"
exit 1
fi
npm install -g --prefix /tmp/npm-prefix "/app/$pkg_tgz"
npm_log="/tmp/openclaw-doctor-switch-npm-install.log"
if ! npm install -g --prefix /tmp/npm-prefix "/app/$pkg_tgz" >"$npm_log" 2>&1; then
cat "$npm_log"
exit 1
fi
npm_bin="/tmp/npm-prefix/bin/openclaw"
npm_root="/tmp/npm-prefix/lib/node_modules/openclaw"
@@ -124,13 +128,18 @@ LOGINCTL
local install_expected="$3"
local doctor_cmd="$4"
local doctor_expected="$5"
local install_log="/tmp/openclaw-doctor-switch-${name}-install.log"
local doctor_log="/tmp/openclaw-doctor-switch-${name}-doctor.log"
echo "== Flow: $name =="
home_dir=$(mktemp -d "/tmp/openclaw-switch-${name}.XXXXXX")
export HOME="$home_dir"
export USER="testuser"
eval "$install_cmd"
if ! eval "$install_cmd" >"$install_log" 2>&1; then
cat "$install_log"
exit 1
fi
unit_path="$HOME/.config/systemd/user/openclaw-gateway.service"
if [ ! -f "$unit_path" ]; then
@@ -139,7 +148,10 @@ LOGINCTL
fi
assert_entrypoint "$unit_path" "$install_expected"
eval "$doctor_cmd"
if ! eval "$doctor_cmd" >"$doctor_log" 2>&1; then
cat "$doctor_log"
exit 1
fi
assert_entrypoint "$unit_path" "$doctor_expected"
}

View File

@@ -55,6 +55,47 @@ OPENCLAW_PLUGIN_HOME="$HOME/.openclaw/$BUNDLED_PLUGIN_ROOT_DIR"
gateway_pid=""
record_fixture_plugin_trust() {
local plugin_id="$1"
local plugin_root="$2"
local enabled="$3"
node - <<'NODE' "$plugin_id" "$plugin_root" "$enabled"
const fs = require("node:fs");
const path = require("node:path");
const pluginId = process.argv[2];
const pluginRoot = process.argv[3];
const enabled = process.argv[4] === "1";
const configPath = path.join(process.env.HOME, ".openclaw", "openclaw.json");
const config = fs.existsSync(configPath)
? JSON.parse(fs.readFileSync(configPath, "utf8"))
: {};
const plugins = (config.plugins ??= {});
const entries = (plugins.entries ??= {});
entries[pluginId] = { ...(entries[pluginId] ?? {}), enabled };
const installs = (plugins.installs ??= {});
installs[pluginId] = {
...(installs[pluginId] ?? {}),
source: "path",
installPath: pluginRoot,
sourcePath: pluginRoot,
};
plugins.allow = Array.from(new Set([...(plugins.allow ?? []), pluginId])).sort();
fs.mkdirSync(path.dirname(configPath), { recursive: true });
fs.writeFileSync(configPath, `${JSON.stringify(config, null, 2)}\n`, "utf8");
NODE
}
run_logged() {
local label="$1"
shift
local log_file="/tmp/openclaw-plugins-e2e-${label}.log"
if ! "$@" >"$log_file" 2>&1; then
cat "$log_file"
exit 1
fi
}
seed_openai_provider_config() {
local openai_api_key="$1"
local openai_base_url="${2:-}"
@@ -178,6 +219,7 @@ const callGatewayOnce = (method, params) => {
value: JSON.parse(
execFileSync("node", [...gatewayArgs, method, "--params", JSON.stringify(params)], {
encoding: "utf8",
stdio: ["ignore", "pipe", "pipe"],
}),
),
};
@@ -395,6 +437,7 @@ cat > "$demo_plugin_root/openclaw.plugin.json" <<'JSON'
}
}
JSON
record_fixture_plugin_trust "$demo_plugin_id" "$demo_plugin_root" 1
node "$OPENCLAW_ENTRY" plugins list --json > /tmp/plugins.json
node "$OPENCLAW_ENTRY" plugins inspect demo-plugin --json > /tmp/plugins-inspect.json
@@ -462,7 +505,7 @@ cat > "$pack_dir/package/openclaw.plugin.json" <<'JSON'
JSON
tar -czf /tmp/demo-plugin-tgz.tgz -C "$pack_dir" package
node "$OPENCLAW_ENTRY" plugins install /tmp/demo-plugin-tgz.tgz
run_logged install-tgz node "$OPENCLAW_ENTRY" plugins install /tmp/demo-plugin-tgz.tgz
node "$OPENCLAW_ENTRY" plugins list --json > /tmp/plugins2.json
node "$OPENCLAW_ENTRY" plugins inspect demo-plugin-tgz --json > /tmp/plugins2-inspect.json
@@ -510,7 +553,7 @@ cat > "$dir_plugin/openclaw.plugin.json" <<'JSON'
}
JSON
node "$OPENCLAW_ENTRY" plugins install "$dir_plugin"
run_logged install-dir node "$OPENCLAW_ENTRY" plugins install "$dir_plugin"
node "$OPENCLAW_ENTRY" plugins list --json > /tmp/plugins3.json
node "$OPENCLAW_ENTRY" plugins inspect demo-plugin-dir --json > /tmp/plugins3-inspect.json
@@ -559,7 +602,7 @@ cat > "$file_pack_dir/package/openclaw.plugin.json" <<'JSON'
}
JSON
node "$OPENCLAW_ENTRY" plugins install "file:$file_pack_dir/package"
run_logged install-file node "$OPENCLAW_ENTRY" plugins install "file:$file_pack_dir/package"
node "$OPENCLAW_ENTRY" plugins list --json > /tmp/plugins4.json
node "$OPENCLAW_ENTRY" plugins inspect demo-plugin-file --json > /tmp/plugins4-inspect.json
@@ -597,6 +640,7 @@ Act as an engineering advisor.
Focus on:
$ARGUMENTS
MD
record_fixture_plugin_trust "$bundle_plugin_id" "$bundle_root" 0
node - <<'NODE'
const fs = require("node:fs");
@@ -843,8 +887,8 @@ if (!names.includes("marketplace-shortcut") || !names.includes("marketplace-dire
console.log("ok");
NODE
node "$OPENCLAW_ENTRY" plugins install marketplace-shortcut@claude-fixtures
node "$OPENCLAW_ENTRY" plugins install marketplace-direct --marketplace claude-fixtures
run_logged install-marketplace-shortcut node "$OPENCLAW_ENTRY" plugins install marketplace-shortcut@claude-fixtures
run_logged install-marketplace-direct node "$OPENCLAW_ENTRY" plugins install marketplace-direct --marketplace claude-fixtures
node "$OPENCLAW_ENTRY" plugins list --json > /tmp/plugins-marketplace.json
node "$OPENCLAW_ENTRY" plugins inspect marketplace-shortcut --json > /tmp/plugins-marketplace-shortcut-inspect.json
node "$OPENCLAW_ENTRY" plugins inspect marketplace-direct --json > /tmp/plugins-marketplace-direct-inspect.json
@@ -913,8 +957,8 @@ write_fixture_plugin \
"0.0.2" \
"demo.marketplace.shortcut.v2" \
"Marketplace Shortcut"
node "$OPENCLAW_ENTRY" plugins update marketplace-shortcut --dry-run
node "$OPENCLAW_ENTRY" plugins update marketplace-shortcut
run_logged update-marketplace-shortcut-dry-run node "$OPENCLAW_ENTRY" plugins update marketplace-shortcut --dry-run
run_logged update-marketplace-shortcut node "$OPENCLAW_ENTRY" plugins update marketplace-shortcut
node "$OPENCLAW_ENTRY" plugins list --json > /tmp/plugins-marketplace-updated.json
node "$OPENCLAW_ENTRY" plugins inspect marketplace-shortcut --json > /tmp/plugins-marketplace-updated-inspect.json

View File

@@ -3,6 +3,7 @@ set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
IMAGE_NAME="${OPENCLAW_CLEANUP_SMOKE_IMAGE:-openclaw-cleanup-smoke:local}"
PLATFORM="${OPENCLAW_CLEANUP_SMOKE_PLATFORM:-linux/amd64}"
echo "==> Build image: $IMAGE_NAME"
docker build \
@@ -11,4 +12,4 @@ docker build \
"$ROOT_DIR"
echo "==> Run cleanup smoke test"
docker run --rm -t "$IMAGE_NAME"
docker run --rm --platform "$PLATFORM" -t "$IMAGE_NAME"