public void A_member_must_detect_failure_even_though_no_heartbeats_have_been_received()
{
var firstAddress = GetAddress(_config.First);
var secondAddress = GetAddress(_config.Second);
AwaitClusterUp(_config.First);
RunOn(() =>
AwaitAssert(() =>
{
Cluster.SendCurrentClusterState(TestActor);
Assert.True(
ExpectMsg<ClusterEvent.CurrentClusterState>()
.Members.Select(m => m.Address)
.Contains(secondAddress));
}, TimeSpan.FromSeconds(20), TimeSpan.FromMilliseconds(50))
, _config.First);
RunOn(() =>
{
Cluster.Join(GetAddress(_config.First));
AwaitAssert(() =>
{
Cluster.SendCurrentClusterState(TestActor);
Assert.True(
ExpectMsg<ClusterEvent.CurrentClusterState>()
.Members.Select(m => m.Address)
.Contains(firstAddress));
}, TimeSpan.FromSeconds(20), TimeSpan.FromMilliseconds(50));
}, _config.Second);
//TODO: Seem to be able to pass barriers once other node fails?
EnterBarrier("second-joined");
return;
// It is likely that second has not started heartbeating to first yet,
// and when it does the messages doesn't go through and the first extra heartbeat is triggered.
// If the first heartbeat arrives, it will detect the failure anyway but not really exercise the
// part that we are trying to test here.
RunOn(
() =>
TestConductor.Blackhole(_config.First, _config.Second, ThrottleTransportAdapter.Direction.Both)
.Wait(), _config.Controller);
RunOn(
() => AwaitCondition(
() => !Cluster.FailureDetector.IsAvailable(GetAddress(_config.First))
, TimeSpan.FromSeconds(15))
, _config.Second);
EnterBarrier("after-1");
}
}