public void KeepOldest_when_downIfAlone_must_keep_oldest_up_if_is_reachable_and_only_node_in_cluster() { var unreachable = Members(); var remaining = Members(Member(a, upNumber: 1)); var strategy = new KeepOldest(downIfAlone: true); strategy.Apply(new NetworkPartitionContext(unreachable, remaining)).Should().Equal(unreachable); }
public void KeepOldest_when_downIfAlone_must_down_oldest_if_it_was_the_only_remaining_node() { var unreachable = Members(Member(e, upNumber: 2), Member(b, upNumber: 3), Member(c, upNumber: 4)); var remaining = Members(Member(a, upNumber: 1)); var strategy = new KeepOldest(downIfAlone: true); strategy.Apply(new NetworkPartitionContext(unreachable, remaining)).Should().Equal(remaining); }
public void KeepOldest_must_down_unreachable_nodes_if_oldest_was_found_in_remaining() { var unreachable = Members(Member(e, upNumber: 2), Member(d, upNumber: 5)); var remaining = Members(Member(a, upNumber: 1), Member(b, upNumber: 3), Member(c, upNumber: 4)); var strategy = new KeepOldest(downIfAlone: false); strategy.Apply(new NetworkPartitionContext(unreachable, remaining)).Should().Equal(unreachable); }
public void KeepOldest_must_down_remaining_if_oldest_was_unreachable_role_based() { const string role = "test"; var unreachable = Members(Member(e, upNumber: 2, role: role), Member(d, upNumber: 5)); var remaining = Members(Member(a, upNumber: 1), Member(b, upNumber: 3, role: role), Member(c, upNumber: 4, role: role)); var strategy = new KeepOldest(downIfAlone: false, role: role); strategy.Apply(new NetworkPartitionContext(unreachable, remaining)).Should().Equal(remaining); }