def setup_module(module): if os.name != "nt": validate_host_viable() # We use a dedicated cluster (instead of common singledc, as in other tests) because # it's most likely that the test host will only have one local ipv6 address (::1) # singledc has three use_cluster(IPV6_CLUSTER_NAME, [1], ipformat='::%d')
def test_removed_node_stops_reconnecting(self): """ Ensure we stop reconnecting after a node is removed. PYTHON-1181 """ use_cluster("test_down_then_removed", [3], start=True) state_listener = StateListener() cluster = TestCluster() self.addCleanup(cluster.shutdown) cluster.register_listener(state_listener) session = cluster.connect(wait_for_all_pools=True) get_node(3).nodetool("disablebinary") wait_until(condition=lambda: state_listener.downed_host is not None, delay=2, max_attempts=50) self.assertTrue(state_listener.downed_host.is_currently_reconnecting()) decommission(3) wait_until(condition=lambda: state_listener.removed_host is not None, delay=2, max_attempts=50) self.assertIs(state_listener.downed_host, state_listener.removed_host) # Just a sanity check self.assertFalse( state_listener.removed_host.is_currently_reconnecting())
def _test_basic(self, dse_version): """ Test basic connection and usage """ cluster_name = '{}-{}'.format( self.__class__.__name__, dse_version.base_version.replace('.', '_') ) use_cluster(cluster_name=cluster_name, nodes=[3], dse_cluster=True, dse_options={}, dse_version=dse_version) cluster = Cluster( allow_beta_protocol_version=(dse_version >= Version('6.7.0'))) session = cluster.connect() result = execute_until_pass( session, """ CREATE KEYSPACE clustertests WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} """) self.assertFalse(result) result = execute_with_long_wait_retry( session, """ CREATE TABLE clustertests.cf0 ( a text, b text, c text, PRIMARY KEY (a, b) ) """) self.assertFalse(result) result = session.execute( """ INSERT INTO clustertests.cf0 (a, b, c) VALUES ('a', 'b', 'c') """) self.assertFalse(result) result = session.execute("SELECT * FROM clustertests.cf0") self.assertEqual([('a', 'b', 'c')], result) execute_with_long_wait_retry(session, "DROP KEYSPACE clustertests") cluster.shutdown()
def _test_basic(self, dse_version): """ Test basic connection and usage """ cluster_name = '{}-{}'.format( self.__class__.__name__, dse_version.base_version.replace('.', '_')) use_cluster(cluster_name=cluster_name, nodes=[3], dse_cluster=True, dse_options={}, dse_version=dse_version) cluster = Cluster( allow_beta_protocol_version=(dse_version >= Version('6.7.0'))) session = cluster.connect() result = execute_until_pass( session, """ CREATE KEYSPACE clustertests WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} """) self.assertFalse(result) result = execute_with_long_wait_retry( session, """ CREATE TABLE clustertests.cf0 ( a text, b text, c text, PRIMARY KEY (a, b) ) """) self.assertFalse(result) result = session.execute(""" INSERT INTO clustertests.cf0 (a, b, c) VALUES ('a', 'b', 'c') """) self.assertFalse(result) result = session.execute("SELECT * FROM clustertests.cf0") self.assertEqual([('a', 'b', 'c')], result) execute_with_long_wait_retry(session, "DROP KEYSPACE clustertests") cluster.shutdown()
def setUpClass(cls): if not USE_CASS_EXTERNAL: ccm_cluster = use_cluster(cls.__name__, [3], start=False) node3 = ccm_cluster.nodes['node3'] node3.set_configuration_options(values={ 'authenticator': 'PasswordAuthenticator', 'authorizer': 'CassandraAuthorizer', }) ccm_cluster.start() cls.ccm_cluster = ccm_cluster
def _upgrade_step_setup(self): """ This is not the regular _setUp method because it will be called from the decorator instead of letting nose handle it. This setup method will start a cluster with the right version according to the variable UPGRADE_PATH. """ remove_cluster() self.cluster = use_cluster(UPGRADE_CLUSTER_NAME + self.UPGRADE_PATH.name, [3], ccm_options=self.UPGRADE_PATH.starting_version, set_keyspace=self.set_keyspace, configuration_options=self.UPGRADE_PATH.configuration_options) self.nodes = self.cluster.nodelist() self.last_node_upgraded = None self.upgrade_done = Event() self.upgrade_thread = None if self.start_cluster: setup_keyspace() self.cluster_driver = Cluster() self.session = self.cluster_driver.connect() self.logger_handler.reset()
def setup_module(): use_cluster('test_cluster', [4])
def setup_module(): os.environ['SCYLLA_EXT_OPTS'] = "--smp 4 --memory 2048M" use_cluster('shared_aware', [3], start=True)
def setup_module(): if is_windows(): return use_cluster(CLUSTER_NAME, [3], dse_cluster=True, dse_options={})