def test_multi_finder(self): store = Store([DummyFinder(), DummyFinder()]) nodes = list(store.find("foo")) self.assertEqual(len(nodes), 1) self.assertEqual(nodes[0].path, 'foo') nodes = list(store.find('bar.*')) self.assertEqual(len(nodes), 10) node = nodes[0] self.assertEqual(node.path.split('.')[0], 'bar') time_info, series = node.fetch(100, 200) self.assertEqual(time_info, (100, 200, 10)) self.assertEqual(len(series), 10)
def test_custom_finder(self): store = Store([DummyFinder()]) nodes = list(store.find("foo")) self.assertEqual(len(nodes), 1) self.assertEqual(nodes[0].path, "foo") nodes = list(store.find("bar.*")) self.assertEqual(len(nodes), 10) node = nodes[0] self.assertEqual(node.path.split(".")[0], "bar") time_info, series = node.fetch(100, 200) self.assertEqual(time_info, (100, 200, 10)) self.assertEqual(len(series), 10)
def setUp(self): self._cleanup() os.makedirs(WHISPER_DIR) app.config['TESTING'] = True whisper_conf = {'whisper': {'directories': [WHISPER_DIR]}} app.config['GRAPHITE']['store'] = Store([WhisperFinder(whisper_conf)]) self.app = app.test_client()
def setup_teardown(): os.makedirs(KENSHIN_DIR) app.config['TESTING'] = True kenshin_conf = { 'kenshin': { 'directories': [KENSHIN_DIR], 'carbonlink_hosts': [], 'memcached': { 'expire_time': 20, 'hosts': ['127.0.0.1'] } } } app.config['GRAPHITE']['store'] = Store([KenshinFinder(kenshin_conf)]) yield shutil.rmtree(DATA_DIR)