Exemplo n.º 1
0
  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)
Exemplo n.º 2
0
    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')
Exemplo n.º 3
0
    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')
Exemplo n.º 4
0
    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')
Exemplo n.º 5
0
    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')
Exemplo n.º 6
0
    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')
Exemplo n.º 7
0
    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')