test: validate grpc data connections with local docker and opcua cli

This commit is contained in:
Joseph Doherty
2026-11-17 22:01:26 -05:00
parent 1df29a3124
commit 29fec57fac
194 changed files with 23327 additions and 740 deletions
@@ -13,6 +13,11 @@ public sealed record ProjectedMappingPlacement(RemoteNamespaceMapping Mapping, D
public sealed class ProjectedMappingDeploymentRuntime : IDisposable
{
private readonly object _gate = new();
// Serializes placement transitions with the SDK anchor reconciler without holding
// the catalog gate across SDK calls or introducing SDK -> transition lock ordering.
internal object TransitionGate { get; } = new();
private bool _suspended;
internal bool Suspended => Volatile.Read(ref _suspended);
private readonly LocalCatalogCoordinator _coordinator;
private readonly RemoteNamespaceResolver _resolver;
private CatalogAttempt? _attempt;
@@ -130,10 +135,12 @@ public sealed class ProjectedMappingDeploymentRuntime : IDisposable
internal void AttemptBegan(CatalogAttempt attempt)
{
bool changed;
lock (TransitionGate)
lock (_gate)
{
if (_disposed || _attempt is not null && attempt.Epoch <= _attempt.Epoch) return;
_attempt = attempt;
Volatile.Write(ref _suspended, true);
Volatile.Write(ref _configuredStamp, new object());
_configuredCapabilities.Clear();
_staged = []; _connections = [];
@@ -148,12 +155,14 @@ public sealed class ProjectedMappingDeploymentRuntime : IDisposable
internal void AttemptCompleted(CatalogAttempt attempt, bool completed)
{
IReadOnlyList<ProjectedMappingPlacement> published;
lock (TransitionGate)
lock (_gate)
{
if (_disposed || !ReferenceEquals(_attempt, attempt)) return;
Volatile.Write(ref _configuredStamp, new object());
_configuredCapabilities.Clear();
var catalog = completed ? _coordinator.MappingCatalog(attempt) : null;
var success = false;
if (catalog is null || !catalog.IsActive)
{
_resolver.ApplyMappings([]);
@@ -171,6 +180,7 @@ public sealed class ProjectedMappingDeploymentRuntime : IDisposable
if (current is null || !ReferenceEquals(current.MappingAuthority, catalog.MappingAuthority) || !catalog.IsActive)
throw new InvalidOperationException("Catalog attempt changed during projection activation.");
Volatile.Write(ref _active, Array.AsReadOnly(placements));
success = true;
}
catch (Exception ex) when (ex is ArgumentException or InvalidOperationException or OverflowException)
{
@@ -178,6 +188,7 @@ public sealed class ProjectedMappingDeploymentRuntime : IDisposable
Volatile.Write(ref _active, Array.Empty<ProjectedMappingPlacement>());
}
}
Volatile.Write(ref _suspended, !success);
_byMapping = _active.ToDictionary(x => x.Mapping.RemoteNamespaceMappingId, StringComparer.OrdinalIgnoreCase);
published = CopyPlacements(_active);
}
@@ -233,10 +244,12 @@ public sealed class ProjectedMappingDeploymentRuntime : IDisposable
public void Dispose()
{
lock (TransitionGate)
lock (_gate)
{
if (_disposed) return;
_disposed = true;
Volatile.Write(ref _suspended, false);
Volatile.Write(ref _configuredStamp, new object());
_configuredCapabilities.Clear();
Volatile.Write(ref _active, Array.Empty<ProjectedMappingPlacement>());