def test_is_cassandra_healthy_invalid_input(self): host = Mock() # Not using ccm, directing check for cassandra health. medusa_config_v4 = self.get_simple_medusa_config(is_ccm_active="0", yaml_file='resources/yaml/original/default-c4.yaml') cassandra_v4 = Cassandra(medusa_config_v4, release_version="4") # invalid cassandra input self.assertFalse(is_cassandra_healthy("all", {}, host)) # invalid host input self.assertFalse(is_cassandra_healthy("all", cassandra_v4, {}))
def test_is_cassandra_healthy_check_type_unknown(self, is_open): host = Mock() # Not using ccm, directing check for cassandra health. medusa_config_v4 = self.get_simple_medusa_config(is_ccm_active="0", yaml_file='resources/yaml/original/default-c4.yaml') cassandra_v4 = Cassandra(medusa_config_v4, release_version="4") is_open.return_value = True self.assertTrue(is_cassandra_healthy("not-thrift-and-not-all-check", cassandra_v4, host)) assert is_open.call_count == 1 is_open.call_count = 0 is_open.return_value = False self.assertFalse(is_cassandra_healthy("not-thrift-and-not-all-check", cassandra_v4, host)) assert is_open.call_count == 2
def test_is_cassandra_healthy_check_types(self, fm): host = Mock() # Not using ccm, directing check for cassandra health. medusa_config_v4 = self.get_simple_medusa_config(is_ccm_active="0", yaml_file='resources/yaml/original/default-c4.yaml') cassandra_v4 = Cassandra(medusa_config_v4, release_version="4") # When c* version 4 is used, check for the port values. fm.return_value = True self.assertTrue(is_cassandra_healthy("all", cassandra_v4, host)) self.assertTrue(is_cassandra_healthy("thrift", cassandra_v4, host)) self.assertTrue(is_cassandra_healthy("unknown", cassandra_v4, host))
def test_is_cassandra_v2_healthy(self, fm): fm.return_value = True host = Mock() medusa_config_v2 = self.get_simple_medusa_config(is_ccm_active="0", yaml_file='resources/yaml/original/default-c2.yaml') cassandra_v2 = Cassandra(medusa_config_v2, release_version="2") # When c* version 2 is used, check for the port values. self.assertTrue(is_cassandra_healthy("all", cassandra_v2, host)) assert fm.call_count == 3
def test_is_cassandra_v3_healthy(self, fm): fm.return_value = True host = Mock() # Not using ccm, directing check for cassandra health. medusa_config_v3 = self.get_simple_medusa_config(is_ccm_active="0", yaml_file='resources/yaml/original/default-c3.yaml') cassandra_v3 = Cassandra(medusa_config_v3, release_version="3") # When c* version 3 is used, check for the port values. self.assertTrue(is_cassandra_healthy("all", cassandra_v3, host)) assert fm.call_count == 3