public void ClusterSharding_with_leaving_member_should_recover_after_leaving_coordinator_node()
{
ClusterSharding_with_leaving_member_should_initialize_shards();
Within(TimeSpan.FromSeconds(30), () =>
{
RunOn(() =>
{
Cluster.Leave(Node(_first).Address);
}, _third);
RunOn(() =>
{
var region = _region.Value;
Watch(region);
ExpectTerminated(region, TimeSpan.FromSeconds(15));
}, _first);
EnterBarrier("stopped");
RunOn(() =>
{
Sys.ActorSelection(Node(_first) / "user" / "sharedLocations").Tell(GetLocations.Instance);
var locations = ExpectMsg<Locations>();
var firstAddress = Node(_first).Address;
AwaitAssert(() =>
{
var region = _region.Value;
var probe = CreateTestProbe();
foreach (var kv in locations.LocationMap)
{
var id = kv.Key;
var r = kv.Value;
region.Tell(new Ping(id), probe.Ref);
if (r.Path.Address.Equals(firstAddress))
{
Assert.NotEqual(r, probe.ExpectMsg<IActorRef>(TimeSpan.FromSeconds(1)));
}
else
{
probe.ExpectMsg(r, TimeSpan.FromSeconds(1)); // should not move
}
}
});
}, _second, _third, _fourth);
EnterBarrier("after-4");
});
}
}