Files
lmxopcua/tests/ZB.MOM.WW.OtOpcUa.Driver.AbCip.IntegrationTests/AbCipHsbyFailoverTests.cs
2026-04-26 08:13:41 -04:00

48 lines
2.4 KiB
C#

using Shouldly;
using Xunit;
using ZB.MOM.WW.OtOpcUa.Driver.AbCip;
namespace ZB.MOM.WW.OtOpcUa.Driver.AbCip.IntegrationTests;
/// <summary>
/// PR abcip-5.2 — integration scaffold for HSBY failover routing through
/// <see cref="AbCipDriver.ResolveHost"/>. Skipped by default because the paired
/// fixture (controllogix-secondary <c>ab_server</c> instance + <c>hsby-mux</c>
/// sidecar that flips the role tag on demand) is not yet stable in the Docker
/// compose layout. The scaffold lives here so:
/// <list type="bullet">
/// <item>The trait is discoverable by <c>dotnet test --filter "Category=Hsby"</c>.</item>
/// <item>The companion E2E script (<c>scripts/e2e/test-abcip-hsby.ps1</c>) has a
/// paired surface already wired in tests when an operator stands up the fixture
/// manually.</item>
/// <item>A future PR can flip the skip into a real assertion without restructuring
/// the test layout.</item>
/// </list>
/// The unit-level coverage in <c>AbCipHsbyFailoverTests</c> (in the unit tests
/// project) exercises the active-address-routing + cache-invalidation contract in
/// full against the FakeAbCipTagFactory; this scaffold is just the wire-level shape.
/// </summary>
[Trait("Category", "Hsby")]
[Trait("Requires", "AbServer")]
public sealed class AbCipHsbyFailoverTests
{
[AbServerFact]
public Task ResolveHost_routes_to_partner_after_role_flip_through_hsby_mux()
{
// The paired-fixture compose service (controllogix + controllogix-secondary +
// hsby-mux sidecar at http://localhost:7080) is not yet wired. When it ships,
// the test body will:
// 1. POST {"active": "primary"} to hsby-mux → assert ResolveHost = primary
// gateway via a CLI read.
// 2. POST {"active": "partner"} → wait for the probe loop to catch up →
// assert ResolveHost = partner gateway via a second CLI read.
// 3. Assert AbCip.HsbyFailoverCount on the driver's diagnostics
// ≥ 1 by reading the driver-diagnostics RPC through the OPC UA Admin
// surface.
Assert.Skip("HSBY paired fixture (controllogix-secondary + hsby-mux sidecar) " +
"not yet promoted out of scaffold. Run scripts/e2e/test-abcip-hsby.ps1 against a " +
"manually-stood-up paired fixture when verifying this PR end-to-end.");
return Task.CompletedTask;
}
}