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

推荐订阅源

博客园 - 司徒正美
大猫的无限游戏
大猫的无限游戏
腾讯CDC
J
Java Code Geeks
博客园 - 【当耐特】
Microsoft Azure Blog
Microsoft Azure Blog
V
Visual Studio Blog
人人都是产品经理
人人都是产品经理
博客园 - Franky
博客园 - 聂微东
阮一峰的网络日志
阮一峰的网络日志
美团技术团队
云风的 BLOG
云风的 BLOG
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
U
Unit 42
雷峰网
雷峰网
B
Blog RSS Feed
博客园_首页
量子位
F
Fortinet All Blogs
罗磊的独立博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More
酷 壳 – CoolShell
酷 壳 – CoolShell
C
Check Point Blog

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 bonjour discovery assertions · openclaw/ope...
steipete · 2026-05-11 · via Recent Commits to openclaw:main

@@ -4,6 +4,19 @@ import { discoverGatewayBeacons } from "./bonjour-discovery.js";

4455

const WIDE_AREA_DOMAIN = "openclaw.internal.";

667+

type BeaconRecord = {

8+

domain?: string;

9+

instanceName?: string;

10+

displayName?: string;

11+

host?: string;

12+

port?: number;

13+

tailnetDns?: string;

14+

gatewayPort?: number;

15+

sshPort?: number;

16+

cliPath?: string;

17+

txt?: Record<string, unknown>;

18+

};

19+720

function collectMatching<T, U>(

821

items: readonly T[],

922

predicate: (item: T) => boolean,

@@ -18,6 +31,12 @@ function collectMatching<T, U>(

1831

return matches;

1932

}

203334+

function findBeaconByInstance(beacons: readonly BeaconRecord[], instanceName: string) {

35+

const beacon = beacons.find((item) => item.instanceName === instanceName);

36+

expect(beacon).toBeDefined();

37+

return beacon as BeaconRecord;

38+

}

39+2140

describe("bonjour-discovery", () => {

2241

it("discovers beacons on darwin across local + wide-area domains", async () => {

2342

const calls: Array<{ argv: string[]; timeoutMs: number }> = [];

@@ -100,22 +119,14 @@ describe("bonjour-discovery", () => {

100119

});

101120102121

expect(beacons).toHaveLength(3);

103-

expect(beacons).toEqual(

104-

expect.arrayContaining([

105-

expect.objectContaining({

106-

instanceName: studioInstance,

107-

displayName: "Peter’s Mac Studio",

108-

}),

109-

]),

110-

);

111-

expect(beacons.map((b) => b.domain)).toEqual(

112-

expect.arrayContaining(["local.", WIDE_AREA_DOMAIN]),

113-

);

122+

const studioBeacon = findBeaconByInstance(beacons, studioInstance);

123+

expect(studioBeacon.displayName).toBe("Peter’s Mac Studio");

124+

expect(beacons.map((b) => b.domain)).toContain("local.");

125+

expect(beacons.map((b) => b.domain)).toContain(WIDE_AREA_DOMAIN);

114126115127

const browseCalls = calls.filter((c) => c.argv[0] === "dns-sd" && c.argv[1] === "-B");

116-

expect(browseCalls.map((c) => c.argv[3])).toEqual(

117-

expect.arrayContaining(["local.", WIDE_AREA_DOMAIN]),

118-

);

128+

expect(browseCalls.map((c) => c.argv[3])).toContain("local.");

129+

expect(browseCalls.map((c) => c.argv[3])).toContain(WIDE_AREA_DOMAIN);

119130

expect([...new Set(browseCalls.map((c) => c.timeoutMs))]).toEqual([1234]);

120131

});

121132

@@ -166,16 +177,12 @@ describe("bonjour-discovery", () => {

166177

run: run as unknown as typeof runCommandWithTimeout,

167178

});

168179169-

expect(beacons).toEqual([

170-

expect.objectContaining({

171-

domain: "local.",

172-

instanceName: "Studio Gateway",

173-

displayName: "Peter’s Mac Studio",

174-

txt: expect.objectContaining({

175-

displayName: "Peter’s Mac Studio",

176-

}),

177-

}),

178-

]);

180+

expect(beacons).toHaveLength(1);

181+

const beacon = beacons[0] as BeaconRecord;

182+

expect(beacon.domain).toBe("local.");

183+

expect(beacon.instanceName).toBe("Studio Gateway");

184+

expect(beacon.displayName).toBe("Peter’s Mac Studio");

185+

expect(beacon.txt?.displayName).toBe("Peter’s Mac Studio");

179186

});

180187181188

it("falls back to tailnet DNS probing for wide-area when split DNS is not configured", async () => {

@@ -269,19 +276,17 @@ describe("bonjour-discovery", () => {

269276

run: run as unknown as typeof runCommandWithTimeout,

270277

});

271278272-

expect(beacons).toEqual([

273-

expect.objectContaining({

274-

domain: WIDE_AREA_DOMAIN,

275-

instanceName: "studio-gateway",

276-

displayName: "Studio",

277-

host: `studio.${zone}`,

278-

port: 18789,

279-

tailnetDns: "peters-mac-studio-1.sheep-coho.ts.net",

280-

gatewayPort: 18789,

281-

sshPort: 22,

282-

cliPath: "/opt/homebrew/bin/openclaw",

283-

}),

284-

]);

279+

expect(beacons).toHaveLength(1);

280+

const beacon = beacons[0] as BeaconRecord;

281+

expect(beacon.domain).toBe(WIDE_AREA_DOMAIN);

282+

expect(beacon.instanceName).toBe("studio-gateway");

283+

expect(beacon.displayName).toBe("Studio");

284+

expect(beacon.host).toBe(`studio.${zone}`);

285+

expect(beacon.port).toBe(18789);

286+

expect(beacon.tailnetDns).toBe("peters-mac-studio-1.sheep-coho.ts.net");

287+

expect(beacon.gatewayPort).toBe(18789);

288+

expect(beacon.sshPort).toBe(22);

289+

expect(beacon.cliPath).toBe("/opt/homebrew/bin/openclaw");

285290286291

expect(calls.map((c) => c.argv.slice(0, 2).join(" "))).toContain("tailscale status");

287292

expect(calls.map((c) => c.argv[0])).toContain("dig");

@@ -307,13 +312,13 @@ describe("bonjour-discovery", () => {

307312

run: run as unknown as typeof runCommandWithTimeout,

308313

});

309314310-

expect(

311-

collectMatching(

312-

calls,

313-

(c) => c[1] === "-B",

314-

(c) => c[3],

315-

),

316-

).toEqual(expect.arrayContaining(["local.", "openclaw.internal."]));

315+

const browseDomains = collectMatching(

316+

calls,

317+

(c) => c[1] === "-B",

318+

(c) => c[3],

319+

);

320+

expect(browseDomains).toContain("local.");

321+

expect(browseDomains).toContain("openclaw.internal.");

317322318323

calls.length = 0;

319324

await discoverGatewayBeacons({