def testunit_read_metric_map(self): fake_metric_conf = os.path.join(self._testdata_dir, 'sample_metrics.conf') expected_map = {'cpu_cores.gauge': 'cpu.cores', 'uptime.uptime': 'system.uptime'} returned_map = mlab_export.read_metric_map(fake_metric_conf) self.assertEqual(returned_map, expected_map)
def testunit_read_metric_map_WHEN_config_is_missing_metrics_section(self): fake_metric_conf = os.path.join(self._testdata_dir, 'sample_metrics_missing_section.conf') with self.assertRaises(SystemExit): mlab_export.read_metric_map(fake_metric_conf, 'metrics')
def testunit_read_metric_map_WHEN_config_parse_error(self): fake_metric_conf = os.path.join(self._testdata_dir, 'sample_metrics_with_error.conf') with self.assertRaises(SystemExit): mlab_export.read_metric_map(fake_metric_conf, 'metrics')
def testunit_read_metric_map_WHEN_no_file(self): fake_metric_conf = os.path.join(self._testdata_dir, 'no_such_metrics.conf') with self.assertRaises(SystemExit): mlab_export.read_metric_map(fake_metric_conf, 'metrics')