fix(historian-gateway): dispose alarm-write channel at shutdown + ServerHistorian startup diagnostic

Claude-Session: https://claude.ai/code/session_012SDSQ3AcaXqPcBtDESBRii
This commit is contained in:
Joseph Doherty
2026-06-26 17:55:44 -04:00
parent 22711444cc
commit 035bde0562
4 changed files with 28 additions and 2 deletions
@@ -199,4 +199,20 @@ public sealed class GatewayAlarmHistorianWriterTests
Assert.Empty(outcomes);
}
[Fact]
public void Dispose_with_async_only_client_does_not_throw()
{
// FakeHistorianGatewayClient implements IAsyncDisposable only — not IDisposable.
// The `as IDisposable` guard in GatewayAlarmHistorianWriter.Dispose() must safely
// no-op rather than throw when the client cannot be cast to IDisposable.
var fake = new FakeHistorianGatewayClient();
var writer = Writer(fake);
var ex = Record.Exception(() => ((IDisposable)writer).Dispose());
Assert.Null(ex);
// The Fake is IAsyncDisposable only; the sync Dispose must not call DisposeAsync.
Assert.Equal(0, fake.DisposeCallCount);
}
}