feat(717): Warm non-transparent redundancy, default-off (T1-T10)
OpcUa:Redundancy:Mode (Unset default = today's server exactly; None; Warm; Hot and unknown values fail start). - T1 options + validator + effective-URI check + boot banner; Warm needs the driver role. - T2 metadata in OnNodeManagerStartedAsync: Warm -> NonTransparentRedundancyType, read-only ServerUriArray [self, peers], RedundancySupport=Warm, boot ServiceLevel 1; None -> RedundancySupport=None and the SDK's orphan i=11314 deleted; Unset untouched. - T3 RedundancyStateChanged.Revision (up-number, incarnation tick, sequence); subscribers drop older revisions under Warm (OpcUaPublishActor, DriverHostActor); unrevisioned never makes a node Active. - T4 WarmRoleAuthority + ComputeWarm bands (Standby 90/50, Active 250/200/100), PromoteWhilePrimaryUnreachable. - T5 IStandbyProjection + DeferredStandbyProjection; OpcUaPublishActor runs promotion/demotion in the spec 4.7 order (Active level last and retried; Standby level first, data degraded regardless). - T6 EquipmentVariableState read projection (BadOutOfService/null); Warm Standby refuses writes BadInvalidState. - T7 D4 mechanism adopted after T0: ordinary-tag marker on MonitoredItemNotification.Message validated by (ClientHandle, DataValue); first-delivery decision keyed by (SubscriptionId, SequenceNumber); the SDK's cached copy is never mutated. - T8 queue current/BadOutOfService to live ordinary-tag items ignoring filters. - T9 alarm stamp/deliver split (suppressed on Standby), Part 9 methods refused on Standby, promotion refresh via ISubscription.ConditionRefresh2Async on every live event item. - T10 deploy-time RedundancyMode cross-check + six instruments. Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
This commit is contained in:
+35
@@ -132,3 +132,38 @@ public sealed class OpcUaApplicationHostOptionsValidatorTests
|
||||
if (!valid) result.Failures!.ShouldContain(f => f.Contains("OpcUa:Discovery"));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gitea #717 spec §3: the redundancy rules the startup validator and the driver-role guard enforce.</summary>
|
||||
public sealed class OpcUaRedundancyValidationTests
|
||||
{
|
||||
private static readonly OpcUaApplicationHostOptionsValidator Sut = new();
|
||||
|
||||
[Theory]
|
||||
[InlineData("Unset", new string[0], true)]
|
||||
[InlineData("None", new string[0], true)]
|
||||
[InlineData("None", new[] { "urn:peer" }, false)]
|
||||
[InlineData("Warm", new[] { "urn:peer" }, true)]
|
||||
[InlineData("Warm", new string[0], false)]
|
||||
[InlineData("Warm", new[] { "urn:peer", "urn:peer" }, false)]
|
||||
[InlineData("Warm", new[] { "urn:OtOpcUa" }, false)]
|
||||
[InlineData("Hot", new[] { "urn:peer" }, false)]
|
||||
[InlineData("Bogus", new string[0], false)]
|
||||
public void Redundancy_matrix(string mode, string[] peers, bool valid)
|
||||
{
|
||||
var result = Sut.Validate(null, new OpcUaApplicationHostOptions
|
||||
{
|
||||
Redundancy = new OpcUaRedundancyOptions { Mode = mode },
|
||||
PeerApplicationUris = peers.ToList(),
|
||||
});
|
||||
result.Succeeded.ShouldBe(valid, result.FailureMessage);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Warm_on_a_node_without_the_driver_role_fails_start()
|
||||
{
|
||||
Should.Throw<InvalidOperationException>(() => OpcUaRedundancyStartupGuard.RequireDriverRoleForWarm("Warm", hasDriver: false));
|
||||
OpcUaRedundancyStartupGuard.RequireDriverRoleForWarm("Warm", hasDriver: true);
|
||||
OpcUaRedundancyStartupGuard.RequireDriverRoleForWarm(null, hasDriver: false);
|
||||
OpcUaRedundancyStartupGuard.RequireDriverRoleForWarm("None", hasDriver: false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user