Exemplo n.º 1
0
    def testunit_get_canonical_names_WHEN_experiment_and_skip_metric(self):
        mock_options = enable_show_options(mock.Mock())
        mock_options.rrddir_prefix = '/var/lib/collectd/rrd/'
        fake_filename = ('/var/lib/collectd/rrd/utility.mlab.mlab2.nuq0t/'
                         'network/if_octets-ipv4.rrd')
        value_name = 'tx'
        expected_host = 'mlab2.nuq0t'
        expected_experiment = 'utility.mlab'
        expected_metric = None
        mlab_export.HOSTNAME = 'mlab2.nuq0t'
        mlab_export.METRIC_MAP = {}

        returned_host, returned_experiment, returned_metric = (
            mlab_export.get_canonical_names(fake_filename, value_name,
                                            mock_options))

        self.assertEqual(returned_host, expected_host)
        self.assertEqual(returned_experiment, expected_experiment)
        self.assertEqual(returned_metric, expected_metric)
Exemplo n.º 2
0
    def testunit_get_canonical_names_WHEN_experiment_and_skip_metric(self):
        mock_options = enable_show_options(mock.Mock())
        mock_options.rrddir_prefix = '/var/lib/collectd/rrd/'
        fake_filename = ('/var/lib/collectd/rrd/utility.mlab.mlab2.nuq0t/'
                         'network/if_octets-ipv4.rrd')
        value_name = 'tx'
        expected_host = 'mlab2.nuq0t'
        expected_experiment = 'utility.mlab'
        expected_metric = None
        mlab_export.HOSTNAME = 'mlab2.nuq0t'
        mlab_export.METRIC_MAP = {}

        returned_host, returned_experiment, returned_metric = (
            mlab_export.get_canonical_names(fake_filename, value_name,
                                            mock_options))

        self.assertEqual(returned_host, expected_host)
        self.assertEqual(returned_experiment, expected_experiment)
        self.assertEqual(returned_metric, expected_metric)
Exemplo n.º 3
0
  def testunit_get_canonical_names(self):
    mock_options = enable_show_options(mock.Mock())
    mock_options.rrddir_prefix = '/var/lib/collectd/rrd/'
    fake_filename = '/var/lib/collectd/rrd/mlab2.nuq0t/disk-dm-0/disk_time.rrd'
    value_name = 'write'
    expected_host = 'mlab2.nuq0t'
    expected_experiment = 'system'
    expected_metric = 'disk.swap.io.time.write'
    mlab_export.HOSTNAME = 'mlab2.nuq0t'
    mlab_export.METRIC_MAP = {
        'disk-dm-0.disk_time.write': 'disk.swap.io.time.write'}

    returned_host, returned_experiment, returned_metric = (
        mlab_export.get_canonical_names(
            fake_filename, value_name, mock_options))
    
    self.assertEqual(returned_host, expected_host)
    self.assertEqual(returned_experiment, expected_experiment)
    self.assertEqual(returned_metric, expected_metric)