def test_datacenter_metrics(aggregator): check = AerospikeCheck('aerospike', {}, [common.INSTANCE]) original_get_info = check.get_info def mock_get_info(command, separator=";"): if command == 'dcs': return ['test'] elif command.startswith("dc/"): return common.MOCK_DATACENTER_METRICS return original_get_info(command, separator) check.get_info = mock_get_info check._client = mock.MagicMock() check._client.get_node_names = mock.MagicMock( side_effect=lambda: [{ 'address': common.HOST, 'port': common.PORT, 'node_name': 'test' }]) check.get_namespaces = mock.MagicMock() check.collect_info = mock.MagicMock() check.collect_throughput = mock.MagicMock() check.collect_latency = mock.MagicMock() check.check(None) for metric in common.DATACENTER_METRICS: aggregator.assert_metric(metric)
def test_datacenter_metrics(aggregator): check = AerospikeCheck('aerospike', {}, [common.INSTANCE]) original_get_info = check.get_info def mock_get_info(command, separator=";"): if command == 'dcs': return ['test'] elif command.startswith("dc/"): return common.DATACENTER_METRICS return original_get_info(command, separator) check.get_info = mock_get_info check._client = mock.MagicMock() check.get_namespaces = mock.MagicMock() check.collect_info = mock.MagicMock() check.collect_throughput = mock.MagicMock() check.collect_latency = mock.MagicMock() check.collect_version = mock.MagicMock() check.check(common.INSTANCE) for metric in METRICS: aggregator.assert_metric(metric)