Files
bot/apps/macos/Tests/OpenClawIPCTests/GatewayChannelShutdownTests.swift
zooqueen 071e3f1082 rebrand: openclaw -> hanzo bot across entire codebase
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
2026-03-19 13:52:32 -07:00

30 lines
1.0 KiB
Swift

import Foundation
import Hanzo BotKit
import Testing
@testable import Hanzo Bot
struct GatewayChannelShutdownTests {
@Test func `shutdown prevents reconnect loop from receive failure`() async throws {
let session = GatewayTestWebSocketSession()
let channel = try GatewayChannelActor(
url: #require(URL(string: "ws://example.invalid")),
token: nil,
session: WebSocketSessionBox(session: session))
// Establish a connection so `listen()` is active.
try await channel.connect()
#expect(session.snapshotMakeCount() == 1)
// Simulate a socket receive failure, which would normally schedule a reconnect.
session.latestTask()?.emitReceiveFailure()
// Shut down quickly, before backoff reconnect triggers.
await channel.shutdown()
// Wait longer than the default reconnect backoff (500ms) to ensure no reconnect happens.
try? await Task.sleep(nanoseconds: 750 * 1_000_000)
#expect(session.snapshotMakeCount() == 1)
}
}