diff --git a/openstack_health/run_aggregator.py b/openstack_health/run_aggregator.py index d6c56184..47eaba47 100644 --- a/openstack_health/run_aggregator.py +++ b/openstack_health/run_aggregator.py @@ -30,6 +30,8 @@ def format_output_numeric_dicts(df): def get_numeric_data(run_times_time_series, sample_rate): + if not run_times_time_series: + return {} temp_dict = {} sample_rate = base.resample_matrix[sample_rate] for run_at, run in run_times_time_series.items(): diff --git a/openstack_health/tests/test_run_aggregator.py b/openstack_health/tests/test_run_aggregator.py index 71d070a2..27eb616b 100644 --- a/openstack_health/tests/test_run_aggregator.py +++ b/openstack_health/tests/test_run_aggregator.py @@ -58,6 +58,11 @@ class TestRunAggregatorGetNumericData(base.TestCase): } } + def test_get_numeric_data_no_runs(self): + expected = {} + actual = run_aggregator.get_numeric_data({}, 'day') + self.assertEqual(expected, actual) + def test_get_numeric_data(self): self.maxDiff = None expected = {