fix(opcua): trace every rebuild path; align history tests with the B7 contract
B6 moved the address-space-rebuild span into ApplyPlan, so the two rebuilds that complete synchronously on the actor thread (no applier -> raw-sink rebuild; no artifact bytes -> held) stopped emitting it (OtOpcUaTelemetryHookTests.RebuildAddressSpace_starts_an_address_space_rebuild_span). Both now open their own span. B7 (late HistorianDataSource / HistorianDataUpdater re-evaluate the capability bits) reversed three tests that pinned the old "fixed at materialisation" contract. Re-expressed against the new one, end to end: - events: a folder promoted without a source is unsupported, then served once a source is wired (source reached); - in-process HistoryUpdate: clearing the updater retracts HistoryWrite and the old updater is never reached; - over the wire: a late updater lights HistoryWrite and an insert reaches it; a reset retracts the bit and the insert is BadHistoryOperationUnsupported. Refs #732 Claude-Session: https://claude.ai/code/session_01Ub9hGmYLQvn9XETzw7CMsT
This commit is contained in:
+15
-13
@@ -211,25 +211,21 @@ public sealed class NodeManagerHistoryReadEventsTests : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>A folder promoted to an event notifier while NO historian was wired (Null source at
|
||||
/// materialise time) is NOT registered as an event-history source ⇒ a HistoryReadEvents over it yields
|
||||
/// BadHistoryOperationUnsupported, and the (later-wired) source is never invoked.</summary>
|
||||
/// materialise time) is not an event-history source ⇒ a HistoryReadEvents over it yields
|
||||
/// BadHistoryOperationUnsupported. Wiring a real source AFTER promotion re-evaluates the folder
|
||||
/// (review 01 U3 / B7 — before B7 it stayed unsupported until a rebuild), so the same read then reaches
|
||||
/// the source.</summary>
|
||||
[Fact]
|
||||
public async Task Events_folder_promoted_without_source_yields_BadHistoryOperationUnsupported()
|
||||
public async Task Events_folder_promoted_without_source_is_unsupported_until_a_source_is_wired()
|
||||
{
|
||||
var (host, server) = await BootAsync();
|
||||
var nm = server.NodeManager!;
|
||||
|
||||
// Materialise the alarm while the source is still the Null default — the folder is promoted to
|
||||
// SubscribeToEvents but DOES NOT get the HistoryRead bit / source registration.
|
||||
const string equipmentId = "eq-nosrc";
|
||||
nm.EnsureFolder(equipmentId, parentNodeId: null, displayName: "Equipment", realm: AddressSpaceRealm.Uns);
|
||||
nm.MaterialiseAlarmCondition("alarm-4", equipmentId, "Cond", "OffNormalAlarm", severity: 200, realm: AddressSpaceRealm.Uns);
|
||||
var notifierNodeId = nm.TryGetFolder(equipmentId)!.NodeId;
|
||||
|
||||
// Wire a real source AFTER promotion — it must NOT retroactively make the folder a source.
|
||||
var fake = new RecordingHistorianDataSource();
|
||||
nm.HistorianDataSource = fake;
|
||||
|
||||
var details = new ReadEventDetails
|
||||
{
|
||||
StartTime = DateTime.UtcNow.AddHours(-1),
|
||||
@@ -238,11 +234,17 @@ public sealed class NodeManagerHistoryReadEventsTests : IDisposable
|
||||
Filter = SelectFilter("EventId"),
|
||||
};
|
||||
|
||||
var (_, unsupported) = InvokeHistoryRead(server, nm, details, notifierNodeId);
|
||||
unsupported[0].StatusCode.Code.ShouldBe(StatusCodes.BadHistoryOperationUnsupported);
|
||||
|
||||
var fake = new RecordingHistorianDataSource();
|
||||
nm.HistorianDataSource = fake;
|
||||
|
||||
var (_, errors) = InvokeHistoryRead(server, nm, details, notifierNodeId);
|
||||
|
||||
errors[0].StatusCode.Code.ShouldBe(StatusCodes.BadHistoryOperationUnsupported);
|
||||
fake.LastSourceName.ShouldBeNull(); // source never reached
|
||||
fake.EventsCalled.ShouldBeFalse();
|
||||
errors[0].StatusCode.Code.ShouldBe(StatusCodes.Good);
|
||||
fake.EventsCalled.ShouldBeTrue();
|
||||
fake.LastSourceName.ShouldBe(equipmentId);
|
||||
|
||||
await host.DisposeAsync();
|
||||
}
|
||||
@@ -258,7 +260,7 @@ public sealed class NodeManagerHistoryReadEventsTests : IDisposable
|
||||
/// the Bad result comes from the base's pre-seeding, not from our source-guard. This test pins
|
||||
/// that base-level rejection of variable nodes for event reads.
|
||||
/// The override's own source-guard (miss in <c>_eventNotifierSources</c>) is exercised by the
|
||||
/// <c>Events_folder_promoted_without_source_yields_BadHistoryOperationUnsupported</c> test instead.
|
||||
/// <c>Events_folder_promoted_without_source_is_unsupported_until_a_source_is_wired</c> test instead.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user