alarms: propagate degraded/source_provider through snapshot + gateway cache paths (integration fix I1/I2)
This commit is contained in:
@@ -279,6 +279,60 @@ public sealed class AlarmDispatcherTests
|
||||
Assert.Equal(AlarmConditionState.ActiveAcked, snapshots[1].CurrentState);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that the per-record subtag-fallback flag flows through the
|
||||
/// snapshot path: a degraded record maps to an
|
||||
/// <see cref="ActiveAlarmSnapshot"/> with <see cref="ActiveAlarmSnapshot.Degraded"/>
|
||||
/// set and <see cref="AlarmProviderMode.Subtag"/>, while a non-degraded
|
||||
/// record stays on the alarmmgr parity contract.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void SnapshotActiveAlarms_PropagatesDegradedAndSourceProvider()
|
||||
{
|
||||
FakeAlarmConsumer consumer = new FakeAlarmConsumer();
|
||||
DateTime ts = new DateTime(2026, 5, 1, 17, 26, 14, 709, DateTimeKind.Utc);
|
||||
consumer.SnapshotResult = new[]
|
||||
{
|
||||
new MxAlarmSnapshotRecord
|
||||
{
|
||||
AlarmGuid = Guid.NewGuid(),
|
||||
ProviderName = "Galaxy",
|
||||
Group = "TestArea",
|
||||
TagName = "Tag1",
|
||||
Type = "DSC",
|
||||
Priority = 500,
|
||||
State = MxAlarmStateKind.UnackAlm,
|
||||
TransitionTimestampUtc = ts,
|
||||
Degraded = true,
|
||||
},
|
||||
new MxAlarmSnapshotRecord
|
||||
{
|
||||
AlarmGuid = Guid.NewGuid(),
|
||||
ProviderName = "Galaxy",
|
||||
Group = "TestArea",
|
||||
TagName = "Tag2",
|
||||
Type = "ANL",
|
||||
Priority = 100,
|
||||
State = MxAlarmStateKind.UnackAlm,
|
||||
TransitionTimestampUtc = ts,
|
||||
Degraded = false,
|
||||
},
|
||||
};
|
||||
using AlarmDispatcher dispatcher = new AlarmDispatcher(
|
||||
consumer,
|
||||
new MxAccessAlarmEventSink(new MxAccessEventQueue(), new MxAccessEventMapper()),
|
||||
SessionId);
|
||||
|
||||
IReadOnlyList<ActiveAlarmSnapshot> snapshots = dispatcher.SnapshotActiveAlarms();
|
||||
Assert.Equal(2, snapshots.Count);
|
||||
|
||||
Assert.True(snapshots[0].Degraded);
|
||||
Assert.Equal(AlarmProviderMode.Subtag, snapshots[0].SourceProvider);
|
||||
|
||||
Assert.False(snapshots[1].Degraded);
|
||||
Assert.Equal(AlarmProviderMode.Alarmmgr, snapshots[1].SourceProvider);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that dispose unsubscribes the handler and disposes the consumer.</summary>
|
||||
[Fact]
|
||||
public void Dispose_WhenSubscribed_UnsubscribesHandlerAndDisposesConsumer()
|
||||
|
||||
Reference in New Issue
Block a user