test: migrate AdminUI/ControlPlane/Runtime/Host tests to xunit.v3 (#756)
v2-ci / unit-tests (push) Failing after 13m22s
v2-ci / unit-tests (push) Failing after 13m22s
Akka.TestKit.Xunit2 -> Akka.TestKit.Xunit 1.5.62 (xunit.v3 TestKit; needs xunit.v3 3.2.2, set via VersionOverride on the four projects). Removes the xunit 2.9.3 pin. IAsyncLifetime returns ValueTask, SqlServerFactAttribute gains the source-info ctor, and xUnit1051 call sites pass TestContext.Current.CancellationToken. Test counts unchanged. Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
+33
-33
@@ -35,14 +35,14 @@ public sealed class DriverInstanceActorBatchForwardTests : RuntimeActorTestBase
|
||||
// #477: DriverInstanceActor Tells the parent ConnectivityChanged on each connect/disconnect;
|
||||
// this suite asserts on the value forwards only, so ignore it.
|
||||
parent.IgnoreMessages(m => m is DriverInstanceActor.ConnectivityChanged);
|
||||
var actor = parent.ChildActorOf(DriverInstanceActor.Props(driver));
|
||||
var actor = parent.ChildActorOf(DriverInstanceActor.Props(driver), TestContext.Current.CancellationToken);
|
||||
|
||||
actor.Tell(new DriverInstanceActor.InitializeRequested("{}"));
|
||||
AwaitCondition(() => driver.InitializeCount > 0, PresenceBudget);
|
||||
AwaitCondition(() => driver.InitializeCount > 0, PresenceBudget, TestContext.Current.CancellationToken);
|
||||
|
||||
await actor.Ask<DriverInstanceActor.SubscriptionEstablished>(
|
||||
new DriverInstanceActor.Subscribe(new[] { "tag-a", "tag-b", "tag-c" }, TimeSpan.FromMilliseconds(100)),
|
||||
PresenceBudget);
|
||||
PresenceBudget, TestContext.Current.CancellationToken);
|
||||
|
||||
var sourceTs = new DateTime(2026, 8, 15, 10, 0, 0, DateTimeKind.Utc);
|
||||
var serverTs = new DateTime(2026, 8, 15, 10, 0, 5, DateTimeKind.Utc);
|
||||
@@ -52,7 +52,7 @@ public sealed class DriverInstanceActorBatchForwardTests : RuntimeActorTestBase
|
||||
// Null source timestamp — the server timestamp is the fallback, per OnDataChangeForward.
|
||||
new DataChangeItem("tag-c", new DataValueSnapshot(null, OpcUaStatus.BadNoCommunication, null, serverTs)));
|
||||
|
||||
var batch = parent.ExpectMsg<DriverInstanceActor.AttributeValueBatchPublished>(PresenceBudget);
|
||||
var batch = parent.ExpectMsg<DriverInstanceActor.AttributeValueBatchPublished>(PresenceBudget, cancellationToken: TestContext.Current.CancellationToken);
|
||||
batch.DriverInstanceId.ShouldBe(driver.DriverInstanceId);
|
||||
batch.Items.Count.ShouldBe(3);
|
||||
|
||||
@@ -73,7 +73,7 @@ public sealed class DriverInstanceActorBatchForwardTests : RuntimeActorTestBase
|
||||
batch.Items[2].TimestampUtc.ShouldBe(serverTs, "a null SourceTimestampUtc falls back to the server timestamp");
|
||||
|
||||
// Exactly ONE message for the burst — no per-item trailer.
|
||||
parent.ExpectNoMsg(TimeSpan.FromMilliseconds(300));
|
||||
parent.ExpectNoMsg(TimeSpan.FromMilliseconds(300), TestContext.Current.CancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -88,14 +88,14 @@ public sealed class DriverInstanceActorBatchForwardTests : RuntimeActorTestBase
|
||||
var driver = new BatchSubscribableStubDriver();
|
||||
var parent = CreateTestProbe();
|
||||
parent.IgnoreMessages(m => m is DriverInstanceActor.ConnectivityChanged);
|
||||
var actor = parent.ChildActorOf(DriverInstanceActor.Props(driver));
|
||||
var actor = parent.ChildActorOf(DriverInstanceActor.Props(driver), TestContext.Current.CancellationToken);
|
||||
|
||||
actor.Tell(new DriverInstanceActor.InitializeRequested("{}"));
|
||||
AwaitCondition(() => driver.InitializeCount > 0, PresenceBudget);
|
||||
AwaitCondition(() => driver.InitializeCount > 0, PresenceBudget, TestContext.Current.CancellationToken);
|
||||
|
||||
await actor.Ask<DriverInstanceActor.SubscriptionEstablished>(
|
||||
new DriverInstanceActor.Subscribe(new[] { "tag-a", "tag-b" }, TimeSpan.FromMilliseconds(100)),
|
||||
PresenceBudget);
|
||||
PresenceBudget, TestContext.Current.CancellationToken);
|
||||
|
||||
// Deterministic half of the assertion: the per-tag handler was never attached at all. ExpectNoMsg
|
||||
// below only proves nothing arrived within its window; this proves it structurally cannot.
|
||||
@@ -106,12 +106,12 @@ public sealed class DriverInstanceActorBatchForwardTests : RuntimeActorTestBase
|
||||
new DataChangeItem("tag-a", new DataValueSnapshot(1, OpcUaStatus.Good, ts, ts)),
|
||||
new DataChangeItem("tag-b", new DataValueSnapshot(2, OpcUaStatus.Good, ts, ts)));
|
||||
|
||||
var batch = parent.ExpectMsg<DriverInstanceActor.AttributeValueBatchPublished>(PresenceBudget);
|
||||
var batch = parent.ExpectMsg<DriverInstanceActor.AttributeValueBatchPublished>(PresenceBudget, cancellationToken: TestContext.Current.CancellationToken);
|
||||
batch.Items.Count.ShouldBe(2);
|
||||
|
||||
// The per-tag raises for the SAME burst produced nothing extra — no second batch, no
|
||||
// single-item batch. Anything here means both handlers were attached.
|
||||
parent.ExpectNoMsg(TimeSpan.FromMilliseconds(400));
|
||||
parent.ExpectNoMsg(TimeSpan.FromMilliseconds(400), TestContext.Current.CancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -125,18 +125,18 @@ public sealed class DriverInstanceActorBatchForwardTests : RuntimeActorTestBase
|
||||
var driver = new SubscribableStubDriver();
|
||||
var parent = CreateTestProbe();
|
||||
parent.IgnoreMessages(m => m is DriverInstanceActor.ConnectivityChanged);
|
||||
var actor = parent.ChildActorOf(DriverInstanceActor.Props(driver));
|
||||
var actor = parent.ChildActorOf(DriverInstanceActor.Props(driver), TestContext.Current.CancellationToken);
|
||||
|
||||
actor.Tell(new DriverInstanceActor.InitializeRequested("{}"));
|
||||
AwaitCondition(() => driver.InitializeCount > 0, PresenceBudget);
|
||||
AwaitCondition(() => driver.InitializeCount > 0, PresenceBudget, TestContext.Current.CancellationToken);
|
||||
|
||||
await actor.Ask<DriverInstanceActor.SubscriptionEstablished>(
|
||||
new DriverInstanceActor.Subscribe(new[] { "tag-a" }, TimeSpan.FromMilliseconds(100)),
|
||||
PresenceBudget);
|
||||
PresenceBudget, TestContext.Current.CancellationToken);
|
||||
|
||||
driver.FireDataChange("tag-a", value: 3.14, statusCode: OpcUaStatus.Good);
|
||||
|
||||
var batch = parent.ExpectMsg<DriverInstanceActor.AttributeValueBatchPublished>(PresenceBudget);
|
||||
var batch = parent.ExpectMsg<DriverInstanceActor.AttributeValueBatchPublished>(PresenceBudget, cancellationToken: TestContext.Current.CancellationToken);
|
||||
batch.DriverInstanceId.ShouldBe(driver.DriverInstanceId);
|
||||
batch.Items.Count.ShouldBe(1);
|
||||
batch.Items[0].FullReference.ShouldBe("tag-a");
|
||||
@@ -155,25 +155,25 @@ public sealed class DriverInstanceActorBatchForwardTests : RuntimeActorTestBase
|
||||
var driver = new BatchSubscribableStubDriver();
|
||||
var parent = CreateTestProbe();
|
||||
parent.IgnoreMessages(m => m is DriverInstanceActor.ConnectivityChanged);
|
||||
var actor = parent.ChildActorOf(DriverInstanceActor.Props(driver));
|
||||
var actor = parent.ChildActorOf(DriverInstanceActor.Props(driver), TestContext.Current.CancellationToken);
|
||||
|
||||
actor.Tell(new DriverInstanceActor.InitializeRequested("{}"));
|
||||
AwaitCondition(() => driver.InitializeCount > 0, PresenceBudget);
|
||||
AwaitCondition(() => driver.InitializeCount > 0, PresenceBudget, TestContext.Current.CancellationToken);
|
||||
|
||||
await actor.Ask<DriverInstanceActor.SubscriptionEstablished>(
|
||||
new DriverInstanceActor.Subscribe(new[] { "tag-a" }, TimeSpan.FromMilliseconds(100)),
|
||||
PresenceBudget);
|
||||
PresenceBudget, TestContext.Current.CancellationToken);
|
||||
driver.OnDataChangeBatchSubscriberCount.ShouldBe(1, "the batch handler is attached for an IBatchSubscribable driver");
|
||||
|
||||
actor.Tell(new DriverInstanceActor.Unsubscribe());
|
||||
|
||||
AwaitCondition(() => driver.OnDataChangeBatchSubscriberCount == 0, PresenceBudget);
|
||||
AwaitCondition(() => driver.OnDataChangeBatchSubscriberCount == 0, PresenceBudget, TestContext.Current.CancellationToken);
|
||||
|
||||
var ts = new DateTime(2026, 8, 15, 12, 0, 0, DateTimeKind.Utc);
|
||||
driver.FireBatch(includePerTagRaises: true,
|
||||
new DataChangeItem("tag-a", new DataValueSnapshot(42, OpcUaStatus.Good, ts, ts)));
|
||||
|
||||
parent.ExpectNoMsg(TimeSpan.FromMilliseconds(400));
|
||||
parent.ExpectNoMsg(TimeSpan.FromMilliseconds(400), TestContext.Current.CancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -187,26 +187,26 @@ public sealed class DriverInstanceActorBatchForwardTests : RuntimeActorTestBase
|
||||
var driver = new BatchSubscribableStubDriver();
|
||||
var parent = CreateTestProbe();
|
||||
parent.IgnoreMessages(m => m is DriverInstanceActor.ConnectivityChanged);
|
||||
var actor = parent.ChildActorOf(DriverInstanceActor.Props(driver, reconnectInterval: TimeSpan.FromSeconds(30)));
|
||||
var actor = parent.ChildActorOf(DriverInstanceActor.Props(driver, reconnectInterval: TimeSpan.FromSeconds(30)), TestContext.Current.CancellationToken);
|
||||
|
||||
actor.Tell(new DriverInstanceActor.InitializeRequested("{}"));
|
||||
AwaitCondition(() => driver.InitializeCount > 0, PresenceBudget);
|
||||
AwaitCondition(() => driver.InitializeCount > 0, PresenceBudget, TestContext.Current.CancellationToken);
|
||||
|
||||
await actor.Ask<DriverInstanceActor.SubscriptionEstablished>(
|
||||
new DriverInstanceActor.Subscribe(new[] { "tag-a" }, TimeSpan.FromMilliseconds(100)),
|
||||
PresenceBudget);
|
||||
PresenceBudget, TestContext.Current.CancellationToken);
|
||||
driver.OnDataChangeBatchSubscriberCount.ShouldBe(1);
|
||||
|
||||
actor.Tell(new DriverInstanceActor.DisconnectObserved("backend went away"));
|
||||
|
||||
// Race window — once the disconnect is processed the handler is gone and a late burst is inert.
|
||||
AwaitCondition(() => driver.OnDataChangeBatchSubscriberCount == 0, PresenceBudget);
|
||||
AwaitCondition(() => driver.OnDataChangeBatchSubscriberCount == 0, PresenceBudget, TestContext.Current.CancellationToken);
|
||||
|
||||
var ts = new DateTime(2026, 8, 15, 13, 0, 0, DateTimeKind.Utc);
|
||||
driver.FireBatch(includePerTagRaises: true,
|
||||
new DataChangeItem("tag-a", new DataValueSnapshot(42, OpcUaStatus.Good, ts, ts)));
|
||||
|
||||
parent.ExpectNoMsg(TimeSpan.FromMilliseconds(300));
|
||||
parent.ExpectNoMsg(TimeSpan.FromMilliseconds(300), TestContext.Current.CancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -220,19 +220,19 @@ public sealed class DriverInstanceActorBatchForwardTests : RuntimeActorTestBase
|
||||
var driver = new BatchSubscribableStubDriver();
|
||||
var parent = CreateTestProbe();
|
||||
parent.IgnoreMessages(m => m is DriverInstanceActor.ConnectivityChanged);
|
||||
var actor = parent.ChildActorOf(DriverInstanceActor.Props(driver));
|
||||
var actor = parent.ChildActorOf(DriverInstanceActor.Props(driver), TestContext.Current.CancellationToken);
|
||||
|
||||
actor.Tell(new DriverInstanceActor.InitializeRequested("{}"));
|
||||
AwaitCondition(() => driver.InitializeCount > 0, PresenceBudget);
|
||||
AwaitCondition(() => driver.InitializeCount > 0, PresenceBudget, TestContext.Current.CancellationToken);
|
||||
|
||||
await actor.Ask<DriverInstanceActor.SubscriptionEstablished>(
|
||||
new DriverInstanceActor.Subscribe(new[] { "tag-a" }, TimeSpan.FromMilliseconds(100)),
|
||||
PresenceBudget);
|
||||
PresenceBudget, TestContext.Current.CancellationToken);
|
||||
driver.OnDataChangeBatchSubscriberCount.ShouldBe(1);
|
||||
|
||||
Sys.Stop(actor);
|
||||
|
||||
AwaitCondition(() => driver.OnDataChangeBatchSubscriberCount == 0, PresenceBudget);
|
||||
AwaitCondition(() => driver.OnDataChangeBatchSubscriberCount == 0, PresenceBudget, TestContext.Current.CancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -247,19 +247,19 @@ public sealed class DriverInstanceActorBatchForwardTests : RuntimeActorTestBase
|
||||
var driver = new BatchSubscribableStubDriver();
|
||||
var parent = CreateTestProbe();
|
||||
parent.IgnoreMessages(m => m is DriverInstanceActor.ConnectivityChanged);
|
||||
var actor = parent.ChildActorOf(DriverInstanceActor.Props(driver));
|
||||
var actor = parent.ChildActorOf(DriverInstanceActor.Props(driver), TestContext.Current.CancellationToken);
|
||||
|
||||
actor.Tell(new DriverInstanceActor.InitializeRequested("{}"));
|
||||
AwaitCondition(() => driver.InitializeCount > 0, PresenceBudget);
|
||||
AwaitCondition(() => driver.InitializeCount > 0, PresenceBudget, TestContext.Current.CancellationToken);
|
||||
|
||||
await actor.Ask<DriverInstanceActor.SubscriptionEstablished>(
|
||||
new DriverInstanceActor.Subscribe(new[] { "tag-a" }, TimeSpan.FromMilliseconds(100)),
|
||||
PresenceBudget);
|
||||
PresenceBudget, TestContext.Current.CancellationToken);
|
||||
|
||||
driver.FireBatch(includePerTagRaises: false /* no items — an empty burst */);
|
||||
driver.FireNullBatch();
|
||||
|
||||
parent.ExpectNoMsg(TimeSpan.FromMilliseconds(300));
|
||||
parent.ExpectNoMsg(TimeSpan.FromMilliseconds(300), TestContext.Current.CancellationToken);
|
||||
driver.OnDataChangeBatchSubscriberCount.ShouldBe(1,
|
||||
"a restart would have detached the handler in PostStop");
|
||||
|
||||
@@ -268,7 +268,7 @@ public sealed class DriverInstanceActorBatchForwardTests : RuntimeActorTestBase
|
||||
driver.FireBatch(includePerTagRaises: false,
|
||||
new DataChangeItem("tag-a", new DataValueSnapshot(5, OpcUaStatus.Good, ts, ts)));
|
||||
|
||||
var batch = parent.ExpectMsg<DriverInstanceActor.AttributeValueBatchPublished>(PresenceBudget);
|
||||
var batch = parent.ExpectMsg<DriverInstanceActor.AttributeValueBatchPublished>(PresenceBudget, cancellationToken: TestContext.Current.CancellationToken);
|
||||
batch.Items.Count.ShouldBe(1);
|
||||
batch.Items[0].FullReference.ShouldBe("tag-a");
|
||||
batch.Items[0].Value.ShouldBe(5);
|
||||
|
||||
Reference in New Issue
Block a user