From 7cee0bca0bea31e50dfb45a89fd50f9ecece9c69 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Wed, 3 Jun 2026 11:31:12 +0200 Subject: [PATCH] fix(e2e): isolate plugin lifecycle artifacts --- CHANGELOG.md | 1 + .../e2e/lib/plugin-lifecycle-matrix/sweep.sh | 30 +++++++------------ test/scripts/docker-build-helper.test.ts | 14 +++++++-- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b61fdb2bc0f..b84f8c9a408 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,7 @@ Docs: https://docs.openclaw.ai - Scripts/UI: stop descendant processes from wrapped non-interactive commands when `run-with-env` receives shutdown signals. - Release/CI/E2E: write multi-node update Docker artifacts to unique per-run directories by default so parallel runs cannot overwrite evidence. - Release/CI/E2E: write package Telegram Docker artifacts to unique per-run directories by default so parallel live/RTT runs cannot overwrite evidence. +- Release/CI/E2E: keep plugin lifecycle matrix resource artifacts under a unique per-run scratch root so parallel runs cannot overwrite tarballs or inspect output. - Release/CI/E2E: fail secret-provider proof runs when temporary state cleanup still fails after retries instead of hiding the cleanup error. - Release/CI/E2E: fail package-candidate ref proofs when temporary source worktree cleanup fails instead of leaving stale worktrees behind. - Release/CI/E2E: remove package tarball extract directories when tar extraction fails before validation can continue. diff --git a/scripts/e2e/lib/plugin-lifecycle-matrix/sweep.sh b/scripts/e2e/lib/plugin-lifecycle-matrix/sweep.sh index 1b05ab6c0bc..9fbc0ce544e 100644 --- a/scripts/e2e/lib/plugin-lifecycle-matrix/sweep.sh +++ b/scripts/e2e/lib/plugin-lifecycle-matrix/sweep.sh @@ -19,27 +19,19 @@ plugin_id="lifecycle-claw" package_name="@openclaw/lifecycle-claw" probe="scripts/e2e/lib/plugin-lifecycle-matrix/probe.mjs" measure="scripts/e2e/lib/plugin-lifecycle-matrix/measure.mjs" -resource_dir="/tmp/openclaw-plugin-lifecycle-matrix" +resource_dir="$(mktemp -d "/tmp/openclaw-plugin-lifecycle-matrix.XXXXXX")" pack_root="" registry_root="" +tarball_v1="$resource_dir/lifecycle-claw-1.0.0.tgz" +tarball_v2="$resource_dir/lifecycle-claw-2.0.0.tgz" +inspect_v1="$resource_dir/plugin-lifecycle-inspect-v1.json" cleanup() { openclaw_plugins_cleanup_fixture_servers rm -rf "$resource_dir" - if [ -n "$pack_root" ]; then - rm -rf "$pack_root" - fi - if [ -n "$registry_root" ]; then - rm -rf "$registry_root" - fi - rm -f \ - /tmp/lifecycle-claw-1.0.0.tgz \ - /tmp/lifecycle-claw-2.0.0.tgz \ - /tmp/plugin-lifecycle-inspect-v1.json } trap cleanup EXIT -mkdir -p "$resource_dir" summary_tsv="$resource_dir/resource-summary.tsv" printf "phase\tmax_rss_kb\tcpu_seconds\twall_ms\tcpu_core_ratio\tsignal\n" >"$summary_tsv" @@ -51,19 +43,19 @@ run_measured() { node "$measure" "$summary_tsv" "$phase" -- "$@" } -pack_root="$(mktemp -d "/tmp/openclaw-plugin-lifecycle-pack.XXXXXX")" -registry_root="$(mktemp -d "/tmp/openclaw-plugin-lifecycle-registry.XXXXXX")" -pack_fixture_plugin "$pack_root/v1" /tmp/lifecycle-claw-1.0.0.tgz "$plugin_id" 1.0.0 lifecycle.v1 "Lifecycle Claw" -pack_fixture_plugin "$pack_root/v2" /tmp/lifecycle-claw-2.0.0.tgz "$plugin_id" 2.0.0 lifecycle.v2 "Lifecycle Claw" -start_npm_fixture_registry "$package_name" 1.0.0 /tmp/lifecycle-claw-1.0.0.tgz "$registry_root" "$package_name" 2.0.0 /tmp/lifecycle-claw-2.0.0.tgz +pack_root="$(mktemp -d "$resource_dir/pack.XXXXXX")" +registry_root="$(mktemp -d "$resource_dir/registry.XXXXXX")" +pack_fixture_plugin "$pack_root/v1" "$tarball_v1" "$plugin_id" 1.0.0 lifecycle.v1 "Lifecycle Claw" +pack_fixture_plugin "$pack_root/v2" "$tarball_v2" "$plugin_id" 2.0.0 lifecycle.v2 "Lifecycle Claw" +start_npm_fixture_registry "$package_name" 1.0.0 "$tarball_v1" "$registry_root" "$package_name" 2.0.0 "$tarball_v2" trap cleanup EXIT run_measured install-v1 node "$entry" plugins install "npm:$package_name@1.0.0" node "$probe" assert-version "$plugin_id" 1.0.0 node "$probe" assert-npm-project-root "$plugin_id" "$package_name" -run_measured inspect-v1 bash -c 'node "$1" plugins inspect "$2" --runtime --json >/tmp/plugin-lifecycle-inspect-v1.json' bash "$entry" "$plugin_id" -node "$probe" assert-inspect-loaded "$plugin_id" /tmp/plugin-lifecycle-inspect-v1.json +run_measured inspect-v1 bash -c 'node "$1" plugins inspect "$2" --runtime --json >"$3"' bash "$entry" "$plugin_id" "$inspect_v1" +node "$probe" assert-inspect-loaded "$plugin_id" "$inspect_v1" run_measured disable node "$entry" plugins disable "$plugin_id" node "$probe" assert-enabled "$plugin_id" false diff --git a/test/scripts/docker-build-helper.test.ts b/test/scripts/docker-build-helper.test.ts index 4d178578c1a..92f3c255be7 100644 --- a/test/scripts/docker-build-helper.test.ts +++ b/test/scripts/docker-build-helper.test.ts @@ -1236,9 +1236,19 @@ grep -qx -- "OPENCLAW_E2E_COMMAND_TIMEOUT=23s" "$TMPDIR/package-args" expect(sweep).toContain("cleanup() {"); expect(sweep).toContain("openclaw_plugins_cleanup_fixture_servers"); + expect(sweep).toContain( + 'resource_dir="$(mktemp -d "/tmp/openclaw-plugin-lifecycle-matrix.XXXXXX")"', + ); + expect(sweep).toContain('tarball_v1="$resource_dir/lifecycle-claw-1.0.0.tgz"'); + expect(sweep).toContain('tarball_v2="$resource_dir/lifecycle-claw-2.0.0.tgz"'); + expect(sweep).toContain('inspect_v1="$resource_dir/plugin-lifecycle-inspect-v1.json"'); + expect(sweep).toContain('pack_root="$(mktemp -d "$resource_dir/pack.XXXXXX")"'); + expect(sweep).toContain('registry_root="$(mktemp -d "$resource_dir/registry.XXXXXX")"'); expect(sweep).toContain('rm -rf "$resource_dir"'); - expect(sweep).toContain('rm -rf "$pack_root"'); - expect(sweep).toContain('rm -rf "$registry_root"'); + expect(sweep).not.toContain('resource_dir="/tmp/openclaw-plugin-lifecycle-matrix"'); + expect(sweep).not.toContain("/tmp/lifecycle-claw-1.0.0.tgz"); + expect(sweep).not.toContain("/tmp/lifecycle-claw-2.0.0.tgz"); + expect(sweep).not.toContain("/tmp/plugin-lifecycle-inspect-v1.json"); expect(sweep.match(/trap cleanup EXIT/g)).toHaveLength(2); });