def test_config_add_to_result(self, ignite_version, is_ignite_service): """ Test that the config file is in config directory and Service.logs contains the config directory to add to the result. """ ignite_cfg = IgniteConfiguration(version=IgniteVersion(ignite_version)) if is_ignite_service: ignite = IgniteService(self.test_context, ignite_cfg, num_nodes=1) else: ignite = IgniteApplicationService( self.test_context, ignite_cfg, java_class_name= "org.apache.ignite.internal.ducktest.tests.self_test.TestKillableApplication" ) ignite.start() assert ignite.logs.get('config').get('path') == ignite.config_dir assert ignite.config_file.startswith(ignite.config_dir) ignite.nodes[0].account.ssh( f'ls {ignite.config_dir} | grep {os.path.basename(ignite.config_file)}' ) ignite.nodes[0].account.ssh( f'ls {ignite.config_dir} | grep {os.path.basename(ignite.log_config_file)}' ) ignite.stop()
def test_ignite_start_stop(self, ignite_version): """ Test that IgniteService correctly start and stop """ ignite = IgniteService( self.test_context, IgniteConfiguration(version=IgniteVersion(ignite_version)), num_nodes=1) print(self.test_context) ignite.start() ignite.stop()
def test_server_config_options(self, ignite_version): """ Test to make sure non-default non-trivial ignite node configuration XML file is generated correctly. """ ignite = IgniteService(self.test_context, get_server_config(ignite_version), 1, jvm_opts="-DCELL=1") ignite.start() control_utility = ControlUtility(ignite) control_utility.activate() ignite.stop()
def test_simple_services_start_stop(self, ignite_version): """ Tests plain services start and stop (termitation vs self-terination). """ ignites = IgniteService( self.test_context, IgniteConfiguration(version=IgniteVersion(ignite_version)), num_nodes=1) ignites.start() client = IgniteService( self.test_context, IgniteClientConfiguration(version=IgniteVersion(ignite_version)), num_nodes=1) client.start() node1 = IgniteApplicationService( self.test_context, IgniteClientConfiguration( version=IgniteVersion(ignite_version), discovery_spi=from_ignite_cluster(ignites)), java_class_name= "org.apache.ignite.internal.ducktest.tests.self_test.TestKillableApplication", startup_timeout_sec=180) node2 = IgniteApplicationService( self.test_context, IgniteClientConfiguration( version=IgniteVersion(ignite_version), discovery_spi=from_ignite_cluster(ignites)), java_class_name= "org.apache.ignite.internal.ducktest.tests.self_test.TestSelfKillableApplication", startup_timeout_sec=180) node1.start() node2.run() node1.stop() client.stop() ignites.stop()
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_logs_rotation(self, ignite_version): """ Test logs rotation after ignite service restart. """ def get_log_lines_count(service, filename): node = service.nodes[0] log_file = os.path.join(service.log_dir, filename) log_cnt = list( node.account.ssh_capture(f'cat {log_file} | wc -l', callback=int))[0] return log_cnt def get_logs_count(service): node = service.nodes[0] return list( node.account.ssh_capture( f'ls {service.log_dir}/ignite.log* | wc -l', callback=int))[0] ignites = IgniteService( self.test_context, IgniteConfiguration(version=IgniteVersion(ignite_version)), num_nodes=1) ignites.start() num_restarts = 6 for i in range(num_restarts - 1): ignites.stop() old_cnt = get_log_lines_count(ignites, "ignite.log") assert old_cnt > 0 ignites.start(clean=False) new_cnt = get_log_lines_count(ignites, "ignite.log") assert new_cnt > 0 # check that there is no new entry in rotated file assert old_cnt == get_log_lines_count(ignites, f"ignite.log.{i + 1}") assert get_logs_count(ignites) == num_restarts
def test_thin_client_compatibility(self, server_version, thin_client_version): """ Thin client compatibility test. """ server_config = IgniteConfiguration(version=IgniteVersion(server_version), client_connector_configuration=ClientConnectorConfiguration()) ignite = IgniteService(self.test_context, server_config, 1) addresses = ignite.nodes[0].account.hostname + ":" + str(server_config.client_connector_configuration.port) thin_clients = IgniteApplicationService(self.test_context, IgniteThinClientConfiguration(addresses=addresses, version=IgniteVersion( thin_client_version)), java_class_name=self.JAVA_CLIENT_CLASS_NAME, num_nodes=1) ignite.start() thin_clients.run() ignite.stop()
def test_ignite_app_start_stop(self, ignite_version): """ Test that IgniteService and IgniteApplicationService correctly start and stop """ server_configuration = IgniteConfiguration( version=IgniteVersion(ignite_version)) ignite = IgniteService(self.test_context, server_configuration, num_nodes=1) client_configuration = server_configuration._replace( client_mode=True, discovery_spi=from_ignite_cluster(ignite)) app = IgniteApplicationService( self.test_context, client_configuration, java_class_name= "org.apache.ignite.internal.ducktest.tests.smoke_test.SimpleApplication" ) ignite.start() app.start() app.stop() ignite.stop()