def __prepare_ssl(self, test_globals, shared_root): """ Updates ssl configuration from globals. """ ssl_params = None if self.ssl_params is None and is_ssl_enabled(test_globals): ssl_params = get_ssl_params(test_globals, shared_root, IGNITE_CLIENT_ALIAS) if ssl_params: return self._replace(ssl_params=ssl_params) return self
def __init__(self, cluster, ssl_params=None, username=None, password=None): self._cluster = cluster self.logger = cluster.context.logger if ssl_params: self.ssl_params = ssl_params elif is_ssl_enabled(cluster.context.globals): self.ssl_params = get_ssl_params(cluster.context.globals, cluster.shared_root, IGNITE_ADMIN_ALIAS) if username and password: self.username, self.password = username, password elif is_auth_enabled(cluster.context.globals): self.username, self.password = get_credentials(cluster.context.globals)
def is_prepare_shared_files(self, local_dir): """ :return True if we have something to prepare. """ if not is_ssl_enabled(self.service.context.globals) and \ not (self.service.config.service_type == IgniteServiceType.NODE and self.service.config.ssl_params): self.service.logger.debug("Ssl disabled. Nothing to generate.") return False if os.path.isfile(os.path.join(local_dir, SHARED_PREPARED_FILE)): self.service.logger.debug("Local shared dir already prepared. Exiting. " + local_dir) return False return True
def __prepare_ssl(self, test_globals, shared_root): """ Updates ssl configuration from globals. """ ssl_params = None if self.ssl_params is None and is_ssl_enabled(test_globals): ssl_params = get_ssl_params( test_globals, shared_root, IGNITE_CLIENT_ALIAS if self.client_mode else IGNITE_SERVER_ALIAS) if ssl_params: return self._replace( ssl_params=ssl_params, connector_configuration=ConnectorConfiguration( ssl_enabled=True, ssl_params=ssl_params), client_connector_configuration=ClientConnectorConfiguration( ssl_enabled=True, ssl_params=ssl_params)) return self
class PersistenceUpgradeTest(IgniteTest): """ Test checks persistence upgrade. """ @cluster(num_nodes=1) @ignite_versions(str(OLDEST)) @ignore_if(lambda _, globals: is_ssl_enabled(globals)) @parametrize(versions=[str(OLDEST), str(LATEST), str(DEV_BRANCH)]) def upgrade_test(self, versions, ignite_version): """ Basic upgrade test. """ versions = sorted(list(map(IgniteVersion, versions))) self.logger.info(f"Testing: {versions}") service = IgniteApplicationService( self.test_context, config=None, # will be defined later. java_class_name="org.apache.ignite.internal.ducktest.tests.persistence_upgrade_test." "DataLoaderAndCheckerApplication" ) for version in versions: service.config = IgniteConfiguration( data_storage=DataStorageConfiguration(default=DataRegionConfiguration(persistence_enabled=True)), version=version ) service.params = {"check": service.stopped} service.start(clean=False) control_utility = ControlUtility(service) control_utility.activate() service.stop()
class PmeFreeSwitchTest(IgniteTest): """ Tests PME free switch scenarios. """ NUM_NODES = 9 EXTRA_CACHES_AMOUNT = 100 @cluster(num_nodes=NUM_NODES + 2) @ignore_if(lambda version, globals: version < V_2_8_0 and is_ssl_enabled(globals)) @ignite_versions(str(DEV_BRANCH), str(LATEST)) @matrix(load_type=[LoadType.NONE, LoadType.EXTRA_CACHES, LoadType.LONG_TXS]) def test(self, ignite_version, load_type): """ Tests PME-free switch scenario (node stop). """ data = {} caches = [CacheConfiguration(name='test-cache', backups=2, atomicity_mode='TRANSACTIONAL')] l_type = LoadType.construct_from(load_type) # Checking PME (before 2.8) vs PME-free (2.8+) switch duration, but # focusing on switch duration (which depends on caches amount) when long_txs is false and # on waiting for previously started txs before the switch (which depends on txs duration) when long_txs of true. if l_type is LoadType.EXTRA_CACHES: for idx in range(1, self.EXTRA_CACHES_AMOUNT): caches.append(CacheConfiguration(name="cache-%d" % idx, backups=2, atomicity_mode='TRANSACTIONAL')) config = IgniteConfiguration(version=IgniteVersion(ignite_version), caches=caches, cluster_state="INACTIVE") num_nodes = len(self.test_context.cluster) - 2 self.test_context.logger.info("Nodes amount calculated as %d." % num_nodes) ignites = IgniteService(self.test_context, config, num_nodes=num_nodes) ignites.start() if IgniteVersion(ignite_version) >= V_2_8_0: ControlUtility(ignites).disable_baseline_auto_adjust() ControlUtility(ignites).activate() client_config = config._replace(client_mode=True, discovery_spi=from_ignite_cluster(ignites, slice(0, num_nodes - 1))) long_tx_streamer = IgniteApplicationService( self.test_context, client_config, java_class_name="org.apache.ignite.internal.ducktest.tests.pme_free_switch_test.LongTxStreamerApplication", params={"cacheName": "test-cache"}, startup_timeout_sec=180) if l_type is LoadType.LONG_TXS: long_tx_streamer.start() single_key_tx_streamer = IgniteApplicationService( self.test_context, client_config, java_class_name="org.apache.ignite.internal.ducktest.tests.pme_free_switch_test." "SingleKeyTxStreamerApplication", params={"cacheName": "test-cache", "warmup": 1000}, startup_timeout_sec=180) single_key_tx_streamer.start() ignites.stop_node(ignites.nodes[num_nodes - 1]) single_key_tx_streamer.await_event("Node left topology", 60, from_the_beginning=True) if l_type is LoadType.LONG_TXS: time.sleep(30) # keeping txs alive for 30 seconds. long_tx_streamer.stop_async() single_key_tx_streamer.await_event("Node left topology", 60, from_the_beginning=True) single_key_tx_streamer.await_event("APPLICATION_STREAMED", 60) # waiting for streaming continuation. single_key_tx_streamer.stop() data["Worst latency (ms)"] = single_key_tx_streamer.extract_result("WORST_LATENCY") data["Streamed txs"] = single_key_tx_streamer.extract_result("STREAMED") data["Measure duration (ms)"] = single_key_tx_streamer.extract_result("MEASURE_DURATION") data["Server nodes"] = num_nodes return data