* macOS: honor Nix defaults suite; auto launch in Nix mode Fixes repeated onboarding in Nix deployments by detecting nixMode from the stable defaults suite (ai.openclaw.mac) and bridging key settings into the current defaults domain. Also enables LaunchAgent autostart by default in Nix mode (escape hatch: openclaw.nixAutoLaunchAtLogin=false). * macOS: keep Nix mode fix focused Drop the automatic launch-at-login behavior from the Nix defaults patch; keep this PR scoped to reliable nixMode detection + defaults bridging. * macOS: simplify nixMode fix Remove the defaults-bridging helper and rely on a single, stable defaults suite (ai.openclaw.mac) for nixMode detection when running as an app bundle. This keeps the fix focused on onboarding suppression and rename churn resilience. * macOS: fix nixMode defaults suite churn (#12205)
52 lines
1.9 KiB
Swift
52 lines
1.9 KiB
Swift
import Darwin
|
|
import Testing
|
|
@testable import OpenClawDiscovery
|
|
|
|
@Suite
|
|
struct WideAreaGatewayDiscoveryTests {
|
|
@Test func discoversBeaconFromTailnetDnsSdFallback() {
|
|
setenv("OPENCLAW_WIDE_AREA_DOMAIN", "openclaw.internal", 1)
|
|
let statusJson = """
|
|
{
|
|
"Self": { "TailscaleIPs": ["100.69.232.64"] },
|
|
"Peer": {
|
|
"peer-1": { "TailscaleIPs": ["100.123.224.76"] }
|
|
}
|
|
}
|
|
"""
|
|
|
|
let context = WideAreaGatewayDiscovery.DiscoveryContext(
|
|
tailscaleStatus: { statusJson },
|
|
dig: { args, _ in
|
|
let recordType = args.last ?? ""
|
|
let nameserver = args.first(where: { $0.hasPrefix("@") }) ?? ""
|
|
if recordType == "PTR" {
|
|
if nameserver == "@100.123.224.76" {
|
|
return "steipetacstudio-gateway._openclaw-gw._tcp.openclaw.internal.\n"
|
|
}
|
|
return ""
|
|
}
|
|
if recordType == "SRV" {
|
|
return "0 0 18789 steipetacstudio.openclaw.internal."
|
|
}
|
|
if recordType == "TXT" {
|
|
return "\"displayName=Peter\\226\\128\\153s Mac Studio (OpenClaw)\" \"gatewayPort=18789\" \"tailnetDns=peters-mac-studio-1.sheep-coho.ts.net\" \"cliPath=/Users/steipete/openclaw/src/entry.ts\""
|
|
}
|
|
return ""
|
|
})
|
|
|
|
let beacons = WideAreaGatewayDiscovery.discover(
|
|
timeoutSeconds: 2.0,
|
|
context: context)
|
|
|
|
#expect(beacons.count == 1)
|
|
let beacon = beacons[0]
|
|
let expectedDisplay = "Peter\u{2019}s Mac Studio (OpenClaw)"
|
|
#expect(beacon.displayName == expectedDisplay)
|
|
#expect(beacon.port == 18789)
|
|
#expect(beacon.gatewayPort == 18789)
|
|
#expect(beacon.tailnetDns == "peters-mac-studio-1.sheep-coho.ts.net")
|
|
#expect(beacon.cliPath == "/Users/steipete/openclaw/src/entry.ts")
|
|
}
|
|
}
|