From fb760bc46549528b4c3649d3cf92107c961f4465 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Fri, 24 Apr 2026 22:03:03 -0400 Subject: [PATCH] =?UTF-8?q?Task=20#135=20=E2=80=94=20update=20integration-?= =?UTF-8?q?test=20NodeIds=20for=20path-based=20scheme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 7 integration tests in Server.Tests were left behind by the path-based NodeId rename (#134). Each was constructing test NodeIds in the old "FullReference" shape ("TestFolder.Var1", "raw.var", "AlphaFolder.Var1", "plcaddr-temperature"), which the node manager no longer mints — the new shape is `{driverId}/{folder-path}/{browseName}` per OPC UA Part 3 §5.2.2 NodeId immutability. Fixed by re-deriving each test NodeId from the actual browse path the test fixture's driver registers: - OpcUaServerIntegrationTests: "TestFolder.Var1" → "fake/TestFolder/Var1" - HistoryReadIntegrationTests (4 tests): "raw.var" → "history-driver/raw", "proc.var" → "history-driver/proc" (×2), "atTime.var" → "history-driver/atTime" - MultipleDriverInstancesIntegrationTests: "AlphaFolder.Var1" → "alpha/AlphaFolder/Var1"; "BetaFolder.Var1" → "beta/BetaFolder/Var1" - OpcUaEquipmentWalkerIntegrationTests: "plcaddr-temperature" → "galaxy-prod/warsaw/line-a/oven-3/Temperature" (the walker uses Tag.Name as the browseName; the FullReference lives in TagConfig but no longer surfaces in the NodeId path) Server.Tests now 277/277 green excluding LiveLdap. Clears the regression flagged during the #124 verification run. --- .../HistoryReadIntegrationTests.cs | 10 ++++++---- .../MultipleDriverInstancesIntegrationTests.cs | 5 +++-- .../OpcUaEquipmentWalkerIntegrationTests.cs | 5 ++++- .../OpcUaServerIntegrationTests.cs | 5 ++++- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/tests/ZB.MOM.WW.OtOpcUa.Server.Tests/HistoryReadIntegrationTests.cs b/tests/ZB.MOM.WW.OtOpcUa.Server.Tests/HistoryReadIntegrationTests.cs index 47b42ec..30bbfab 100644 --- a/tests/ZB.MOM.WW.OtOpcUa.Server.Tests/HistoryReadIntegrationTests.cs +++ b/tests/ZB.MOM.WW.OtOpcUa.Server.Tests/HistoryReadIntegrationTests.cs @@ -66,7 +66,9 @@ public sealed class HistoryReadIntegrationTests : IAsyncLifetime { using var session = await OpenSessionAsync(); var nsIndex = (ushort)session.NamespaceUris.GetIndex("urn:OtOpcUa:history-driver"); - var nodeId = new NodeId("raw.var", nsIndex); + // Path-based NodeId per #134 — `{driverId}/{browseName}` since DiscoverAsync registers + // variables at the driver root rather than under a folder. + var nodeId = new NodeId("history-driver/raw", nsIndex); // The Opc.Ua client exposes HistoryRead via Session.HistoryRead. We construct a // ReadRawModifiedDetails (IsReadModified=false → raw path) and a single @@ -97,7 +99,7 @@ public sealed class HistoryReadIntegrationTests : IAsyncLifetime { using var session = await OpenSessionAsync(); var nsIndex = (ushort)session.NamespaceUris.GetIndex("urn:OtOpcUa:history-driver"); - var nodeId = new NodeId("proc.var", nsIndex); + var nodeId = new NodeId("history-driver/proc", nsIndex); var details = new ReadProcessedDetails { @@ -123,7 +125,7 @@ public sealed class HistoryReadIntegrationTests : IAsyncLifetime { using var session = await OpenSessionAsync(); var nsIndex = (ushort)session.NamespaceUris.GetIndex("urn:OtOpcUa:history-driver"); - var nodeId = new NodeId("proc.var", nsIndex); + var nodeId = new NodeId("history-driver/proc", nsIndex); var details = new ReadProcessedDetails { @@ -148,7 +150,7 @@ public sealed class HistoryReadIntegrationTests : IAsyncLifetime { using var session = await OpenSessionAsync(); var nsIndex = (ushort)session.NamespaceUris.GetIndex("urn:OtOpcUa:history-driver"); - var nodeId = new NodeId("atTime.var", nsIndex); + var nodeId = new NodeId("history-driver/atTime", nsIndex); var t1 = new DateTime(2024, 3, 1, 10, 0, 0, DateTimeKind.Utc); var t2 = new DateTime(2024, 3, 1, 10, 0, 30, DateTimeKind.Utc); diff --git a/tests/ZB.MOM.WW.OtOpcUa.Server.Tests/MultipleDriverInstancesIntegrationTests.cs b/tests/ZB.MOM.WW.OtOpcUa.Server.Tests/MultipleDriverInstancesIntegrationTests.cs index 6e90a64..7fff89c 100644 --- a/tests/ZB.MOM.WW.OtOpcUa.Server.Tests/MultipleDriverInstancesIntegrationTests.cs +++ b/tests/ZB.MOM.WW.OtOpcUa.Server.Tests/MultipleDriverInstancesIntegrationTests.cs @@ -108,8 +108,9 @@ public sealed class MultipleDriverInstancesIntegrationTests : IAsyncLifetime var alphaNs = (ushort)session.NamespaceUris.GetIndex("urn:OtOpcUa:alpha"); var betaNs = (ushort)session.NamespaceUris.GetIndex("urn:OtOpcUa:beta"); - var alphaValue = session.ReadValue(new NodeId("AlphaFolder.Var1", alphaNs)); - var betaValue = session.ReadValue(new NodeId("BetaFolder.Var1", betaNs)); + // Path-based NodeId per #134 — `{driverId}/{folder}/{browseName}`. + var alphaValue = session.ReadValue(new NodeId("alpha/AlphaFolder/Var1", alphaNs)); + var betaValue = session.ReadValue(new NodeId("beta/BetaFolder/Var1", betaNs)); alphaValue.Value.ShouldBe(42, "alpha driver's ReadAsync returns 42 — a misroute would surface as 99"); betaValue.Value.ShouldBe(99, "beta driver's ReadAsync returns 99 — a misroute would surface as 42"); diff --git a/tests/ZB.MOM.WW.OtOpcUa.Server.Tests/OpcUaEquipmentWalkerIntegrationTests.cs b/tests/ZB.MOM.WW.OtOpcUa.Server.Tests/OpcUaEquipmentWalkerIntegrationTests.cs index abfb4f4..3f87d34 100644 --- a/tests/ZB.MOM.WW.OtOpcUa.Server.Tests/OpcUaEquipmentWalkerIntegrationTests.cs +++ b/tests/ZB.MOM.WW.OtOpcUa.Server.Tests/OpcUaEquipmentWalkerIntegrationTests.cs @@ -90,7 +90,10 @@ public sealed class OpcUaEquipmentWalkerIntegrationTests : IAsyncLifetime using var session = await OpenSessionAsync(); var nsIndex = (ushort)session.NamespaceUris.GetIndex($"urn:OtOpcUa:{DriverId}"); - var tagNode = new NodeId("plcaddr-temperature", nsIndex); + // Path-based NodeId per #134 — `{driverId}/{areaName}/{lineName}/{equipmentName}/{tagName}`. + // The walker uses Tag.Name as the browseName, so the FullReference (TagConfig content + // "plcaddr-temperature") does not appear in the NodeId path. + var tagNode = new NodeId($"{DriverId}/warsaw/line-a/oven-3/Temperature", nsIndex); var equipmentFolder = new NodeId($"{DriverId}/warsaw/line-a/oven-3", nsIndex); BrowseChildren(session, equipmentFolder).ShouldContain(r => r.BrowseName.Name == "Temperature"); diff --git a/tests/ZB.MOM.WW.OtOpcUa.Server.Tests/OpcUaServerIntegrationTests.cs b/tests/ZB.MOM.WW.OtOpcUa.Server.Tests/OpcUaServerIntegrationTests.cs index bcdcb67..f2501e4 100644 --- a/tests/ZB.MOM.WW.OtOpcUa.Server.Tests/OpcUaServerIntegrationTests.cs +++ b/tests/ZB.MOM.WW.OtOpcUa.Server.Tests/OpcUaServerIntegrationTests.cs @@ -73,7 +73,10 @@ public sealed class OpcUaServerIntegrationTests : IAsyncLifetime using var session = await OpenSessionAsync(); var nsIndex = (ushort)session.NamespaceUris.GetIndex("urn:OtOpcUa:fake"); - var varNodeId = new NodeId("TestFolder.Var1", nsIndex); + // Path-based NodeId per #134 — `{driverId}/{folder-path}/{browseName}`. The driver-side + // FullReference ("TestFolder.Var1") is now decoupled from the NodeId so a backend rename + // doesn't shift the identifier seen by clients (OPC UA Part 3 §5.2.2 immutability). + var varNodeId = new NodeId("fake/TestFolder/Var1", nsIndex); var dv = session.ReadValue(varNodeId); dv.ShouldNotBeNull();