public void Leaving_ClusterSingletonManager_should_handover_to_new_instance()
{
Join(_first, _first);
RunOn(() =>
{
}, _first);
EnterBarrier("first-active");
Join(_second, _first);
Join(_third, _first);
Within(TimeSpan.FromSeconds(10), () =>
{
AwaitAssert(() => Assert.Equal(3, Cluster.ReadView.State.Members.Count(m => m.Status == MemberStatus.Up)));
});
EnterBarrier("all-up");
RunOn(() =>
{
Cluster.Leave(Node(_first).Address);
}, _second);
RunOn(() =>
{
ExpectMsg("stopped", TimeSpan.FromSeconds(10));
}, _first);
EnterBarrier("first-stopped");
RunOn(() =>
{
var p = CreateTestProbe();
var firstAddress = Node(_first).Address;
p.Within(TimeSpan.FromSeconds(10), () =>
{
p.AwaitAssert(() =>
{
_echoProxy.Value.Tell("hello2", p.Ref);
Assert.NotEqual(firstAddress, p.ExpectMsg<IActorRef>(TimeSpan.FromSeconds(1)).Path.Address);
});
});
}, _second, _third);
EnterBarrier("handover-done");
}
}