fix(e2e): clean plugin lifecycle temp state · openclaw/openclaw@ba88b7a
vincentkoc
·
2026-06-02
·
via Recent Commits to openclaw:main
File tree
scripts/e2e/lib/plugin-lifecycle-matrix
| Original file line number | Diff line number | Diff line change |
|---|
@@ -20,6 +20,25 @@ package_name="@openclaw/lifecycle-claw"
|
20 | 20 | probe="scripts/e2e/lib/plugin-lifecycle-matrix/probe.mjs" |
21 | 21 | measure="scripts/e2e/lib/plugin-lifecycle-matrix/measure.mjs" |
22 | 22 | resource_dir="/tmp/openclaw-plugin-lifecycle-matrix" |
| 23 | +pack_root="" |
| 24 | +registry_root="" |
| 25 | + |
| 26 | +cleanup() { |
| 27 | + openclaw_plugins_cleanup_fixture_servers |
| 28 | + rm -rf "$resource_dir" |
| 29 | +if [ -n "$pack_root" ]; then |
| 30 | + rm -rf "$pack_root" |
| 31 | +fi |
| 32 | +if [ -n "$registry_root" ]; then |
| 33 | + rm -rf "$registry_root" |
| 34 | +fi |
| 35 | + rm -f \ |
| 36 | + /tmp/lifecycle-claw-1.0.0.tgz \ |
| 37 | + /tmp/lifecycle-claw-2.0.0.tgz \ |
| 38 | + /tmp/plugin-lifecycle-inspect-v1.json |
| 39 | +} |
| 40 | +trap cleanup EXIT |
| 41 | + |
23 | 42 | mkdir -p "$resource_dir" |
24 | 43 | summary_tsv="$resource_dir/resource-summary.tsv" |
25 | 44 | printf "phase\tmax_rss_kb\tcpu_seconds\twall_ms\tcpu_core_ratio\tsignal\n" >"$summary_tsv" |
@@ -37,6 +56,7 @@ registry_root="$(mktemp -d "/tmp/openclaw-plugin-lifecycle-registry.XXXXXX")"
|
37 | 56 | pack_fixture_plugin "$pack_root/v1" /tmp/lifecycle-claw-1.0.0.tgz "$plugin_id" 1.0.0 lifecycle.v1 "Lifecycle Claw" |
38 | 57 | pack_fixture_plugin "$pack_root/v2" /tmp/lifecycle-claw-2.0.0.tgz "$plugin_id" 2.0.0 lifecycle.v2 "Lifecycle Claw" |
39 | 58 | 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 |
| 59 | +trap cleanup EXIT |
40 | 60 | |
41 | 61 | run_measured install-v1 node "$entry" plugins install "npm:$package_name@1.0.0" |
42 | 62 | node "$probe" assert-version "$plugin_id" 1.0.0 |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -64,6 +64,7 @@ const PLUGIN_UPDATE_CORRUPT_SCENARIO_PATH =
|
64 | 64 | "scripts/e2e/lib/plugin-update/corrupt-update-scenario.sh"; |
65 | 65 | const PLUGIN_UPDATE_PROBE_PATH = "scripts/e2e/lib/plugin-update/probe.mjs"; |
66 | 66 | const PLUGIN_LIFECYCLE_MATRIX_DOCKER_E2E_PATH = "scripts/e2e/plugin-lifecycle-matrix-docker.sh"; |
| 67 | +const PLUGIN_LIFECYCLE_MATRIX_SWEEP_PATH = "scripts/e2e/lib/plugin-lifecycle-matrix/sweep.sh"; |
67 | 68 | const DOCTOR_SWITCH_DOCKER_E2E_PATH = "scripts/e2e/doctor-install-switch-docker.sh"; |
68 | 69 | const DOCTOR_SWITCH_SCENARIO_PATH = "scripts/e2e/lib/doctor-install-switch/scenario.sh"; |
69 | 70 | const PACKAGE_COMPAT_PATH = "scripts/e2e/lib/package-compat.mjs"; |
@@ -1077,6 +1078,17 @@ grep -qx -- "OPENCLAW_E2E_COMMAND_TIMEOUT=23s" "$TMPDIR/package-args"
|
1077 | 1078 | expect(runner).toContain('docker_e2e_run_with_harness \\\n "${DOCKER_ENV_ARGS[@]}"'); |
1078 | 1079 | }); |
1079 | 1080 | |
| 1081 | +it("cleans plugin lifecycle matrix temp roots on exit", () => { |
| 1082 | +const sweep = readFileSync(PLUGIN_LIFECYCLE_MATRIX_SWEEP_PATH, "utf8"); |
| 1083 | + |
| 1084 | +expect(sweep).toContain("cleanup() {"); |
| 1085 | +expect(sweep).toContain("openclaw_plugins_cleanup_fixture_servers"); |
| 1086 | +expect(sweep).toContain('rm -rf "$resource_dir"'); |
| 1087 | +expect(sweep).toContain('rm -rf "$pack_root"'); |
| 1088 | +expect(sweep).toContain('rm -rf "$registry_root"'); |
| 1089 | +expect(sweep.match(/trap cleanup EXIT/g)).toHaveLength(2); |
| 1090 | +}); |
| 1091 | + |
1080 | 1092 | it("wraps direct Docker E2E npm installs with the shared timeout helper", () => { |
1081 | 1093 | const multiNode = readFileSync(MULTI_NODE_UPDATE_DOCKER_E2E_PATH, "utf8"); |
1082 | 1094 | const updateChannel = readFileSync(UPDATE_CHANNEL_SWITCH_DOCKER_E2E_PATH, "utf8"); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。