public void Cluster_seed_nodes__must_be_able_to_restart_first_seed_node_and_join_other_seed_nodes()
{
Within(TimeSpan.FromSeconds(40), () =>
{
RunOn(() =>
{
Sys.ActorOf(Props.Create(() => new Listener())
.WithDeploy(Deploy.Local), "address-receiver");
EnterBarrier("seed1-address-receiver-ready");
}, _config.Seed2, _config.Seed3);
RunOn(() =>
{
EnterBarrier("seed1-address-receiver-ready");
_seedNode1Address = Cluster.Get(seed1System.Value).SelfAddress;
foreach (var r in new List<RoleName> { _config.Seed2, _config.Seed3 })
{
Sys.ActorSelection(new RootActorPath(GetAddress(r)) / "user" / "address-receiver").Tell(_seedNode1Address);
ExpectMsg("ok", TimeSpan.FromSeconds(5));
}
}, _config.Seed1);
EnterBarrier("seed1-address-transfered");
// now we can join seed1System, seed2, seed3 together
RunOn(() =>
{
Cluster.Get(seed1System.Value).JoinSeedNodes(GetSeedNodes());
AwaitAssert(() =>
{
Cluster.Get(seed1System.Value)
.ReadView.Members.Count
.Should()
.Be(3);
}, TimeSpan.FromSeconds(10));
AwaitAssert(() =>
{
Cluster.Get(seed1System.Value)
.ReadView.Members.All(c => c.Status == MemberStatus.Up)
.Should()
.BeTrue();
});
}, _config.Seed1);
RunOn(() =>
{
Cluster.JoinSeedNodes(GetSeedNodes());
AwaitMembersUp(3);
}, _config.Seed2, _config.Seed3);
EnterBarrier("started");
// shutdown seed1System
RunOn(() =>
{
Shutdown(seed1System.Value, RemainingOrDefault);
}, _config.Seed1);
EnterBarrier("seed1-shutdown");
RunOn(() =>
{
Cluster.Get(restartedSeed1System.Value).JoinSeedNodes(GetSeedNodes());
Within(TimeSpan.FromSeconds(20), () =>
{
AwaitAssert(() =>
{
Cluster.Get(restartedSeed1System.Value)
.ReadView.Members.Count
.Should()
.Be(3);
});
AwaitAssert(() =>
{
Cluster.Get(restartedSeed1System.Value)
.ReadView.Members.All(c => c.Status == MemberStatus.Up)
.Should()
.BeTrue();
});
});
}, _config.Seed1);
RunOn(() =>
{
AwaitMembersUp(3);
}, _config.Seed2, _config.Seed3);
EnterBarrier("seed1-restarted");
});
}