예제 #1
0
    def test_baseline_autoadjust(self, ignite_version):
        """
        Test activate and deactivate cluster.
        """
        blt_size = self.NUM_NODES - 2
        servers = self.__start_ignite_nodes(ignite_version, blt_size)

        control_utility = ControlUtility(servers)
        control_utility.activate()

        # Add node.
        control_utility.enable_baseline_auto_adjust(2000)
        new_node = self.__start_ignite_nodes(ignite_version,
                                             1,
                                             join_cluster=servers)
        blt_size += 1

        wait_until(lambda: len(control_utility.baseline()) == blt_size,
                   timeout_sec=5)

        baseline = control_utility.baseline()
        self.__check_nodes_in_baseline(new_node.nodes, baseline)

        # Add node when auto adjust disabled.
        control_utility.disable_baseline_auto_adjust()
        old_topology = control_utility.cluster_state().topology_version
        new_node = self.__start_ignite_nodes(ignite_version,
                                             1,
                                             join_cluster=servers)

        wait_until(lambda: control_utility.cluster_state().topology_version !=
                   old_topology,
                   timeout_sec=5)
        baseline = control_utility.baseline()
        self.__check_nodes_not_in_baseline(new_node.nodes, baseline)
예제 #2
0
    def test_baseline_set(self, ignite_version):
        """
        Test baseline set.
        """
        blt_size = self.NUM_NODES - 2
        servers = self.__start_ignite_nodes(ignite_version, blt_size)

        control_utility = ControlUtility(servers)
        control_utility.activate()

        # Check baseline of activated cluster.
        baseline = control_utility.baseline()
        self.__check_baseline_size(baseline, blt_size)
        self.__check_nodes_in_baseline(servers.nodes, baseline)

        # Set baseline using list of consisttent ids.
        new_node = self.__start_ignite_nodes(ignite_version, 1, join_cluster=servers)
        control_utility.set_baseline(servers.nodes + new_node.nodes)
        blt_size += 1

        baseline = control_utility.baseline()
        self.__check_baseline_size(baseline, blt_size)
        self.__check_nodes_in_baseline(new_node.nodes, baseline)

        # Set baseline using topology version.
        new_node = self.__start_ignite_nodes(ignite_version, 1, join_cluster=servers)
        _, version, _ = control_utility.cluster_state()
        control_utility.set_baseline(version)
        blt_size += 1

        baseline = control_utility.baseline()
        self.__check_baseline_size(baseline, blt_size)
        self.__check_nodes_in_baseline(new_node.nodes, baseline)
예제 #3
0
    def test_baseline_add_remove(self, ignite_version):
        """
        Test add and remove nodes from baseline.
        """
        blt_size = self.NUM_NODES - 1
        servers = self.__start_ignite_nodes(ignite_version, blt_size)

        control_utility = ControlUtility(servers)

        control_utility.activate()

        # Add node to baseline.
        new_node = self.__start_ignite_nodes(ignite_version,
                                             1,
                                             join_cluster=servers)
        control_utility.add_to_baseline(new_node.nodes)
        blt_size += 1

        baseline = control_utility.baseline()
        self.__check_baseline_size(baseline, blt_size)
        self.__check_nodes_in_baseline(new_node.nodes, baseline)

        # Expected failure (remove of online node is not allowed).
        try:
            control_utility.remove_from_baseline(new_node.nodes)

            assert False, "Remove of online node from baseline should fail!"
        except ControlUtilityError:
            pass

        # Remove of offline node from baseline.
        new_node.stop()

        servers.await_event("Node left topology",
                            timeout_sec=30,
                            from_the_beginning=True)

        control_utility.remove_from_baseline(new_node.nodes)
        blt_size -= 1

        baseline = control_utility.baseline()
        self.__check_baseline_size(baseline, blt_size)
        self.__check_nodes_not_in_baseline(new_node.nodes, baseline)