harden(historian): nullable HistorizeToAveva (missing→historize) for rolling-restart-safe deserialize + middle-link test
This commit is contained in:
+36
@@ -576,6 +576,42 @@ public sealed class ScriptedAlarmHostActorTests : RuntimeActorTestBase
|
||||
alerts.ExpectNoMsg(TimeSpan.FromMilliseconds(500));
|
||||
}
|
||||
|
||||
/// <summary>HistorizeToAveva flag threading (middle-link): the host MUST carry the plan's
|
||||
/// <c>HistorizeToAveva</c> flag onto the <see cref="AlarmTransitionEvent"/> it publishes to the
|
||||
/// <c>alerts</c> topic. Verifies both the <c>true</c> (default <see cref="Plan"/>) and the
|
||||
/// <c>false</c> (<see cref="BadPlan"/> carries false on the fixture) cases so any regression in
|
||||
/// <c>ScriptedAlarmHostActor.OnEngineEmission</c>'s flag threading is caught here before
|
||||
/// <c>HistorianAdapterActor</c>'s opt-out gate becomes the first line of defence.</summary>
|
||||
[Fact]
|
||||
public void HistorizeToAveva_flag_is_threaded_onto_published_AlarmTransitionEvent()
|
||||
{
|
||||
var publish = CreateTestProbe();
|
||||
var mux = CreateTestProbe();
|
||||
var alerts = CreateTestProbe();
|
||||
SubscribeToAlerts(alerts);
|
||||
|
||||
// Build two plans: one with HistorizeToAveva=true (Plan default), one with false.
|
||||
// Use distinct ids + dep refs so both load cleanly side-by-side.
|
||||
var planTrue = Plan(id: "alm-hist-true", depRef: "H.T", severity: 800); // HistorizeToAveva: true
|
||||
var planFalse = Plan(id: "alm-hist-false", depRef: "H.F", severity: 800) with { HistorizeToAveva = false };
|
||||
|
||||
var (host, _) = Spawn(publish, mux);
|
||||
host.Tell(new ScriptedAlarmHostActor.ApplyScriptedAlarms(new[] { planTrue, planFalse }));
|
||||
mux.ExpectMsg<DependencyMuxActor.RegisterInterest>(Timeout); // load completed
|
||||
|
||||
// Activate the true-flag alarm.
|
||||
host.Tell(new VirtualTagActor.DependencyValueChanged("H.T", 99, DateTime.UtcNow));
|
||||
var evtTrue = alerts.FishForMessage<AlarmTransitionEvent>(
|
||||
e => e.AlarmId == "alm-hist-true" && e.TransitionKind == "Activated", Timeout);
|
||||
evtTrue.HistorizeToAveva.ShouldBe(true);
|
||||
|
||||
// Activate the false-flag alarm.
|
||||
host.Tell(new VirtualTagActor.DependencyValueChanged("H.F", 99, DateTime.UtcNow));
|
||||
var evtFalse = alerts.FishForMessage<AlarmTransitionEvent>(
|
||||
e => e.AlarmId == "alm-hist-false" && e.TransitionKind == "Activated", Timeout);
|
||||
evtFalse.HistorizeToAveva.ShouldBe(false);
|
||||
}
|
||||
|
||||
/// <summary>Absent-node default-emit (A1): a <see cref="RedundancyStateChanged"/> snapshot that
|
||||
/// contains ONLY other nodes (the host's own <see cref="LocalNode"/> is absent) must leave the
|
||||
/// cached local role unchanged (null/unknown) — the host therefore defaults to emit, publishing
|
||||
|
||||
Reference in New Issue
Block a user