fix(communication): resolve Communication-009,010,011 — atomic site-cache refresh, XML doc correction, test coverage
This commit is contained in:
@@ -222,6 +222,35 @@ public class CentralCommunicationActorTests : TestKit
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MalformedSiteAddress_DoesNotAbortRefresh_OtherSitesStillRegistered()
|
||||
{
|
||||
// Regression test for Communication-009. HandleSiteAddressCacheLoaded calls
|
||||
// ActorPath.Parse for every site in a single loop. A malformed NodeAAddress
|
||||
// throws inside that loop; before the fix the whole refresh aborted partway
|
||||
// through, leaving the cache half-updated (some sites registered, others not).
|
||||
// The fix wraps the parse in a try/catch that logs and skips the bad site so
|
||||
// a single garbage row cannot starve every other site of its ClusterClient.
|
||||
var goodSite = CreateSite("good-site", "akka.tcp://scadalink@host1:8082");
|
||||
// A garbage address that ActorPath.Parse rejects.
|
||||
var badSite = CreateSite("bad-site", "this is not a valid actor path !!!");
|
||||
|
||||
// Order the bad site first so a non-resilient loop aborts before reaching good-site.
|
||||
var (actor, _, siteProbes) = CreateActorWithMockRepo(new[] { badSite, goodSite });
|
||||
|
||||
Thread.Sleep(1000);
|
||||
|
||||
// good-site must still be registered and routable despite bad-site failing to parse.
|
||||
var cmd = new DeployInstanceCommand(
|
||||
"dep1", "inst1", "hash1", "{}", "admin", DateTimeOffset.UtcNow);
|
||||
actor.Tell(new SiteEnvelope("good-site", cmd));
|
||||
|
||||
Assert.True(siteProbes.ContainsKey("good-site"),
|
||||
"good-site should have a ClusterClient even though bad-site's address is malformed");
|
||||
var msg = siteProbes["good-site"].ExpectMsg<ClusterClient.Send>();
|
||||
Assert.Equal("dep1", ((DeployInstanceCommand)msg.Message).DeploymentId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BothContactPoints_UsedInSingleClient()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user