fix(redundancy): key redundancy-state snapshot by canonical host:port NodeId (was host-only — broke ServiceLevel + scripted-alarm emit gate)
This commit is contained in:
@@ -42,4 +42,30 @@ public sealed class RedundancyStateActorTests : ControlPlaneActorTestBase
|
||||
// After debounce settles, no more events are fired by a quiescent cluster.
|
||||
probe.ExpectNoMsg(TimeSpan.FromMilliseconds(500));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Regression guard: the snapshot node id MUST be the canonical <c>host:port</c> form (matching
|
||||
/// ClusterRoleInfo.LocalNode/ToNodeId), or every consumer's
|
||||
/// <c>n.NodeId == _localNode.Value</c> match fails and no node ever learns its role.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void ToNodeId_uses_canonical_host_and_port()
|
||||
{
|
||||
var nodeId = RedundancyStateActor.ToNodeId(
|
||||
new Address("akka.tcp", "otopcua", "central-2", 4053));
|
||||
|
||||
nodeId.Value.ShouldBe("central-2:4053");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Documents the host-less/port-less fallback (<c>:0</c>). Such members are skipped by
|
||||
/// BuildSnapshot's guard, but the helper must still format deterministically.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void ToNodeId_handles_missing_port()
|
||||
{
|
||||
var nodeId = RedundancyStateActor.ToNodeId(new Address("akka.tcp", "otopcua"));
|
||||
|
||||
nodeId.Value.ShouldBe(":0");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user