Task #219 — Server-integration test coverage for IAlarmSource dispatch path #197

Merged
dohertj2 merged 1 commits from task-219-alarm-history-integration into v2 2026-04-20 23:36:28 -04:00
Owner

Summary

  • Adds AlarmSubscribeIntegrationTests alongside HistoryReadIntegrationTests so both optional driver capabilities — IHistoryProvider (already covered) and IAlarmSource (new) — have end-to-end coverage that boots the full OPC UA stack and exercises the wiring path from driver event → GenericDriverNodeManager forwarder → DriverNodeManager.ConditionSink through a real Opc.Ua.Client.Session.
  • Two tests cover (1) single-tag alarm condition registration + synchronous-without-throwing transition, and (2) tag-scoped per-variable registration proving CapturingHandle produces distinct AlarmConditionState nodes for each IsAlarm=true variable.

Scoped-out (documented in the class docstring, not regressions)

  • The Opc.Ua stack exposes AlarmConditionState's inherited children (Severity/Message/ActiveState/…) with Foundation-namespace NodeIds that the DriverNodeManager does not add to its predefined-node index, so reading those child attributes through a client returns BadNodeIdUnknown.
  • OPC UA Part 9 event propagation (subscribe-on-Server + ConditionRefresh) is out of reach until the node manager wires HasNotifier + child-node registration.
  • In-memory alarm-sink fan-out is already covered by the Core-level GenericDriverNodeManagerTests; this PR adds the missing server-integration layer.

Test plan

  • dotnet test tests/ZB.MOM.WW.OtOpcUa.Server.Tests/ZB.MOM.WW.OtOpcUa.Server.Tests.csproj → 238 passed, 0 failed (includes the two new tests).

🤖 Generated with Claude Code

## Summary - Adds `AlarmSubscribeIntegrationTests` alongside `HistoryReadIntegrationTests` so both optional driver capabilities — `IHistoryProvider` (already covered) and `IAlarmSource` (new) — have end-to-end coverage that boots the full OPC UA stack and exercises the wiring path from driver event → `GenericDriverNodeManager` forwarder → `DriverNodeManager.ConditionSink` through a real `Opc.Ua.Client.Session`. - Two tests cover (1) single-tag alarm condition registration + synchronous-without-throwing transition, and (2) tag-scoped per-variable registration proving `CapturingHandle` produces distinct `AlarmConditionState` nodes for each `IsAlarm=true` variable. ## Scoped-out (documented in the class docstring, not regressions) - The Opc.Ua stack exposes `AlarmConditionState`'s inherited children (`Severity`/`Message`/`ActiveState`/…) with Foundation-namespace NodeIds that the `DriverNodeManager` does not add to its predefined-node index, so reading those child attributes through a client returns `BadNodeIdUnknown`. - OPC UA Part 9 event propagation (subscribe-on-`Server` + `ConditionRefresh`) is out of reach until the node manager wires `HasNotifier` + child-node registration. - In-memory alarm-sink fan-out is already covered by the Core-level `GenericDriverNodeManagerTests`; this PR adds the missing server-integration layer. ## Test plan - [x] `dotnet test tests/ZB.MOM.WW.OtOpcUa.Server.Tests/ZB.MOM.WW.OtOpcUa.Server.Tests.csproj` → 238 passed, 0 failed (includes the two new tests). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
dohertj2 added 1 commit 2026-04-20 23:36:17 -04:00
Adds AlarmSubscribeIntegrationTests alongside HistoryReadIntegrationTests so both
optional driver capabilities — IHistoryProvider (already covered) and IAlarmSource
(new) — have end-to-end coverage that boots the full OPC UA stack and exercises the
wiring path from driver event → GenericDriverNodeManager forwarder → DriverNodeManager
ConditionSink through a real Session.

Two tests:
  1. Driver_alarm_transition_updates_server_side_AlarmConditionState_node — a fake
     IAlarmSource declares an IsAlarm=true variable, calls MarkAsAlarmCondition in
     DiscoverAsync, and fires OnAlarmEvent for that source. Verifies the
     client can browse the alarm condition node at FullReference + ".Condition"
     and reads the DisplayName back through Session.Read.
  2. Each_IsAlarm_variable_registers_its_own_condition_node_in_the_driver_namespace —
     two IsAlarm variables each produce their own addressable AlarmConditionState,
     proving the CapturingHandle per-variable registration works.

Scoped-out (documented in the class docstring): the stack exposes AlarmConditionState's
inherited children (Severity / Message / ActiveState / …) with Foundation-namespace
NodeIds that DriverNodeManager does not add to its predefined-node index, so reading
those child attributes through a client returns BadNodeIdUnknown. OPC UA Part 9 event
propagation (subscribe-on-Server + ConditionRefresh) is likewise out of reach until
the node manager wires HasNotifier + child-node registration. The existing Core-level
GenericDriverNodeManagerTests cover the in-memory alarm-sink fan-out semantics.

Full Server.Tests suite: 238 passed, 0 failed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
dohertj2 merged commit bc44711dca into v2 2026-04-20 23:36:28 -04:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dohertj2/lmxopcua#197