statsd: simplify testing code

No need to list anything, we know the metric id already. It's more sure.

Change-Id: I4ec70c5c8f74b252ec06773c45c8eb040e40ac22
This commit is contained in:
Julien Danjou 2016-08-16 12:50:09 +02:00
parent 59a2eff7cd
commit f1f81c552b

View File

@ -68,10 +68,8 @@ class TestStatsd(tests_base.TestCase):
metric = r.get_metric(metric_key)
metrics = self.stats.storage.list_metric_with_measures_to_process(
None, None, full=True)
self.stats.storage.process_background_tasks(
self.stats.indexer, metrics, sync=True)
self.stats.indexer, [str(metric.id)], sync=True)
measures = self.stats.storage.get_measures(metric)
self.assertEqual([
@ -90,10 +88,8 @@ class TestStatsd(tests_base.TestCase):
("127.0.0.1", 12345))
self.stats.flush()
metrics = self.stats.storage.list_metric_with_measures_to_process(
None, None, full=True)
self.stats.storage.process_background_tasks(
self.stats.indexer, metrics, sync=True)
self.stats.indexer, [str(metric.id)], sync=True)
measures = self.stats.storage.get_measures(metric)
self.assertEqual([
@ -125,10 +121,8 @@ class TestStatsd(tests_base.TestCase):
metric = r.get_metric(metric_key)
self.assertIsNotNone(metric)
metrics = self.stats.storage.list_metric_with_measures_to_process(
None, None, full=True)
self.stats.storage.process_background_tasks(
self.stats.indexer, metrics, sync=True)
self.stats.indexer, [str(metric.id)], sync=True)
measures = self.stats.storage.get_measures(metric)
self.assertEqual([
@ -145,10 +139,8 @@ class TestStatsd(tests_base.TestCase):
("127.0.0.1", 12345))
self.stats.flush()
metrics = self.stats.storage.list_metric_with_measures_to_process(
None, None, full=True)
self.stats.storage.process_background_tasks(
self.stats.indexer, metrics, sync=True)
self.stats.indexer, [str(metric.id)], sync=True)
measures = self.stats.storage.get_measures(metric)
self.assertEqual([