mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-14 21:30:43 +00:00
test: harden parallels smoke harness
This commit is contained in:
@@ -193,6 +193,7 @@ const { defaultRuntime } = await import("../runtime.js");
|
||||
const { updateCommand, updateStatusCommand, updateWizardCommand } = await import("./update-cli.js");
|
||||
const updateCliShared = await import("./update-cli/shared.js");
|
||||
const { resolveGitInstallDir } = updateCliShared;
|
||||
const { spawnSync } = await import("node:child_process");
|
||||
|
||||
type UpdateCliScenario = {
|
||||
name: string;
|
||||
@@ -458,6 +459,19 @@ describe("update-cli", () => {
|
||||
setStdoutTty(false);
|
||||
});
|
||||
|
||||
it("bounds completion cache refresh during update follow-up", async () => {
|
||||
const root = createCaseDir("openclaw-completion-timeout");
|
||||
pathExists.mockResolvedValue(true);
|
||||
|
||||
await updateCliShared.tryWriteCompletionCache(root, false);
|
||||
|
||||
expect(spawnSync).toHaveBeenCalledWith(
|
||||
expect.any(String),
|
||||
[path.join(root, "openclaw.mjs"), "completion", "--write-state"],
|
||||
expect.objectContaining({ timeout: 30_000 }),
|
||||
);
|
||||
});
|
||||
|
||||
it("respawns into the updated package root before running post-update tasks", async () => {
|
||||
const { entrypoints } = setupUpdatedRootRefresh();
|
||||
|
||||
|
||||
@@ -258,6 +258,8 @@ export async function resolveGlobalManager(params: {
|
||||
return byPresence ?? "npm";
|
||||
}
|
||||
|
||||
const COMPLETION_CACHE_WRITE_TIMEOUT_MS = 30_000;
|
||||
|
||||
export async function tryWriteCompletionCache(root: string, jsonMode: boolean): Promise<void> {
|
||||
const binPath = path.join(root, "openclaw.mjs");
|
||||
if (!(await pathExists(binPath))) {
|
||||
@@ -268,6 +270,7 @@ export async function tryWriteCompletionCache(root: string, jsonMode: boolean):
|
||||
cwd: root,
|
||||
env: process.env,
|
||||
encoding: "utf-8",
|
||||
timeout: COMPLETION_CACHE_WRITE_TIMEOUT_MS,
|
||||
});
|
||||
|
||||
if (result.error) {
|
||||
|
||||
Reference in New Issue
Block a user