mirror of
https://github.com/hanzoai/bot.git
synced 2026-10-30 17:24:26 +00:00
Automated rebrand of all openclaw references to hanzo bot: - Package: openclaw -> @hanzo/bot - Binary: openclaw -> hanzo-bot - Config: ~/.openclaw -> ~/.hanzo/bot - Docker: ghcr.io/hanzoai/bot - Env vars: OPENCLAW_* -> BOT_* - Bundle IDs: ai.hanzo.bot.* - Product name: Hanzo Bot
42 lines
1.8 KiB
Swift
42 lines
1.8 KiB
Swift
import Foundation
|
|
import Testing
|
|
@testable import Hanzo Bot
|
|
|
|
struct GatewayLaunchAgentManagerTests {
|
|
@Test func `launch agent plist snapshot parses args and env`() throws {
|
|
let url = FileManager().temporaryDirectory
|
|
.appendingPathComponent("openclaw-launchd-\(UUID().uuidString).plist")
|
|
let plist: [String: Any] = [
|
|
"ProgramArguments": ["@hanzo/bot", "gateway-daemon", "--port", "18789", "--bind", "loopback"],
|
|
"EnvironmentVariables": [
|
|
"BOT_GATEWAY_TOKEN": " secret ",
|
|
"BOT_GATEWAY_PASSWORD": "pw",
|
|
],
|
|
]
|
|
let data = try PropertyListSerialization.data(fromPropertyList: plist, format: .xml, options: 0)
|
|
try data.write(to: url, options: [.atomic])
|
|
defer { try? FileManager().removeItem(at: url) }
|
|
|
|
let snapshot = try #require(LaunchAgentPlist.snapshot(url: url))
|
|
#expect(snapshot.port == 18789)
|
|
#expect(snapshot.bind == "loopback")
|
|
#expect(snapshot.token == "secret")
|
|
#expect(snapshot.password == "pw")
|
|
}
|
|
|
|
@Test func `launch agent plist snapshot allows missing bind`() throws {
|
|
let url = FileManager().temporaryDirectory
|
|
.appendingPathComponent("openclaw-launchd-\(UUID().uuidString).plist")
|
|
let plist: [String: Any] = [
|
|
"ProgramArguments": ["@hanzo/bot", "gateway-daemon", "--port", "18789"],
|
|
]
|
|
let data = try PropertyListSerialization.data(fromPropertyList: plist, format: .xml, options: 0)
|
|
try data.write(to: url, options: [.atomic])
|
|
defer { try? FileManager().removeItem(at: url) }
|
|
|
|
let snapshot = try #require(LaunchAgentPlist.snapshot(url: url))
|
|
#expect(snapshot.port == 18789)
|
|
#expect(snapshot.bind == nil)
|
|
}
|
|
}
|