From 49644fc7fd32575ab2900b4c16b6c0b2fe9f75f2 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Sat, 23 May 2026 19:32:23 -0400 Subject: [PATCH] test(fixtures): migrate integration-test fixture defaults to 10.100.0.35 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CLAUDE.md "Docker Workflow" claims (per the 2026-04-28 migration note) that all fixture-class default endpoints were rewritten to target the shared Docker host at 10.100.0.35. Audit during today's e2e run showed the claim was incomplete — five fixture classes still defaulted to localhost / 127.0.0.1, causing every fixture-touching integration test to skip with "endpoint unreachable" on a fresh box that hadn't set the override env vars. Files corrected: - tests/.../Modbus.IntegrationTests/ModbusSimulatorFixture.cs DefaultEndpoint: localhost:5020 → 10.100.0.35:5020 - tests/.../S7.IntegrationTests/Snap7ServerFixture.cs DefaultEndpoint: localhost:1102 → 10.100.0.35:1102 - tests/.../OpcUaClient.IntegrationTests/OpcPlcFixture.cs DefaultEndpoint: opc.tcp://localhost:50000 → opc.tcp://10.100.0.35:50000 - tests/.../AbCip.IntegrationTests/AbServerFixture.cs Host default + ResolveHost fallback: 127.0.0.1 → 10.100.0.35 - tests/.../AbLegacy.IntegrationTests/AbLegacyServerFixture.cs Host default + ResolveEndpoint fallback: 127.0.0.1 → 10.100.0.35 XML doc comments referencing the old localhost defaults were updated in the same pass so the class-summary documentation matches the actual default. The override-via-env-var mechanism (MODBUS_SIM_ENDPOINT, AB_SERVER_ENDPOINT, AB_LEGACY_ENDPOINT, S7_SIM_ENDPOINT, OPCUA_SIM_ENDPOINT) is unchanged — pointing at a real PLC or a locally-running container still works exactly as before. Verification: - Solution-wide dotnet build: 0 errors. - S7.IntegrationTests: 3/3 pass without env-var override. - OpcUaClient.IntegrationTests: 3/3 pass without env-var override. - Modbus.IntegrationTests: 4/38 (same as the env-var-override run — the 2 failures + 32 skips are pre-existing fixture-profile mismatches unrelated to this fix). - AbCip.IntegrationTests / AbLegacy.IntegrationTests: same results as the env-var-override run. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../AbServerFixture.cs | 11 +++++++---- .../AbLegacyServerFixture.cs | 9 ++++++--- .../ModbusSimulatorFixture.cs | 9 ++++++--- .../OpcPlcFixture.cs | 8 ++++++-- .../Snap7ServerFixture.cs | 6 ++++-- 5 files changed, 29 insertions(+), 14 deletions(-) diff --git a/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip.IntegrationTests/AbServerFixture.cs b/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip.IntegrationTests/AbServerFixture.cs index fe17ff9..4213db2 100644 --- a/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip.IntegrationTests/AbServerFixture.cs +++ b/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip.IntegrationTests/AbServerFixture.cs @@ -8,7 +8,7 @@ namespace ZB.MOM.WW.OtOpcUa.Driver.AbCip.IntegrationTests; /// Reachability probe for the ab_server Docker container (libplctag's CIP /// simulator built via Docker/Dockerfile) or any real AB PLC the /// AB_SERVER_ENDPOINT env var points at. Parses -/// AB_SERVER_ENDPOINT (default localhost:44818) + TCP-connects +/// AB_SERVER_ENDPOINT (default 10.100.0.35:44818 — the shared Docker host) + TCP-connects /// once at fixture construction. Tests skip via /// / when the port isn't live, so /// dotnet test stays green on a fresh clone without Docker running. @@ -28,7 +28,10 @@ public sealed class AbServerFixture : IAsyncLifetime /// instantiate the fixture with the profile matching their compose-file service. public AbServerProfile Profile { get; } - public string Host { get; } = "127.0.0.1"; + // 10.100.0.35 = the shared Docker host (see CLAUDE.md "Docker Workflow"). Migrated + // off this VM's 127.0.0.1 on 2026-04-28 alongside the rest of the Docker-host move. + // Override via AB_SERVER_ENDPOINT to point at a real PLC or a locally-running container. + public string Host { get; } = "10.100.0.35"; public int Port { get; } = AbServerProfile.DefaultPort; public AbServerFixture() : this(KnownProfiles.ControlLogix) { } @@ -59,7 +62,7 @@ public sealed class AbServerFixture : IAsyncLifetime TcpProbe(ResolveHost(), ResolvePort()); private static string ResolveHost() => - Environment.GetEnvironmentVariable(EndpointEnvVar)?.Split(':', 2)[0] ?? "127.0.0.1"; + Environment.GetEnvironmentVariable(EndpointEnvVar)?.Split(':', 2)[0] ?? "10.100.0.35"; private static int ResolvePort() { @@ -84,7 +87,7 @@ public sealed class AbServerFixture : IAsyncLifetime /// /// [Fact]-equivalent that skips when ab_server isn't reachable — accepts a -/// live Docker listener on localhost:44818 or an AB_SERVER_ENDPOINT +/// live Docker listener on 10.100.0.35:44818 or an AB_SERVER_ENDPOINT /// override pointing at a real PLC. /// public sealed class AbServerFactAttribute : FactAttribute diff --git a/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbLegacy.IntegrationTests/AbLegacyServerFixture.cs b/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbLegacy.IntegrationTests/AbLegacyServerFixture.cs index 3e8bd09..20cff56 100644 --- a/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbLegacy.IntegrationTests/AbLegacyServerFixture.cs +++ b/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbLegacy.IntegrationTests/AbLegacyServerFixture.cs @@ -18,7 +18,7 @@ namespace ZB.MOM.WW.OtOpcUa.Driver.AbLegacy.IntegrationTests; /// Env-var overrides: /// /// AB_LEGACY_ENDPOINThost:port of the PCCC-mode simulator. -/// Defaults to localhost:44818 (EtherNet/IP port; ab_server's PCCC +/// Defaults to 10.100.0.35:44818 — the shared Docker host (EtherNet/IP port; ab_server's PCCC /// emulation exposes PCCC-over-CIP on the same port as CIP itself). /// AB_LEGACY_CIP_PATH — routing path appended to the ab://host:port/ /// URI. Defaults to 1,0 (port-1/slot-0 backplane), required by ab_server @@ -50,7 +50,10 @@ public sealed class AbLegacyServerFixture : IAsyncLifetime /// public const string DefaultCipPath = "1,0"; - public string Host { get; } = "127.0.0.1"; + // 10.100.0.35 = the shared Docker host (see CLAUDE.md "Docker Workflow"). Migrated + // off this VM's 127.0.0.1 on 2026-04-28 alongside the rest of the Docker-host move. + // Override via AB_LEGACY_ENDPOINT to point at a real PLC or a locally-running container. + public string Host { get; } = "10.100.0.35"; public int Port { get; } = DefaultPort; /// CIP routing path portion of the device URI (after the / separator). @@ -105,7 +108,7 @@ public sealed class AbLegacyServerFixture : IAsyncLifetime private static (string Host, int Port) ResolveEndpoint() { var raw = Environment.GetEnvironmentVariable(EndpointEnvVar); - if (raw is null) return ("127.0.0.1", DefaultPort); + if (raw is null) return ("10.100.0.35", DefaultPort); var parts = raw.Split(':', 2); var port = parts.Length == 2 && int.TryParse(parts[1], out var p) ? p : DefaultPort; return (parts[0], port); diff --git a/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.Modbus.IntegrationTests/ModbusSimulatorFixture.cs b/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.Modbus.IntegrationTests/ModbusSimulatorFixture.cs index 14f6472..b92c7e6 100644 --- a/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.Modbus.IntegrationTests/ModbusSimulatorFixture.cs +++ b/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.Modbus.IntegrationTests/ModbusSimulatorFixture.cs @@ -5,7 +5,7 @@ namespace ZB.MOM.WW.OtOpcUa.Driver.Modbus.IntegrationTests; /// /// Reachability probe for a Modbus TCP simulator (pymodbus in Docker, see /// Docker/docker-compose.yml) or a real PLC. Parses -/// MODBUS_SIM_ENDPOINT (default localhost:5020 per PR 43) and TCP-connects once at +/// MODBUS_SIM_ENDPOINT (default 10.100.0.35:5020 — the shared Docker host) and TCP-connects once at /// fixture construction. Each test checks and calls /// Assert.Skip when the endpoint was unreachable, so a dev box without a running /// simulator still passes `dotnet test` cleanly — matches the Galaxy live-smoke pattern in @@ -29,8 +29,11 @@ public sealed class ModbusSimulatorFixture : IAsyncDisposable // PR 43: default port is 5020 (pymodbus convention) instead of 502 (Modbus standard). // Picking 5020 sidesteps the privileged-port admin requirement on Windows + matches the // port baked into the pymodbus simulator JSON profiles in Docker/profiles/. Override with - // MODBUS_SIM_ENDPOINT to point at a real PLC on its native port 502. - private const string DefaultEndpoint = "localhost:5020"; + // MODBUS_SIM_ENDPOINT to point at a real PLC on its native port 502, or to a + // locally-running container if the shared host is unavailable. + // 10.100.0.35 = the shared Docker host (see CLAUDE.md "Docker Workflow"). Migrated + // off this VM's localhost on 2026-04-28 alongside the rest of the Docker-host move. + private const string DefaultEndpoint = "10.100.0.35:5020"; private const string EndpointEnvVar = "MODBUS_SIM_ENDPOINT"; public string Host { get; } diff --git a/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.OpcUaClient.IntegrationTests/OpcPlcFixture.cs b/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.OpcUaClient.IntegrationTests/OpcPlcFixture.cs index 856a12a..72dd503 100644 --- a/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.OpcUaClient.IntegrationTests/OpcPlcFixture.cs +++ b/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.OpcUaClient.IntegrationTests/OpcPlcFixture.cs @@ -6,7 +6,7 @@ namespace ZB.MOM.WW.OtOpcUa.Driver.OpcUaClient.IntegrationTests; /// Reachability probe for an opc-plc simulator (Microsoft Industrial IoT's /// OPC UA PLC from mcr.microsoft.com/iotedge/opc-plc) or any real OPC UA /// server the OPCUA_SIM_ENDPOINT env var points at. Parses -/// OPCUA_SIM_ENDPOINT (default opc.tcp://localhost:50000), +/// OPCUA_SIM_ENDPOINT (default opc.tcp://10.100.0.35:50000 — the shared Docker host), /// TCP-connects to the resolved host:port at collection init, and records a /// on failure. Tests call Assert.Skip on that, so /// `dotnet test` stays green when Docker isn't running the simulator — mirrors the @@ -32,7 +32,11 @@ namespace ZB.MOM.WW.OtOpcUa.Driver.OpcUaClient.IntegrationTests; /// public sealed class OpcPlcFixture : IAsyncDisposable { - private const string DefaultEndpoint = "opc.tcp://localhost:50000"; + // 10.100.0.35 = the shared Docker host (see CLAUDE.md "Docker Workflow"). Migrated + // off this VM's localhost on 2026-04-28 alongside the rest of the Docker-host move. + // Override via OPCUA_SIM_ENDPOINT to point at a different host or a locally-running + // opc-plc instance. + private const string DefaultEndpoint = "opc.tcp://10.100.0.35:50000"; private const string EndpointEnvVar = "OPCUA_SIM_ENDPOINT"; /// Full opc.tcp://host:port URL the driver session should connect to. diff --git a/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.S7.IntegrationTests/Snap7ServerFixture.cs b/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.S7.IntegrationTests/Snap7ServerFixture.cs index e7dbc22..2b5b306 100644 --- a/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.S7.IntegrationTests/Snap7ServerFixture.cs +++ b/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.S7.IntegrationTests/Snap7ServerFixture.cs @@ -5,7 +5,7 @@ namespace ZB.MOM.WW.OtOpcUa.Driver.S7.IntegrationTests; /// /// Reachability probe for the python-snap7 simulator Docker container (see /// Docker/docker-compose.yml) or a real S7 PLC. Parses S7_SIM_ENDPOINT -/// (default localhost:1102) + TCP-connects once at fixture construction. +/// (default 10.100.0.35:1102 — the shared Docker host) + TCP-connects once at fixture construction. /// Tests check + call Assert.Skip when unreachable, so /// `dotnet test` stays green on a fresh box without the simulator installed — /// mirrors the ModbusSimulatorFixture pattern. @@ -35,7 +35,9 @@ public sealed class Snap7ServerFixture : IAsyncDisposable { // Default 1102 (non-privileged) matches Docker/server.py. Override with // S7_SIM_ENDPOINT to point at a real PLC on its native 102. - private const string DefaultEndpoint = "localhost:1102"; + // 10.100.0.35 = the shared Docker host (see CLAUDE.md "Docker Workflow"). Migrated + // off this VM's localhost on 2026-04-28 alongside the rest of the Docker-host move. + private const string DefaultEndpoint = "10.100.0.35:1102"; private const string EndpointEnvVar = "S7_SIM_ENDPOINT"; public string Host { get; }