Skip to content

Commit 8dff529

Browse files
committed
fix(e2e): bound corrupt update logs
1 parent 901f963 commit 8dff529

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

scripts/e2e/lib/plugin-update/corrupt-update-scenario.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ baseline="${OPENCLAW_UPDATE_CORRUPT_PLUGIN_BASELINE:-openclaw@latest}"
2121
update_timeout_seconds="${OPENCLAW_UPDATE_CORRUPT_PLUGIN_TIMEOUT_SECONDS:-900}"
2222
echo "Installing baseline OpenClaw package: $baseline"
2323
if ! openclaw_e2e_maybe_timeout "${OPENCLAW_E2E_NPM_INSTALL_TIMEOUT:-600s}" npm install -g --prefix /tmp/npm-prefix --omit=optional "$baseline" >/tmp/openclaw-update-corrupt-baseline-install.log 2>&1; then
24-
cat /tmp/openclaw-update-corrupt-baseline-install.log >&2 || true
24+
openclaw_e2e_print_log /tmp/openclaw-update-corrupt-baseline-install.log >&2
2525
exit 1
2626
fi
2727

@@ -72,8 +72,8 @@ set -e
7272
if [ "$update_status" -ne 0 ]; then
7373
if ! node scripts/e2e/lib/plugin-update/probe.mjs assert-legacy-post-update-plugin-failure /tmp/openclaw-update-corrupt-plugin.json; then
7474
echo "openclaw update failed or timed out after ${update_timeout_seconds}s with corrupt plugin present" >&2
75-
cat /tmp/openclaw-update-corrupt-plugin.err >&2 || true
76-
cat /tmp/openclaw-update-corrupt-plugin.json >&2 || true
75+
openclaw_e2e_print_log /tmp/openclaw-update-corrupt-plugin.err >&2
76+
openclaw_e2e_print_log /tmp/openclaw-update-corrupt-plugin.json >&2
7777
exit "$update_status"
7878
fi
7979
echo "Legacy updater reported post-update plugin failure after installing the new core; verifying updated entrypoint..."
@@ -92,9 +92,9 @@ if [ "$update_status" -ne 0 ]; then
9292
set -e
9393
if [ "$post_core_status" -ne 0 ]; then
9494
echo "updated OpenClaw entry failed or timed out after ${update_timeout_seconds}s during post-core plugin verification" >&2
95-
cat /tmp/openclaw-update-corrupt-plugin-post-core.err >&2 || true
96-
cat /tmp/openclaw-update-corrupt-plugin-post-core.stdout >&2 || true
97-
cat /tmp/openclaw-update-corrupt-plugin-post-core.json >&2 || true
95+
openclaw_e2e_print_log /tmp/openclaw-update-corrupt-plugin-post-core.err >&2
96+
openclaw_e2e_print_log /tmp/openclaw-update-corrupt-plugin-post-core.stdout >&2
97+
openclaw_e2e_print_log /tmp/openclaw-update-corrupt-plugin-post-core.json >&2
9898
exit "$post_core_status"
9999
fi
100100
node scripts/e2e/lib/plugin-update/probe.mjs assert-corrupt-plugin-result /tmp/openclaw-update-corrupt-plugin-post-core.json demo-corrupt-plugin
@@ -103,8 +103,8 @@ fi
103103

104104
if ! node scripts/e2e/lib/plugin-update/probe.mjs assert-corrupt-update /tmp/openclaw-update-corrupt-plugin.json demo-corrupt-plugin; then
105105
echo "corrupt update JSON payload:" >&2
106-
cat /tmp/openclaw-update-corrupt-plugin.json >&2 || true
106+
openclaw_e2e_print_log /tmp/openclaw-update-corrupt-plugin.json >&2
107107
echo "corrupt update stderr:" >&2
108-
cat /tmp/openclaw-update-corrupt-plugin.err >&2 || true
108+
openclaw_e2e_print_log /tmp/openclaw-update-corrupt-plugin.err >&2
109109
exit 1
110110
fi

test/scripts/plugin-update-unchanged-docker.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ describe("plugin update unchanged Docker E2E", () => {
163163
expect(script).toContain(
164164
"updated OpenClaw entry failed or timed out after ${update_timeout_seconds}s",
165165
);
166+
expect(script.match(/openclaw_e2e_print_log \/tmp\/openclaw-update-corrupt-/g)).toHaveLength(8);
167+
expect(script).not.toContain("cat /tmp/openclaw-update-corrupt-");
166168
});
167169

168170
it("requires disabled-after-failure corrupt plugin updates to stay warnings", () => {

0 commit comments

Comments
 (0)