Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

test: 等待工具保存并收尾 SSH 测试进程

Zhehui Bid3b655d78cdb
diff --git a/scripts/testing/tool-selection-ui.e2e.test.ts b/scripts/testing/tool-selection-ui.e2e.test.ts
index de12729c8f..af52c6e1c4 100644
--- a/scripts/testing/tool-selection-ui.e2e.test.ts
+++ b/scripts/testing/tool-selection-ui.e2e.test.ts
@@ -65,7 +65,7 @@ interface SavedBot { id: string; name: string; toolScope?: { allow?: string[]; d
await click("Save tool selection");
const selected = { allow: ["native:*", "mcp:mail:read_notes"], deny: ["mcp:mail:send"] };
await expect.poll(() => scope()).toEqual(selected);
- expect(await snapshot()).toContain("Custom selection saved");
+ await expect.poll(snapshot, { timeout: 10_000 }).toContain("Custom selection saved");
await fill("Allow (one per line)", "native:read*");
expect(await evaluate("[...document.querySelectorAll('button')].find(b=>b.textContent.trim()==='Save tool selection')?.disabled")).toBe(true);
diff --git a/server/vps-ssh-init.test.ts b/server/vps-ssh-init.test.ts
index b9ff0a5adf..2851bf9442 100644
--- a/server/vps-ssh-init.test.ts
+++ b/server/vps-ssh-init.test.ts
@@ -140,8 +140,12 @@ describe.skipIf(process.platform === "win32")("cold VPS SSH startup", () => {
it("bounds a stuck initialization without launching Docker", async () => {
const fixture = await sshFixture();
- await expect(defaultRunner(target("stuck-vps", "run"), { timeoutMs: 1_000 })).rejects.toThrow(/SSH|timed out/i);
- expect(commands(fixture.calls)).toHaveLength(0);
+ const timedOut = expect(defaultRunner(target("stuck-vps", "run"), { timeoutMs: 1_000 })).rejects.toThrow(/SSH|timed out/i);
+ // The caller's timeout leaves the shared master running. Let the stub receive and finish it before the next test rewrites the SSH shim.
+ try {
+ await Promise.all([fixture.authenticating, timedOut]);
+ expect(commands(fixture.calls)).toHaveLength(0);
+ } finally { fixture.release(); }
});
it("does not let a short first caller cancel initialization for a longer caller", async () => {