test(servers): cover exhaustion reconnection and offline retry loop

Adds a production-wired exhaustion trigger hook, documents the
no-throw invariant behind the fire-and-forget verification probe, and
covers the confirmed-offline reconnect and debounce-driven recovery.
This commit is contained in:
edde746
2026-07-13 12:05:23 +02:00
parent 65e63c206e
commit e15bbed554
2 changed files with 87 additions and 1 deletions
+8
View File
@@ -1139,6 +1139,9 @@ class MultiServerManager {
});
}
/// Fire-and-forget safe: both backends' `checkHealth` catch every failure
/// and fold it into a [HealthStatus], and the scheduled reconnection guards
/// its own errors — this future must never complete with one.
Future<void> _verifyServerEndpointsExhausted(ServerId serverId) async {
final client = _clients[serverId];
if (client == null || !_endpointHealthChecks.add(serverId)) return;
@@ -1193,6 +1196,11 @@ class MultiServerManager {
Future<void> debugVerifyServerEndpointsExhaustedForTesting(ServerId serverId) =>
_verifyServerEndpointsExhausted(serverId);
/// Entry point matching production exhaustion wiring (debounce + the
/// in-flight-verification guard), for tests driving the full retry loop.
@visibleForTesting
void debugTriggerEndpointsExhaustedForTesting(ServerId serverId) => _onServerEndpointsExhausted(serverId);
/// Disconnect all servers
void disconnectAll() {
appLogger.i('Disconnecting all servers');