test(v3): migrate 6 driver IntegrationTests to RawTags API
Replace pre-declared options.Tags (typed <Driver>TagDefinition lists) with options.RawTags (IReadOnlyList<RawTagEntry>) across all 6 Docker-gated driver integration suites so they COMPILE against the v3 driver API. Each project gets a local <Driver>RawTags helper mirroring the unit-test project's helper: it serialises a typed def back to its TagConfig blob via the driver's <Driver>TagDefinitionFactory.ToTagConfig and packages it as a RawTagEntry (RawPath = def.Name; DeviceName = def.DeviceHostAddress for the multi-device drivers AbCip/AbLegacy/TwinCAT/FOCAS). Test intent (addresses, data types, device routing, assertions) is unchanged — only the tag-authoring/config-delivery shape was migrated. Docker-gated: these still skip at runtime without fixtures; COMPILE is the gate.
This commit is contained in:
+14
-25
@@ -246,14 +246,12 @@ public sealed class TwinCAT3SmokeTests(TwinCATXarFixture sim)
|
||||
var options = new TwinCATDriverOptions
|
||||
{
|
||||
Devices = [new TwinCATDeviceOptions($"ads://{sim.TargetNetId}:{sim.AmsPort}", "XAR-VM")],
|
||||
Tags =
|
||||
[
|
||||
RawTags = TwinCATRawTags.Entries(
|
||||
new TwinCATTagDefinition(
|
||||
Name: "Primitive",
|
||||
DeviceHostAddress: $"ads://{sim.TargetNetId}:{sim.AmsPort}",
|
||||
SymbolPath: symbolPath,
|
||||
DataType: type),
|
||||
],
|
||||
DataType: type)),
|
||||
Timeout = TimeSpan.FromSeconds(5),
|
||||
Probe = new TwinCATProbeOptions { Enabled = false },
|
||||
};
|
||||
@@ -307,8 +305,7 @@ public sealed class TwinCAT3SmokeTests(TwinCATXarFixture sim)
|
||||
var options = new TwinCATDriverOptions
|
||||
{
|
||||
Devices = [new TwinCATDeviceOptions($"ads://{sim.TargetNetId}:{sim.AmsPort}", "XAR-VM")],
|
||||
Tags =
|
||||
[
|
||||
RawTags = TwinCATRawTags.Entries(
|
||||
new TwinCATTagDefinition(
|
||||
Name: "WordBit3",
|
||||
DeviceHostAddress: $"ads://{sim.TargetNetId}:{sim.AmsPort}",
|
||||
@@ -318,8 +315,7 @@ public sealed class TwinCAT3SmokeTests(TwinCATXarFixture sim)
|
||||
Name: "WordBit4",
|
||||
DeviceHostAddress: $"ads://{sim.TargetNetId}:{sim.AmsPort}",
|
||||
SymbolPath: "GVL_Primitives.vWord.4",
|
||||
DataType: TwinCATDataType.Bool),
|
||||
],
|
||||
DataType: TwinCATDataType.Bool)),
|
||||
Timeout = TimeSpan.FromSeconds(5),
|
||||
Probe = new TwinCATProbeOptions { Enabled = false },
|
||||
};
|
||||
@@ -345,8 +341,7 @@ public sealed class TwinCAT3SmokeTests(TwinCATXarFixture sim)
|
||||
var options = new TwinCATDriverOptions
|
||||
{
|
||||
Devices = [new TwinCATDeviceOptions($"ads://{sim.TargetNetId}:{sim.AmsPort}", "XAR-VM")],
|
||||
Tags =
|
||||
[
|
||||
RawTags = TwinCATRawTags.Entries(
|
||||
new TwinCATTagDefinition(
|
||||
Name: "MotorTemp",
|
||||
DeviceHostAddress: $"ads://{sim.TargetNetId}:{sim.AmsPort}",
|
||||
@@ -356,8 +351,7 @@ public sealed class TwinCAT3SmokeTests(TwinCATXarFixture sim)
|
||||
Name: "MotorRunning",
|
||||
DeviceHostAddress: $"ads://{sim.TargetNetId}:{sim.AmsPort}",
|
||||
SymbolPath: "GVL_Plant.Line1.Stations[1].Axes[1].Motor.Running",
|
||||
DataType: TwinCATDataType.Bool),
|
||||
],
|
||||
DataType: TwinCATDataType.Bool)),
|
||||
Timeout = TimeSpan.FromSeconds(5),
|
||||
Probe = new TwinCATProbeOptions { Enabled = false },
|
||||
};
|
||||
@@ -386,8 +380,7 @@ public sealed class TwinCAT3SmokeTests(TwinCATXarFixture sim)
|
||||
var options = new TwinCATDriverOptions
|
||||
{
|
||||
Devices = [new TwinCATDeviceOptions($"ads://{sim.TargetNetId}:{sim.AmsPort}", "XAR-VM")],
|
||||
Tags =
|
||||
[
|
||||
RawTags = TwinCATRawTags.Entries(
|
||||
new TwinCATTagDefinition(
|
||||
Name: "NonexistentSymbol",
|
||||
DeviceHostAddress: $"ads://{sim.TargetNetId}:{sim.AmsPort}",
|
||||
@@ -398,8 +391,7 @@ public sealed class TwinCAT3SmokeTests(TwinCATXarFixture sim)
|
||||
DeviceHostAddress: $"ads://{sim.TargetNetId}:{sim.AmsPort}",
|
||||
SymbolPath: "GVL_Fixture.nCounter",
|
||||
DataType: TwinCATDataType.DInt,
|
||||
Writable: false),
|
||||
],
|
||||
Writable: false)),
|
||||
Timeout = TimeSpan.FromSeconds(5),
|
||||
Probe = new TwinCATProbeOptions { Enabled = false },
|
||||
};
|
||||
@@ -442,8 +434,7 @@ public sealed class TwinCAT3SmokeTests(TwinCATXarFixture sim)
|
||||
new TwinCATDeviceOptions(realHost, "Real-VM"),
|
||||
new TwinCATDeviceOptions(ghostHost, "Ghost-VM"),
|
||||
],
|
||||
Tags =
|
||||
[
|
||||
RawTags = TwinCATRawTags.Entries(
|
||||
new TwinCATTagDefinition(
|
||||
Name: "RealCounter",
|
||||
DeviceHostAddress: realHost,
|
||||
@@ -453,8 +444,7 @@ public sealed class TwinCAT3SmokeTests(TwinCATXarFixture sim)
|
||||
Name: "GhostCounter",
|
||||
DeviceHostAddress: ghostHost,
|
||||
SymbolPath: "GVL_Fixture.nCounter",
|
||||
DataType: TwinCATDataType.DInt),
|
||||
],
|
||||
DataType: TwinCATDataType.DInt)),
|
||||
// Shorter timeout so the bogus device fails fast rather than dragging the whole
|
||||
// test; the healthy read shouldn't be slowed down by a peer timeout.
|
||||
Timeout = TimeSpan.FromSeconds(2),
|
||||
@@ -488,7 +478,7 @@ public sealed class TwinCAT3SmokeTests(TwinCATXarFixture sim)
|
||||
var options = new TwinCATDriverOptions
|
||||
{
|
||||
Devices = [new TwinCATDeviceOptions($"ads://{sim.TargetNetId}:{sim.AmsPort}", "XAR-VM")],
|
||||
Tags = [],
|
||||
RawTags = [],
|
||||
Timeout = TimeSpan.FromSeconds(5),
|
||||
Probe = new TwinCATProbeOptions
|
||||
{
|
||||
@@ -532,7 +522,7 @@ public sealed class TwinCAT3SmokeTests(TwinCATXarFixture sim)
|
||||
var options = new TwinCATDriverOptions
|
||||
{
|
||||
Devices = baseOptions.Devices,
|
||||
Tags = baseOptions.Tags,
|
||||
RawTags = baseOptions.RawTags,
|
||||
UseNativeNotifications = baseOptions.UseNativeNotifications,
|
||||
Timeout = baseOptions.Timeout,
|
||||
Probe = baseOptions.Probe,
|
||||
@@ -565,7 +555,7 @@ public sealed class TwinCAT3SmokeTests(TwinCATXarFixture sim)
|
||||
HostAddress: $"ads://{sim.TargetNetId}:{sim.AmsPort}",
|
||||
DeviceName: "XAR-VM"),
|
||||
],
|
||||
Tags = [
|
||||
RawTags = TwinCATRawTags.Entries(
|
||||
new TwinCATTagDefinition(
|
||||
Name: "Counter",
|
||||
DeviceHostAddress: $"ads://{sim.TargetNetId}:{sim.AmsPort}",
|
||||
@@ -582,8 +572,7 @@ public sealed class TwinCAT3SmokeTests(TwinCATXarFixture sim)
|
||||
DeviceHostAddress: $"ads://{sim.TargetNetId}:{sim.AmsPort}",
|
||||
SymbolPath: "GVL_Arrays.aReal1D[5]",
|
||||
DataType: TwinCATDataType.Real,
|
||||
Writable: true),
|
||||
],
|
||||
Writable: true)),
|
||||
UseNativeNotifications = true,
|
||||
Timeout = TimeSpan.FromSeconds(5),
|
||||
// Disable the probe loop — the smoke tests run their own reads; a background
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
using ZB.MOM.WW.OtOpcUa.Core.Abstractions;
|
||||
|
||||
namespace ZB.MOM.WW.OtOpcUa.Driver.TwinCAT.IntegrationTests;
|
||||
|
||||
/// <summary>
|
||||
/// Test helper bridging the v2 authoring shape (a typed <see cref="TwinCATTagDefinition"/>) to the v3
|
||||
/// delivery shape (<see cref="RawTagEntry"/>). Under v3 the driver no longer takes pre-declared
|
||||
/// definitions — the deploy artifact hands it authored raw tags (RawPath + TagConfig blob + owning
|
||||
/// DeviceName), and the driver rebuilds the typed definitions via <see cref="TwinCATTagDefinitionFactory"/>.
|
||||
/// These integration smoke tests keep expressing their intent as typed definitions; this helper serialises
|
||||
/// each back to its TagConfig blob (via <see cref="TwinCATTagDefinitionFactory.ToTagConfig"/>) and packages
|
||||
/// it as a <see cref="RawTagEntry"/> whose RawPath is the def's <c>Name</c> and whose
|
||||
/// <see cref="RawTagEntry.DeviceName"/> is the def's <c>DeviceHostAddress</c> — so the round-trip through
|
||||
/// the real mapper + the driver's device resolution (which matches DeviceName against the configured
|
||||
/// devices by host) reproduces the same definition + device routing the test authored, keyed by the same
|
||||
/// name the read/write/subscribe call sites use. Mirrors the unit-test project's helper of the same name.
|
||||
/// </summary>
|
||||
internal static class TwinCATRawTags
|
||||
{
|
||||
/// <summary>Serialises one typed definition into its <see cref="RawTagEntry"/>
|
||||
/// (RawPath = def.Name, DeviceName = def.DeviceHostAddress).</summary>
|
||||
/// <param name="def">The typed definition to convert.</param>
|
||||
/// <returns>The equivalent <see cref="RawTagEntry"/>.</returns>
|
||||
public static RawTagEntry Entry(TwinCATTagDefinition def)
|
||||
=> new(def.Name, TwinCATTagDefinitionFactory.ToTagConfig(def), def.WriteIdempotent, def.DeviceHostAddress);
|
||||
|
||||
/// <summary>Serialises typed definitions into <see cref="RawTagEntry"/> records.</summary>
|
||||
/// <param name="defs">The typed definitions to convert (array, params, or a collection expression).</param>
|
||||
/// <returns>The equivalent raw-tag entries.</returns>
|
||||
public static IReadOnlyList<RawTagEntry> Entries(params TwinCATTagDefinition[] defs)
|
||||
=> [.. defs.Select(Entry)];
|
||||
}
|
||||
Reference in New Issue
Block a user