Exemple #1
0
        public void KeepMajority_must_parse_settings_from_config()
        {
            var config   = ConfigurationFactory.ParseString(@"
                role = test-role");
            var strategy = new KeepMajority(config);

            strategy.Role.Should().Be("test-role");
        }
Exemple #2
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);
        }
Exemple #3
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);
        }
Exemple #4
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);
        }
Exemple #5
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);
        }