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:
+14
-14
@@ -1,6 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
using Akka.Actor;
|
||||
using Akka.TestKit.Xunit2;
|
||||
using Akka.TestKit.Xunit;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using Shouldly;
|
||||
@@ -70,14 +70,14 @@ public sealed class TelemetryDialSupervisorTests : TestKit
|
||||
actor.Tell(new TelemetryDialSupervisor.RefreshNodes());
|
||||
|
||||
// node-1's dialer is cancelled and dropped.
|
||||
AwaitCondition(() => node1.Ct.IsCancellationRequested, Timeout, PollInterval);
|
||||
AwaitCondition(() => node1.Ct.IsCancellationRequested, Timeout, PollInterval, cancellationToken: TestContext.Current.CancellationToken);
|
||||
// node-3 gets a fresh dialer.
|
||||
var invocations = dial.WaitForCount(3, Timeout);
|
||||
invocations.ShouldContain(i => i.Target.NodeId == "node-3" && i.CorrelationId == "central-node-3-1");
|
||||
|
||||
// node-2 is present in BOTH refreshes with an unchanged endpoint: it must NOT be restarted, or
|
||||
// its live stream would be dropped on every refresh. Exactly one dial invocation for it.
|
||||
ExpectNoMsg(TimeSpan.FromMilliseconds(200));
|
||||
ExpectNoMsg(TimeSpan.FromMilliseconds(200), TestContext.Current.CancellationToken);
|
||||
dial.Invocations.Count(i => i.Target.NodeId == "node-2").ShouldBe(1);
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public sealed class TelemetryDialSupervisorTests : TestKit
|
||||
actor.Tell(new TelemetryDialSupervisor.RefreshNodes());
|
||||
|
||||
// The old node-1 stream is torn down and a fresh dialer opens at the NEW endpoint (gen 2).
|
||||
AwaitCondition(() => node1Original.Ct.IsCancellationRequested, Timeout, PollInterval);
|
||||
AwaitCondition(() => node1Original.Ct.IsCancellationRequested, Timeout, PollInterval, cancellationToken: TestContext.Current.CancellationToken);
|
||||
var invocations = dial.WaitForCount(3, Timeout);
|
||||
invocations.ShouldContain(i =>
|
||||
i.Target.NodeId == "node-1"
|
||||
@@ -110,7 +110,7 @@ public sealed class TelemetryDialSupervisorTests : TestKit
|
||||
&& i.CorrelationId == "central-node-1-2");
|
||||
|
||||
// node-2's endpoint did not change → still exactly one dial invocation (no churn).
|
||||
ExpectNoMsg(TimeSpan.FromMilliseconds(200));
|
||||
ExpectNoMsg(TimeSpan.FromMilliseconds(200), TestContext.Current.CancellationToken);
|
||||
dial.Invocations.Count(i => i.Target.NodeId == "node-2").ShouldBe(1);
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ public sealed class TelemetryDialSupervisorTests : TestKit
|
||||
sinks.Health.ShouldHaveSingleItem().DriverInstanceId.ShouldBe("d1");
|
||||
sinks.Resilience.ShouldHaveSingleItem().DriverInstanceId.ShouldBe("d1");
|
||||
},
|
||||
Timeout);
|
||||
Timeout, cancellationToken: TestContext.Current.CancellationToken);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -173,7 +173,7 @@ public sealed class TelemetryDialSupervisorTests : TestKit
|
||||
first.OnMapped(Alarm("stale"));
|
||||
|
||||
// Give the message a chance to be (wrongly) routed, then assert it was not.
|
||||
ExpectNoMsg(TimeSpan.FromMilliseconds(300));
|
||||
ExpectNoMsg(TimeSpan.FromMilliseconds(300), TestContext.Current.CancellationToken);
|
||||
sinks.Alarms.ShouldBeEmpty();
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ public sealed class TelemetryDialSupervisorTests : TestKit
|
||||
// A duplicate/late failure from gen-1 must be ignored (no third dial).
|
||||
first.OnError(new InvalidOperationException("late duplicate"));
|
||||
|
||||
ExpectNoMsg(TimeSpan.FromMilliseconds(400));
|
||||
ExpectNoMsg(TimeSpan.FromMilliseconds(400), TestContext.Current.CancellationToken);
|
||||
dial.Invocations.Count.ShouldBe(2);
|
||||
}
|
||||
|
||||
@@ -215,23 +215,23 @@ public sealed class TelemetryDialSupervisorTests : TestKit
|
||||
|
||||
// First node connects → both broadcasters flip to connected.
|
||||
node1.OnMapped(Alarm("a1"));
|
||||
AwaitAssert(() => sinks.PillStates.ToArray().ShouldBe(new[] { true }), Timeout);
|
||||
AwaitAssert(() => sinks.PillStates.ToArray().ShouldBe(new[] { true }), Timeout, cancellationToken: TestContext.Current.CancellationToken);
|
||||
|
||||
// Second node connects → still connected, no extra transition.
|
||||
node2.OnMapped(Alarm("a2"));
|
||||
ExpectNoMsg(TimeSpan.FromMilliseconds(200));
|
||||
ExpectNoMsg(TimeSpan.FromMilliseconds(200), TestContext.Current.CancellationToken);
|
||||
sinks.PillStates.ToArray().ShouldBe(new[] { true });
|
||||
|
||||
// node-1 drops but node-2 is still up → pill stays true.
|
||||
node1.OnError(new InvalidOperationException("down"));
|
||||
node1.Complete();
|
||||
ExpectNoMsg(TimeSpan.FromMilliseconds(200));
|
||||
ExpectNoMsg(TimeSpan.FromMilliseconds(200), TestContext.Current.CancellationToken);
|
||||
sinks.PillStates.ToArray().ShouldBe(new[] { true });
|
||||
|
||||
// node-2 drops too → all down → pill flips false.
|
||||
node2.OnError(new InvalidOperationException("down"));
|
||||
node2.Complete();
|
||||
AwaitAssert(() => sinks.PillStates.ToArray().ShouldBe(new[] { true, false }), Timeout);
|
||||
AwaitAssert(() => sinks.PillStates.ToArray().ShouldBe(new[] { true, false }), Timeout, cancellationToken: TestContext.Current.CancellationToken);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -250,7 +250,7 @@ public sealed class TelemetryDialSupervisorTests : TestKit
|
||||
|
||||
Sys.Stop(actor);
|
||||
|
||||
AwaitCondition(() => inv.All(i => i.Ct.IsCancellationRequested), Timeout, PollInterval);
|
||||
AwaitCondition(() => inv.All(i => i.Ct.IsCancellationRequested), Timeout, PollInterval, cancellationToken: TestContext.Current.CancellationToken);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -264,7 +264,7 @@ public sealed class TelemetryDialSupervisorTests : TestKit
|
||||
Node("null-port", "h2", grpcPort: null, enabled: true, maintenance: false),
|
||||
Node("maintenance", "h3", grpcPort: 5300, enabled: true, maintenance: true),
|
||||
Node("disabled", "h4", grpcPort: 5300, enabled: false, maintenance: false));
|
||||
await db.SaveChangesAsync();
|
||||
await db.SaveChangesAsync(TestContext.Current.CancellationToken);
|
||||
}
|
||||
|
||||
var source = TelemetryNodeSource.Create(factory, NullLogger.Instance);
|
||||
|
||||
Reference in New Issue
Block a user