test(mesh): pin the Dps no-ClusterClient guard; bound the channel-share test's blackhole worst case

This commit is contained in:
Joseph Doherty
2026-08-06 06:56:31 -04:00
parent 48dc2120c6
commit 86633f140e
2 changed files with 11 additions and 2 deletions
@@ -735,11 +735,12 @@ public class CentralCommunicationActorTests : ControlPlaneActorTestBase
var factory = NewInMemoryDbFactory();
SeedGrpcCluster(factory, "C1", ("host-a:4053", "host-a", 4056, true, false));
var psk = new RecordingPskProvider();
var clients = new RecordingClientFactory(() => CreateTestProbe());
Sys.ActorOf(CentralCommunicationActor.Props(
factory,
new MeshTransportOptions { Mode = mode, ContactRefreshSeconds = 60 },
new RecordingClientFactory(() => CreateTestProbe()),
clients,
() => null,
new RecordingDialer(),
psk));
@@ -748,6 +749,12 @@ public class CentralCommunicationActorTests : ControlPlaneActorTestBase
() => psk.KnownClusterPublications.Count >= 1, TimeSpan.FromSeconds(5));
psk.KnownClusterPublications[0].ShouldBe(new[] { "C1" });
psk.InvalidateAllCount.ShouldBeGreaterThanOrEqualTo(1);
// The one load-bearing line the publication itself cannot witness: with the refresh
// timer now running in every mode, only the ClusterClient branch may construct clients.
// With rows seeded, deleting the !_useClusterClient guard turns this red for Dps/Grpc.
if (mode != MeshTransportOptions.ModeClusterClient)
clients.Calls.ShouldBeEmpty();
}
[Fact]
@@ -198,7 +198,9 @@ public sealed class MeshGrpcCommandDialerTests
// ports on central long before anything else notices.
var dialer = new MeshGrpcCommandDialer(
new FakePskProvider(("SITE-A", "psk-site-a")),
Options.Create(new MeshTransportOptions { DispatchTimeoutSeconds = 5 }),
// 1 s, not 5: on a host that blackholes loopback instead of refusing, each dial costs
// the full deadline — keep the worst case bounded so this never reads as a hang.
Options.Create(new MeshTransportOptions { DispatchTimeoutSeconds = 1 }),
NullLogger<MeshGrpcCommandDialer>.Instance);
// Nothing is listening, so both dials fail — irrelevant here: the channel is constructed