Permalink
Browse files

Fix list index out of range in _get_metrics when the metric doesn't e…

…xists
  • Loading branch information...
adriengentil committed Nov 8, 2018
1 parent 36325f1 commit 702f0c50783286817a6a3f0b94139bedc6956af5
Showing with 5 additions and 2 deletions.
  1. +1 −2 biggraphite/drivers/cassandra.py
  2. +4 −0 tests/drivers/base_test_metadata.py
@@ -1741,8 +1741,7 @@ def _get_metrics(self, metric_names):
for (success, result) in results:
if not success:
raise CassandraError("Failed to concurrently get metrics", result)
if result[0] is not None:
row = result[0]
for row in result:
metric = self._bind_metric(row)
if metric is not None:
metrics.append(metric)
@@ -400,3 +400,7 @@ def test_touch_without_create(self):
self.accessor.touch_metric(metric)
self.accessor.create_metric(metric)
self.accessor.touch_metric(metric)
def test_get_metric_unknown(self):
unknown_metric_name = 'this.metric.is.unknown'
self.assertEqual(self.accessor.get_metric(unknown_metric_name), None)

0 comments on commit 702f0c5

Please sign in to comment.