test: simplify parallels smoke harness

This commit is contained in:
Peter Steinberger
2026-05-04 00:43:58 +01:00
parent c3f5c20f2c
commit d609859a8b
8 changed files with 488 additions and 374 deletions

View File

@@ -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", () => {