示例#1
0
        public void KeepMajority_must_down_remaining_nodes_if_unreachable_nodes_have_majority()
        {
            var unreachable = Members(Member(e), Member(d), Member(c));
            var remaining   = Members(Member(a), Member(b));

            var strategy = new KeepMajority();

            strategy.Apply(new NetworkPartitionContext(unreachable, remaining)).Should().Equal(remaining);
        }
示例#2
0
        public void KeepMajority_must_keep_the_part_with_the_lowest_nodes_address_in_case_of_equal_size()
        {
            var unreachable = Members(Member(e), Member(d));
            var remaining   = Members(Member(a), Member(b)); // `a` is the lowest address

            var strategy = new KeepMajority();

            strategy.Apply(new NetworkPartitionContext(unreachable, remaining)).Should().Equal(unreachable);
        }
示例#3
0
        public void KeepMajority_must_keep_the_part_with_the_lowest_nodes_address_in_case_of_equal_size_role_based()
        {
            const string role        = "test";
            var          unreachable = Members(Member(e, role: role), Member(d, role: role));
            var          remaining   = Members(Member(a, role: role), Member(b, role: role), Member(c)); // `a` is the lowest address

            var strategy = new KeepMajority(role);

            strategy.Apply(new NetworkPartitionContext(unreachable, remaining)).Should().Equal(unreachable);
        }
示例#4
0
        public void KeepMajority_must_down_remaining_nodes_if_unreachable_nodes_have_majority_role_based()
        {
            const string role        = "test";
            var          unreachable = Members(Member(e, role: role), Member(d, role: role));
            var          remaining   = Members(Member(a, role: role), Member(b), Member(c));

            var strategy = new KeepMajority(role);

            strategy.Apply(new NetworkPartitionContext(unreachable, remaining)).Should().Equal(remaining);
        }