test(opcua): distinguish baseline close semantics and terminal ownership

This commit is contained in:
Joseph Doherty
2026-11-10 16:50:00 -05:00
parent 2cf7c1d248
commit 3e136d7367
8 changed files with 2668 additions and 17 deletions
@@ -18,6 +18,7 @@ internal sealed class BaselineRig : IAsyncDisposable
?? throw new InvalidOperationException("An ephemeral fixture credential is required");
private readonly OpcUaApplicationHostOptions _options;
private OpcUaApplicationHost _host = null!;
private bool _disposed;
internal OtOpcUaSdkServer Server { get; private set; } = null!;
internal OtOpcUaNodeManager Nm => Server.NodeManager!;
internal SdkAddressSpaceSink Sink { get; private set; } = null!;
@@ -88,9 +89,13 @@ internal sealed class BaselineRig : IAsyncDisposable
}
public async ValueTask DisposeAsync()
{
await _host.DisposeAsync();
Canonical.Ledger.Record("host-stop");
if (Directory.Exists(PkiRoot)) Directory.Delete(PkiRoot, true);
if (_disposed) return;
_disposed = true;
try
{
if (_host is not null) { await _host.DisposeAsync(); Canonical.Ledger.Record("host-stop"); }
}
finally { if (Directory.Exists(PkiRoot)) Directory.Delete(PkiRoot, true); }
}
private sealed class Auth : IOpcUaUserAuthenticator
{