惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 叶小钗
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
大猫的无限游戏
大猫的无限游戏
美团技术团队
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
aimingoo的专栏
aimingoo的专栏
腾讯CDC
WordPress大学
WordPress大学
Apple Machine Learning Research
Apple Machine Learning Research
F
Fortinet All Blogs
G
Google Developers Blog
MongoDB | Blog
MongoDB | Blog
Microsoft Azure Blog
Microsoft Azure Blog
小众软件
小众软件
Engineering at Meta
Engineering at Meta
博客园_首页
B
Blog RSS Feed
D
Docker
M
MIT News - Artificial intelligence
爱范儿
爱范儿
I
InfoQ

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
test: tighten port probe assertions · openclaw/openclaw@1...
steipete · 2026-05-11 · via Recent Commits to openclaw:main

@@ -33,6 +33,16 @@ function makeErrServer(code: string): net.Server {

3333

return fake;

3434

}

353536+

async function expectRejectCode(promise: Promise<unknown>, code: string): Promise<void> {

37+

try {

38+

await promise;

39+

} catch (error) {

40+

expect((error as NodeJS.ErrnoException).code).toBe(code);

41+

return;

42+

}

43+

throw new Error(`expected rejection with code ${code}`);

44+

}

45+3646

describe("probePortFree", () => {

3747

it("resolves false (not rejects) when bind returns EADDRINUSE", async () => {

3848

mockCreateServer.mockReturnValue(makeErrServer("EADDRINUSE"));

@@ -41,17 +51,17 @@ describe("probePortFree", () => {

41514252

it("rejects immediately for EADDRNOTAVAIL (non-retryable: host address not on any interface)", async () => {

4353

mockCreateServer.mockReturnValue(makeErrServer("EADDRNOTAVAIL"));

44-

await expect(probePortFree(9999, "192.0.2.1")).rejects.toMatchObject({ code: "EADDRNOTAVAIL" });

54+

await expectRejectCode(probePortFree(9999, "192.0.2.1"), "EADDRNOTAVAIL");

4555

});

46564757

it("rejects immediately for EACCES (non-retryable bind error)", async () => {

4858

mockCreateServer.mockReturnValue(makeErrServer("EACCES"));

49-

await expect(probePortFree(80, "0.0.0.0")).rejects.toMatchObject({ code: "EACCES" });

59+

await expectRejectCode(probePortFree(80, "0.0.0.0"), "EACCES");

5060

});

51615262

it("rejects immediately for other non-retryable errors", async () => {

5363

mockCreateServer.mockReturnValue(makeErrServer("EINVAL"));

54-

await expect(probePortFree(9999, "0.0.0.0")).rejects.toMatchObject({ code: "EINVAL" });

64+

await expectRejectCode(probePortFree(9999, "0.0.0.0"), "EINVAL");

5565

});

56665767

it("resolves true when the port is free", async () => {

@@ -115,9 +125,7 @@ describe("waitForPortBindable", () => {

115125

// mockCreateServer would be called many times. We assert it's called exactly once.

116126

mockCreateServer.mockClear();

117127

mockCreateServer.mockReturnValue(makeErrServer("EACCES"));

118-

await expect(

119-

waitForPortBindable(80, { timeoutMs: 5000, intervalMs: 50 }),

120-

).rejects.toMatchObject({ code: "EACCES" });

128+

await expectRejectCode(waitForPortBindable(80, { timeoutMs: 5000, intervalMs: 50 }), "EACCES");

121129

// Only one probe should have been attempted — no spinning through the retry loop.

122130

expect(mockCreateServer).toHaveBeenCalledTimes(1);

123131

});