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)
def check_authenticate(servers, username: str, password: str, exception_expected: bool = False): """ Check if user can run control.sh command """ control_utility = ControlUtility(cluster=servers, username=username, password=password) if exception_expected: try: control_utility.cluster_state() raise Exception("Something went wrong.") except ControlUtilityError: pass else: control_utility.cluster_state()
def check_topology(control_utility: ControlUtility, fin_top_ver: int): """ Check current topology version. """ top_ver = control_utility.cluster_state().topology_version assert top_ver == fin_top_ver, f'Cluster current topology version={top_ver}, ' \ f'expected topology version={fin_top_ver}.'
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)
def test_ssl_connection(self, ignite_version): """ Test that IgniteService, IgniteApplicationService correctly start and stop with ssl configurations. And check ControlUtility with ssl arguments. """ shared_root = get_shared_root_path(self.test_context.globals) server_ssl = SslParams(shared_root, key_store_jks=DEFAULT_SERVER_KEYSTORE) server_configuration = IgniteConfiguration( version=IgniteVersion(ignite_version), ssl_params=server_ssl, connector_configuration=ConnectorConfiguration( ssl_enabled=True, ssl_params=server_ssl)) ignite = IgniteService(self.test_context, server_configuration, num_nodes=2, startup_timeout_sec=180) client_configuration = server_configuration._replace( client_mode=True, ssl_params=SslParams(shared_root, key_store_jks=DEFAULT_CLIENT_KEYSTORE), connector_configuration=None) app = IgniteApplicationService( self.test_context, client_configuration, java_class_name= "org.apache.ignite.internal.ducktest.tests.smoke_test.SimpleApplication", startup_timeout_sec=180) admin_ssl = SslParams(shared_root, key_store_jks=DEFAULT_ADMIN_KEYSTORE) control_utility = ControlUtility(cluster=ignite, ssl_params=admin_ssl) ignite.start() app.start() control_utility.cluster_state() app.stop() ignite.stop()
def test_activate_deactivate(self, ignite_version): """ Test activate and deactivate cluster. """ servers = self.__start_ignite_nodes(ignite_version, self.NUM_NODES) control_utility = ControlUtility(servers) control_utility.activate() state, _, _ = control_utility.cluster_state() assert state.lower() == 'active', 'Unexpected state %s' % state control_utility.deactivate() state, _, _ = control_utility.cluster_state() assert state.lower() == 'inactive', 'Unexpected state %s' % state