test: migrate AdminUI/ControlPlane/Runtime/Host tests to xunit.v3 (#756)
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:
Joseph Doherty
2026-11-10 08:57:33 -05:00
parent 2a8e2981fe
commit b211911f98
191 changed files with 2161 additions and 2166 deletions
@@ -58,7 +58,7 @@ public sealed class DriverHostActorHistorizationRoleViewTests : RuntimeActorTest
SpawnHost(view, sharesScopeWith: MeshPeer).Tell(Snapshot(
(TestNode, RedundancyRole.Secondary), (MeshPeer, RedundancyRole.Primary)));
AwaitAssert(() => view.Published.ShouldBe([false]), duration: Timeout);
AwaitAssert(() => view.Published.ShouldBe([false]), duration: Timeout, cancellationToken: TestContext.Current.CancellationToken);
}
/// <summary>
@@ -76,7 +76,7 @@ public sealed class DriverHostActorHistorizationRoleViewTests : RuntimeActorTest
SpawnHost(view, sharesScopeWith: MeshPeer).Tell(Snapshot(
(TestNode, RedundancyRole.Secondary), (ForeignNode, RedundancyRole.Primary)));
AwaitAssert(() => view.Published.ShouldBe([true]), duration: Timeout);
AwaitAssert(() => view.Published.ShouldBe([true]), duration: Timeout, cancellationToken: TestContext.Current.CancellationToken);
}
/// <summary>
@@ -95,7 +95,7 @@ public sealed class DriverHostActorHistorizationRoleViewTests : RuntimeActorTest
SpawnHost(view, sharesScopeWith: null).Tell(Snapshot(
(TestNode, RedundancyRole.Secondary), (MeshPeer, RedundancyRole.Primary)));
AwaitAssert(() => view.Published.ShouldBe([true]), duration: Timeout);
AwaitAssert(() => view.Published.ShouldBe([true]), duration: Timeout, cancellationToken: TestContext.Current.CancellationToken);
}
/// <summary>Primary captures.</summary>
@@ -108,7 +108,7 @@ public sealed class DriverHostActorHistorizationRoleViewTests : RuntimeActorTest
// Published, not current — `true` is also the seed, so asserting the property would pass before
// the actor had processed anything.
AwaitAssert(() => view.Published.ShouldBe([true]), duration: Timeout);
AwaitAssert(() => view.Published.ShouldBe([true]), duration: Timeout, cancellationToken: TestContext.Current.CancellationToken);
}
/// <summary>
@@ -122,7 +122,7 @@ public sealed class DriverHostActorHistorizationRoleViewTests : RuntimeActorTest
SpawnHost(view, sharesScopeWith: MeshPeer).Tell(Snapshot(
(MeshPeer, RedundancyRole.Primary), (ForeignNode, RedundancyRole.Secondary)));
AwaitAssert(() => view.Published.ShouldBe([true]), duration: Timeout);
AwaitAssert(() => view.Published.ShouldBe([true]), duration: Timeout, cancellationToken: TestContext.Current.CancellationToken);
}
/// <summary>A promotion must MOVE the view, not merely leave it at its open seed.</summary>
@@ -133,10 +133,10 @@ public sealed class DriverHostActorHistorizationRoleViewTests : RuntimeActorTest
IActorRef host = SpawnHost(view, sharesScopeWith: MeshPeer);
host.Tell(Snapshot((TestNode, RedundancyRole.Secondary), (MeshPeer, RedundancyRole.Primary)));
AwaitAssert(() => view.Published.ShouldBe([false]), duration: Timeout);
AwaitAssert(() => view.Published.ShouldBe([false]), duration: Timeout, cancellationToken: TestContext.Current.CancellationToken);
host.Tell(Snapshot((TestNode, RedundancyRole.Primary), (MeshPeer, RedundancyRole.Secondary)));
AwaitAssert(() => view.Published.ShouldBe([false, true]), duration: Timeout);
AwaitAssert(() => view.Published.ShouldBe([false, true]), duration: Timeout, cancellationToken: TestContext.Current.CancellationToken);
}
// ---------------- Gitea #672: an unreachable recording Primary ----------------
@@ -168,15 +168,15 @@ public sealed class DriverHostActorHistorizationRoleViewTests : RuntimeActorTest
IActorRef host = SpawnHost672(hist, others, captureWhilePrimaryUnreachable: true);
host.Tell(Snapshot((Self672, RedundancyRole.Secondary), (Peer672, RedundancyRole.Primary)));
AwaitAssert(() => hist.Published.ShouldBe([false]), duration: Timeout);
AwaitAssert(() => others.Drained.ShouldNotBeEmpty(), duration: Timeout);
AwaitAssert(() => hist.Published.ShouldBe([false]), duration: Timeout, cancellationToken: TestContext.Current.CancellationToken);
AwaitAssert(() => others.Drained.ShouldNotBeEmpty(), duration: Timeout, cancellationToken: TestContext.Current.CancellationToken);
var drainedBefore = others.Drained;
var primaryBefore = others.Primary;
drainedBefore[^1].ShouldBeFalse(); // queue-sharing mesh peer is Primary ⇒ drain stands down
primaryBefore[^1].ShouldBeFalse(); // Secondary ⇒ not the data-plane Primary
host.Tell(new ClusterEvent.UnreachableMember(MemberAt(Peer672)));
AwaitAssert(() => hist.Published.ShouldBe([false, true]), duration: Timeout);
AwaitAssert(() => hist.Published.ShouldBe([false, true]), duration: Timeout, cancellationToken: TestContext.Current.CancellationToken);
// Same handler run that published `true` above — anything it published elsewhere is already recorded.
others.Drained.ShouldBe(drainedBefore);
@@ -185,7 +185,7 @@ public sealed class DriverHostActorHistorizationRoleViewTests : RuntimeActorTest
others.Current.ShouldActAsPrimary.ShouldBeFalse();
host.Tell(new ClusterEvent.ReachableMember(MemberAt(Peer672)));
AwaitAssert(() => hist.Published.ShouldBe([false, true, false]), duration: Timeout);
AwaitAssert(() => hist.Published.ShouldBe([false, true, false]), duration: Timeout, cancellationToken: TestContext.Current.CancellationToken);
others.Drained.ShouldBe(drainedBefore);
others.Primary.ShouldBe(primaryBefore);
}
@@ -200,13 +200,13 @@ public sealed class DriverHostActorHistorizationRoleViewTests : RuntimeActorTest
// Both a foreign-cluster Primary (never stood down for) and the mesh Primary (stood down for).
host.Tell(Snapshot(
(Self672, RedundancyRole.Secondary), (Peer672, RedundancyRole.Primary), (Foreign672, RedundancyRole.Primary)));
AwaitAssert(() => hist.Published.ShouldBe([false]), duration: Timeout);
AwaitAssert(() => hist.Published.ShouldBe([false]), duration: Timeout, cancellationToken: TestContext.Current.CancellationToken);
host.Tell(new ClusterEvent.UnreachableMember(MemberAt(Foreign672)));
// Positive control: the mesh peer's loss, sent AFTER, must be the only change — had the foreign
// one published anything it would sit between the two.
host.Tell(new ClusterEvent.UnreachableMember(MemberAt(Peer672)));
AwaitAssert(() => hist.Published.ShouldBe([false, true]), duration: Timeout);
AwaitAssert(() => hist.Published.ShouldBe([false, true]), duration: Timeout, cancellationToken: TestContext.Current.CancellationToken);
}
/// <summary>This node's own reachability (as gossiped by others) is not a peer question.</summary>
@@ -217,18 +217,18 @@ public sealed class DriverHostActorHistorizationRoleViewTests : RuntimeActorTest
IActorRef host = SpawnHost672(hist, others: null, captureWhilePrimaryUnreachable: true);
host.Tell(Snapshot((Self672, RedundancyRole.Secondary), (Peer672, RedundancyRole.Primary)));
AwaitAssert(() => hist.Published.ShouldBe([false]), duration: Timeout);
AwaitAssert(() => hist.Published.ShouldBe([false]), duration: Timeout, cancellationToken: TestContext.Current.CancellationToken);
host.Tell(new ClusterEvent.UnreachableMember(MemberAt(Self672)));
host.Tell(new ClusterEvent.UnreachableMember(MemberAt(Peer672)));
AwaitAssert(() => hist.Published.ShouldBe([false, true]), duration: Timeout);
AwaitAssert(() => hist.Published.ShouldBe([false, true]), duration: Timeout, cancellationToken: TestContext.Current.CancellationToken);
// Self "returning" is ignored too, and it does not close what the peer's loss opened. Events are
// processed in order, so the peer's return (which MUST close the gate) is the only thing that may
// appear next: had the self event published anything it would sit between `true` and `false`.
host.Tell(new ClusterEvent.ReachableMember(MemberAt(Self672)));
host.Tell(new ClusterEvent.ReachableMember(MemberAt(Peer672)));
AwaitAssert(() => hist.Published.ShouldBe([false, true, false]), duration: Timeout);
AwaitAssert(() => hist.Published.ShouldBe([false, true, false]), duration: Timeout, cancellationToken: TestContext.Current.CancellationToken);
}
/// <summary>
@@ -246,7 +246,7 @@ public sealed class DriverHostActorHistorizationRoleViewTests : RuntimeActorTest
host.Tell(Snapshot((Self672, RedundancyRole.Secondary), (Peer672, RedundancyRole.Primary)));
// Exactly one publication, and it is `true`: no spurious `false` from treating the peer as reachable.
AwaitAssert(() => hist.Published.ShouldBe([true]), duration: Timeout);
AwaitAssert(() => hist.Published.ShouldBe([true]), duration: Timeout, cancellationToken: TestContext.Current.CancellationToken);
}
/// <summary><c>CaptureWhilePrimaryUnreachable = false</c> restores the pre-#672 behaviour.</summary>
@@ -257,13 +257,13 @@ public sealed class DriverHostActorHistorizationRoleViewTests : RuntimeActorTest
IActorRef host = SpawnHost672(hist, others: null, captureWhilePrimaryUnreachable: false);
host.Tell(Snapshot((Self672, RedundancyRole.Secondary), (Peer672, RedundancyRole.Primary)));
AwaitAssert(() => hist.Published.ShouldBe([false]), duration: Timeout);
AwaitAssert(() => hist.Published.ShouldBe([false]), duration: Timeout, cancellationToken: TestContext.Current.CancellationToken);
host.Tell(new ClusterEvent.UnreachableMember(MemberAt(Peer672)));
// Positive control: a re-sent snapshot publishes on every arrival, so a `true` from the
// reachability event would show up between the two `false`s.
host.Tell(Snapshot((Self672, RedundancyRole.Secondary), (Peer672, RedundancyRole.Primary)));
AwaitAssert(() => hist.Published.ShouldBe([false, false]), duration: Timeout);
AwaitAssert(() => hist.Published.ShouldBe([false, false]), duration: Timeout, cancellationToken: TestContext.Current.CancellationToken);
}
/// <summary>
@@ -277,14 +277,14 @@ public sealed class DriverHostActorHistorizationRoleViewTests : RuntimeActorTest
IActorRef host = SpawnHost672(hist, others: null, captureWhilePrimaryUnreachable: true);
host.Tell(Snapshot((Self672, RedundancyRole.Secondary), (Peer672, RedundancyRole.Primary)));
AwaitAssert(() => hist.Published.ShouldBe([false]), duration: Timeout);
AwaitAssert(() => hist.Published.ShouldBe([false]), duration: Timeout, cancellationToken: TestContext.Current.CancellationToken);
host.Tell(new ClusterEvent.UnreachableMember(MemberAt(Peer672)));
AwaitAssert(() => hist.Published.ShouldBe([false, true]), duration: Timeout);
AwaitAssert(() => hist.Published.ShouldBe([false, true]), duration: Timeout, cancellationToken: TestContext.Current.CancellationToken);
host.Tell(new ClusterEvent.MemberRemoved(MemberAt(Peer672, MemberStatus.Removed), MemberStatus.Down));
host.Tell(Snapshot((Self672, RedundancyRole.Primary)));
AwaitAssert(() => hist.Published.ShouldBe([false, true, true]), duration: Timeout);
AwaitAssert(() => hist.Published.ShouldBe([false, true, true]), duration: Timeout, cancellationToken: TestContext.Current.CancellationToken);
}
/// <summary>A re-joined incarnation at the dead peer's address is reachable again.</summary>
@@ -296,10 +296,10 @@ public sealed class DriverHostActorHistorizationRoleViewTests : RuntimeActorTest
host.Tell(Snapshot((Self672, RedundancyRole.Secondary), (Peer672, RedundancyRole.Primary)));
host.Tell(new ClusterEvent.UnreachableMember(MemberAt(Peer672)));
AwaitAssert(() => hist.Published.ShouldBe([false, true]), duration: Timeout);
AwaitAssert(() => hist.Published.ShouldBe([false, true]), duration: Timeout, cancellationToken: TestContext.Current.CancellationToken);
host.Tell(new ClusterEvent.MemberUp(MemberAt(Peer672)));
AwaitAssert(() => hist.Published.ShouldBe([false, true, false]), duration: Timeout);
AwaitAssert(() => hist.Published.ShouldBe([false, true, false]), duration: Timeout, cancellationToken: TestContext.Current.CancellationToken);
}
/// <summary>
@@ -326,7 +326,7 @@ public sealed class DriverHostActorHistorizationRoleViewTests : RuntimeActorTest
var clusterB = Akka.Cluster.Cluster.Get(sysB);
AwaitCondition(
() => clusterB.State.Members.Count(m => m.Status == MemberStatus.Up) == 2,
TimeSpan.FromSeconds(30));
TimeSpan.FromSeconds(30), TestContext.Current.CancellationToken);
var nodeA = NodeId.Parse($"127.0.0.1:{portA}");
var nodeB = NodeId.Parse($"127.0.0.1:{portB}");
@@ -340,11 +340,11 @@ public sealed class DriverHostActorHistorizationRoleViewTests : RuntimeActorTest
sharesHistorizationScopeWithLocal: node => node == nodeA));
host.Tell(Snapshot((nodeB, RedundancyRole.Secondary), (nodeA, RedundancyRole.Primary)));
AwaitAssert(() => hist.Published.ShouldBe([false]), duration: Timeout);
AwaitAssert(() => hist.Published.ShouldBe([false]), duration: Timeout, cancellationToken: TestContext.Current.CancellationToken);
await sysA.Terminate();
AwaitAssert(() => hist.Published.ShouldBe([false, true]), duration: TimeSpan.FromSeconds(30));
AwaitAssert(() => hist.Published.ShouldBe([false, true]), duration: TimeSpan.FromSeconds(30), cancellationToken: TestContext.Current.CancellationToken);
// Still a member: the gate opened on reachability, not on a removal + fresh snapshot.
clusterB.State.Members.ShouldContain(m => m.Address.Port == portA);
clusterB.State.Unreachable.ShouldContain(m => m.Address.Port == portA);