mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 11:50:43 +00:00
test: simplify parallels smoke harness
This commit is contained in:
@@ -3,6 +3,7 @@ import { describe, expect, it } from "vitest";
|
||||
import { windowsUpdateScript } from "../../scripts/e2e/parallels/npm-update-scripts.ts";
|
||||
|
||||
const SCRIPT_PATH = "scripts/e2e/parallels/npm-update-smoke.ts";
|
||||
const GUEST_TRANSPORTS_PATH = "scripts/e2e/parallels/guest-transports.ts";
|
||||
const UPDATE_SCRIPTS_PATH = "scripts/e2e/parallels/npm-update-scripts.ts";
|
||||
const TEST_AUTH = {
|
||||
authChoice: "openai",
|
||||
@@ -23,12 +24,13 @@ describe("parallels npm update smoke", () => {
|
||||
|
||||
it("runs Windows updates through a detached done-file runner", () => {
|
||||
const script = readFileSync(SCRIPT_PATH, "utf8");
|
||||
const transports = readFileSync(GUEST_TRANSPORTS_PATH, "utf8");
|
||||
|
||||
expect(script).toContain("openclaw-parallels-npm-update-windows");
|
||||
expect(script).toContain("runStreaming");
|
||||
expect(script).toContain("__OPENCLAW_BACKGROUND_EXIT__");
|
||||
expect(script).toContain("__OPENCLAW_BACKGROUND_DONE__");
|
||||
expect(script).toContain("Windows update timed out");
|
||||
expect(script).toContain("runWindowsBackgroundPowerShell");
|
||||
expect(transports).toContain("runWindowsBackgroundPowerShell");
|
||||
expect(transports).toContain("__OPENCLAW_BACKGROUND_EXIT__");
|
||||
expect(transports).toContain("__OPENCLAW_BACKGROUND_DONE__");
|
||||
expect(transports).toContain("${options.label} timed out");
|
||||
});
|
||||
|
||||
it("keeps macOS sudo fallback update scripts readable by the desktop user", () => {
|
||||
@@ -47,7 +49,7 @@ describe("parallels npm update smoke", () => {
|
||||
expect(script).toContain("delete plugins.entries.whatsapp");
|
||||
expect(script).toContain("Remove-FuturePluginEntries\nStop-OpenClawGatewayProcesses");
|
||||
expect(script).toContain("scrub_future_plugin_entries\nstop_openclaw_gateway_processes");
|
||||
expect(script).toContain("$env:OPENCLAW_DISABLE_BUNDLED_PLUGINS = '1'");
|
||||
expect(script).toContain("Invoke-WithScopedEnv @{ OPENCLAW_DISABLE_BUNDLED_PLUGINS = '1'");
|
||||
expect(script).toContain(
|
||||
"OPENCLAW_DISABLE_BUNDLED_PLUGINS=1 /opt/homebrew/bin/openclaw update --tag",
|
||||
);
|
||||
@@ -58,6 +60,28 @@ describe("parallels npm update smoke", () => {
|
||||
expect(script).toContain("OPENCLAW_DISABLE_BUNDLED_PLUGINS=1 openclaw gateway stop");
|
||||
});
|
||||
|
||||
it("reenables bundled plugins before Windows post-update verification", () => {
|
||||
const script = windowsUpdateScript({
|
||||
auth: TEST_AUTH,
|
||||
expectedNeedle: "2026.5.3-beta.2",
|
||||
updateTarget: "2026.5.3-beta.2",
|
||||
});
|
||||
|
||||
const updateIndex = script.indexOf("Invoke-OpenClaw update --tag");
|
||||
const scopedIndex = script.indexOf("Invoke-WithScopedEnv @{ OPENCLAW_DISABLE_BUNDLED_PLUGINS");
|
||||
const versionIndex = script.indexOf("Invoke-OpenClaw --version", scopedIndex);
|
||||
const restartIndex = script.indexOf("Invoke-OpenClaw gateway restart");
|
||||
const agentIndex = script.indexOf("Invoke-OpenClaw agent --local");
|
||||
|
||||
expect(updateIndex).toBeGreaterThanOrEqual(0);
|
||||
expect(scopedIndex).toBeGreaterThanOrEqual(0);
|
||||
expect(updateIndex).toBeGreaterThan(scopedIndex);
|
||||
expect(versionIndex).toBeGreaterThan(updateIndex);
|
||||
expect(restartIndex).toBeGreaterThan(updateIndex);
|
||||
expect(agentIndex).toBeGreaterThan(updateIndex);
|
||||
expect(script).not.toContain("$env:OPENCLAW_DISABLE_BUNDLED_PLUGINS = '1'");
|
||||
});
|
||||
|
||||
it("generates a .NET-safe Windows stale import regex in the update-failure guard", () => {
|
||||
const script = windowsUpdateScript({
|
||||
auth: TEST_AUTH,
|
||||
|
||||
@@ -447,16 +447,18 @@ console.log(JSON.stringify(result));
|
||||
|
||||
it("runs Windows ref onboarding through a detached done-file runner", () => {
|
||||
const script = readFileSync(TS_PATHS.windows, "utf8");
|
||||
const transports = readFileSync(TS_PATHS.guestTransports, "utf8");
|
||||
|
||||
expect(script).toContain("guestPowerShellBackground");
|
||||
expect(script).toContain("Join-Path $env:TEMP");
|
||||
expect(script).toContain("__OPENCLAW_BACKGROUND_DONE__");
|
||||
expect(script).toContain("__OPENCLAW_BACKGROUND_EXIT__");
|
||||
expect(script).toContain("__OPENCLAW_LOG_OFFSET__");
|
||||
expect(script).toContain("result.status !== 0 && result.status !== 124");
|
||||
expect(script).toContain("Start-Process -FilePath powershell.exe");
|
||||
expect(script).toContain('launchLog.includes("started")');
|
||||
expect(script).toContain("waitForBackgroundMaterialized(pathsScript, 45_000)");
|
||||
expect(script).toContain("runWindowsBackgroundPowerShell");
|
||||
expect(transports).toContain("Join-Path $env:TEMP");
|
||||
expect(transports).toContain("__OPENCLAW_BACKGROUND_DONE__");
|
||||
expect(transports).toContain("__OPENCLAW_BACKGROUND_EXIT__");
|
||||
expect(transports).toContain("__OPENCLAW_LOG_OFFSET__");
|
||||
expect(transports).toContain("poll.status !== 0 && poll.status !== 124");
|
||||
expect(transports).toContain("Start-Process -FilePath powershell.exe");
|
||||
expect(transports).toContain('launch.stdout.includes("started")');
|
||||
expect(transports).toContain("waitForWindowsBackgroundMaterialized");
|
||||
});
|
||||
|
||||
it("returns timed-out host command status when check is disabled", () => {
|
||||
@@ -520,10 +522,33 @@ console.log(JSON.stringify({
|
||||
|
||||
it("waits through transient Windows restoring state before VM operations", () => {
|
||||
const script = readFileSync(TS_PATHS.windows, "utf8");
|
||||
const transports = readFileSync(TS_PATHS.guestTransports, "utf8");
|
||||
|
||||
expect(script).toContain("waitForVmNotRestoring");
|
||||
expect(script).toContain("snapshot-switch retry");
|
||||
expect(script).toContain("launch retry");
|
||||
expect(transports).toContain("launch retry");
|
||||
});
|
||||
|
||||
it("keeps Windows update-only env flags scoped before verification", () => {
|
||||
const windows = readFileSync(TS_PATHS.windows, "utf8");
|
||||
const powershell = readFileSync(TS_PATHS.powershell, "utf8");
|
||||
|
||||
expect(powershell).toContain("windowsScopedEnvFunction");
|
||||
expect(windows).toContain(
|
||||
"Invoke-WithScopedEnv @{ OPENCLAW_ALLOW_OLDER_BINARY_DESTRUCTIVE_ACTIONS",
|
||||
);
|
||||
expect(windows).toContain("$script:OpenClawUpdateExit = $LASTEXITCODE");
|
||||
expect(windows).not.toContain("$env:OPENCLAW_DISABLE_BUNDLED_PLUGINS = '1'");
|
||||
});
|
||||
|
||||
it("writes Parallels phase timing artifacts", () => {
|
||||
const phaseRunner = readFileSync(TS_PATHS.phaseRunner, "utf8");
|
||||
const npmUpdate = readFileSync(TS_PATHS.npmUpdate, "utf8");
|
||||
|
||||
expect(phaseRunner).toContain("phase-timings.json");
|
||||
expect(phaseRunner).toContain("slowest");
|
||||
expect(npmUpdate).toContain("timings: this.timings");
|
||||
expect(npmUpdate).toContain("recordTiming");
|
||||
});
|
||||
|
||||
it("resolves Windows OpenClaw commands without assuming the npm shim path", () => {
|
||||
|
||||
Reference in New Issue
Block a user