class TestCCMLib(ccmtest.Tester): def test2(self): self.cluster = Cluster(CLUSTER_PATH, "test2", cassandra_version='2.0.3') self.cluster.populate(2) self.cluster.start() self.cluster.set_log_level("ERROR") class FakeNode: name = "non-existing node" self.cluster.remove(FakeNode()) [node1, node2] = self.cluster.nodelist() self.cluster.remove(node1) self.cluster.show(True) self.cluster.show(False) #self.cluster.stress([]) self.cluster.compact() self.cluster.drain() self.cluster.stop() def test3(self): self.cluster = Cluster(CLUSTER_PATH, "test3", cassandra_version='2.0.3') self.cluster.populate(2) self.cluster.start() self.cluster.cleanup() self.cluster.clear() self.cluster.stop()
def test3(): cluster = Cluster(CLUSTER_PATH, "test3", cassandra_version='2.0.3') cluster.populate(2) cluster.start() cluster.cleanup() cluster.clear() cluster.stop()
class TestCCMLib(ccmtest.Tester): def test2(self): self.cluster = Cluster(CLUSTER_PATH, "test2", cassandra_version='git:trunk') self.cluster.populate(2) self.cluster.start() self.cluster.set_log_level("ERROR") class FakeNode: name = "non-existing node" self.cluster.remove(FakeNode()) [node1, node2] = self.cluster.nodelist() self.cluster.remove(node1) self.cluster.show(True) self.cluster.show(False) # self.cluster.stress([]) self.cluster.compact() self.cluster.drain() self.cluster.stop() def test3(self): self.cluster = Cluster(CLUSTER_PATH, "test3", cassandra_version='git:trunk') self.cluster.populate(2) self.cluster.start() self.cluster.cleanup() self.cluster.clear() self.cluster.stop() def test_node_start_with_non_default_timeout(self): self.cluster = Cluster(CLUSTER_PATH, "nodestarttimeout", cassandra_version='git:trunk') self.cluster.populate(1) node = self.cluster.nodelist()[0] try: node.start(wait_for_binary_proto=0) self.fail("timeout expected with 0s startup timeout") except ccmlib.node.TimeoutError: pass finally: self.cluster.cleanup() self.cluster.clear() self.cluster.stop()
class TestCCMLib(ccmtest.Tester): def simple_test(self, version='2.0.9'): self.cluster = Cluster(CLUSTER_PATH, "simple", cassandra_version=version) self.cluster.populate(3) self.cluster.start() node1, node2, node3 = self.cluster.nodelist() if version < '2.1': node1.stress() else: node1.stress(['write', 'n=1000000']) self.cluster.flush() def simple_test_across_versions(self): self.simple_test(version='1.2.18') self.cluster.remove() self.simple_test(version='2.0.9') self.cluster.remove() self.simple_test(version='2.1.0-rc5') def restart_test(self): self.cluster = Cluster(CLUSTER_PATH, "restart", cassandra_version='2.0.9') self.cluster.populate(3) self.cluster.start() self.cluster.stop() self.cluster.start() self.cluster.show(True) def multi_dc_test(self): self.cluster = Cluster(CLUSTER_PATH, "multi_dc", cassandra_version='2.0.9') self.cluster.populate([1, 2]) self.cluster.start() dcs = [node.data_center for node in self.cluster.nodelist()] self.cluster.set_configuration_options(None, None) self.cluster.stop() self.cluster.start() dcs_2 = [node.data_center for node in self.cluster.nodelist()] self.assertListEqual(dcs, dcs_2) def test1(self): self.cluster = Cluster(CLUSTER_PATH, "test1", cassandra_version='2.0.3') self.cluster.show(False) self.cluster.populate(2) self.cluster.set_partitioner("Murmur3") self.cluster.start() self.cluster.set_configuration_options(None, None) self.cluster.set_configuration_options({}, True) self.cluster.set_configuration_options({"a": "b"}, False) [node1, node2] = self.cluster.nodelist() node2.compact() self.cluster.flush() self.cluster.stop() def test2(self): self.cluster = Cluster(CLUSTER_PATH, "test2", cassandra_version='2.0.3') self.cluster.populate(2) self.cluster.start() self.cluster.set_log_level("ERROR") class FakeNode: name = "non-existing node" self.cluster.remove(FakeNode()) [node1, node2] = self.cluster.nodelist() self.cluster.remove(node1) self.cluster.show(True) self.cluster.show(False) #self.cluster.stress([]) self.cluster.compact() self.cluster.drain() self.cluster.stop() def test3(self): self.cluster = Cluster(CLUSTER_PATH, "test3", cassandra_version='2.0.3') self.cluster.populate(2) self.cluster.start() self.cluster.cleanup() self.cluster.clear() self.cluster.stop()
class TestCCMLib(ccmtest.Tester): def test2(self): self.cluster = Cluster(CLUSTER_PATH, "test2", cassandra_version='git:trunk') self.cluster.populate(2) self.cluster.start() self.cluster.set_log_level("ERROR") class FakeNode: name = "non-existing node" self.cluster.remove(FakeNode()) [node1, node2] = self.cluster.nodelist() self.cluster.remove(node1) self.cluster.show(True) self.cluster.show(False) # self.cluster.stress([]) self.cluster.compact() self.cluster.drain() self.cluster.stop() def test3(self): self.cluster = Cluster(CLUSTER_PATH, "test3", cassandra_version='git:trunk') self.cluster.populate(2) self.cluster.start() self.cluster.cleanup() self.cluster.clear() self.cluster.stop() def test_node_start_with_non_default_timeout(self): self.cluster = Cluster(CLUSTER_PATH, "nodestarttimeout", cassandra_version='git:trunk') self.cluster.populate(1) node = self.cluster.nodelist()[0] try: node.start(wait_for_binary_proto=0) self.fail("timeout expected with 0s startup timeout") except ccmlib.node.TimeoutError: pass finally: self.cluster.cleanup() self.cluster.clear() self.cluster.stop() def test_fast_error_on_cluster_start_failure(self): self.cluster = Cluster(CLUSTER_PATH, 'clusterfaststop', cassandra_version='git:trunk') self.cluster.populate(1) self.cluster.set_configuration_options({'invalid_option': 0}) self.check_log_errors = False node = self.cluster.nodelist()[0] start_time = time.time() try: self.cluster.start(use_vnodes=True) self.assertFalse(node.is_running()) self.assertLess(time.time() - start_time, 30) except NodeError: self.assertLess(time.time() - start_time, 30) finally: self.cluster.clear() self.cluster.stop() def test_fast_error_on_node_start_failure(self): self.cluster = Cluster(CLUSTER_PATH, 'nodefaststop', cassandra_version='git:trunk') self.cluster.populate(1) self.cluster.set_configuration_options({'invalid_option': 0}) self.check_log_errors = False node = self.cluster.nodelist()[0] start_time = time.time() try: node.start(wait_for_binary_proto=45) self.assertFalse(node.is_running()) self.assertLess(time.time() - start_time, 30) except NodeError: self.assertLess(time.time() - start_time, 30) finally: self.cluster.clear() self.cluster.stop()
class TestCCMLib(ccmtest.Tester): def test2(self): self.cluster = Cluster(CLUSTER_PATH, "test2", version='git:trunk') self.cluster.populate(2) self.cluster.start() self.cluster.set_log_level("ERROR") class FakeNode: name = "non-existing node" self.cluster.remove(FakeNode()) node1 = self.cluster.nodelist()[0] self.cluster.remove(node1) self.cluster.show(True) self.cluster.show(False) self.cluster.compact() self.cluster.drain() self.cluster.stop() def test3(self): self.cluster = Cluster(CLUSTER_PATH, "test3", version='git:trunk') self.cluster.populate(2) self.cluster.start() node1 = self.cluster.nodelist()[0] self.cluster.stress( ['write', 'n=100', 'no-warmup', '-rate', 'threads=4']) self.cluster.stress([ 'write', 'n=100', 'no-warmup', '-rate', 'threads=4', '-node', node1.ip_addr ]) self.cluster.cleanup() self.cluster.clear() self.cluster.stop() def test_node_start_with_non_default_timeout(self): self.cluster = Cluster(CLUSTER_PATH, "nodestarttimeout", cassandra_version='git:trunk') self.cluster.populate(1) node = self.cluster.nodelist()[0] try: node.start(wait_for_binary_proto=0) self.fail("timeout expected with 0s startup timeout") except ccmlib.node.TimeoutError: pass finally: self.cluster.cleanup() self.cluster.clear() self.cluster.stop() def test_fast_error_on_cluster_start_failure(self): self.cluster = Cluster(CLUSTER_PATH, 'clusterfaststop', cassandra_version='git:trunk') self.cluster.populate(1) self.cluster.set_configuration_options({'invalid_option': 0}) self.check_log_errors = False node = self.cluster.nodelist()[0] start_time = time.time() try: self.cluster.start(use_vnodes=True) self.assertFalse(node.is_running()) self.assertLess(time.time() - start_time, 30) except NodeError: self.assertLess(time.time() - start_time, 30) finally: self.cluster.clear() self.cluster.stop() def test_fast_error_on_node_start_failure(self): self.cluster = Cluster(CLUSTER_PATH, 'nodefaststop', cassandra_version='git:trunk') self.cluster.populate(1) self.cluster.set_configuration_options({'invalid_option': 0}) self.check_log_errors = False node = self.cluster.nodelist()[0] start_time = time.time() try: node.start(wait_for_binary_proto=45) self.assertFalse(node.is_running()) self.assertLess(time.time() - start_time, 30) except NodeError: self.assertLess(time.time() - start_time, 30) finally: self.cluster.clear() self.cluster.stop() def test_dc_mandatory_on_multidc(self): self.cluster = Cluster(CLUSTER_PATH, "mandatorydc", cassandra_version='git:trunk') self.cluster.populate([1, 1]) node3 = self.cluster.create_node(name='node3', auto_bootstrap=True, thrift_interface=('127.0.0.3', 9160), storage_interface=('127.0.0.3', 7000), jmx_port='7300', remote_debug_port='0', initial_token=None, binary_interface=('127.0.0.3', 9042)) with self.assertRaisesRegexp( ccmlib.common.ArgumentError, 'Please specify the DC this node should be added to'): self.cluster.add(node3, is_seed=False)
conn.close() log.debug("\n\nRequest ended\n\n") setup_cluster = False if setup_cluster: CCM_KWARGS = {} CCM_KWARGS['version'] = "3.7" path_to_ccm = "/home/jaume/.ccm/" CCM_CLUSTER = CCMCluster(path_to_ccm, "test_for_is_conn", **CCM_KWARGS) CCM_CLUSTER.populate(3) CCM_CLUSTER.clear() CCM_CLUSTER.start() time.sleep(5) connection_class.initialize_reactor() try: for _ in range(40000): make_request() except Exception as e: import traceback traceback.print_exc() raise e finally: if setup_cluster: