示例#1
0
 def test_set_one_file(self):
   metrics = common.set_metrics_file(
     [os.path.join(DATA_DIR, 'one_json_line.txt')],
     ts_mon.GaugeMetric)
   print metrics
   self.assertEqual(1, len(metrics))
   self.assertIsInstance(metrics[0], ts_mon.GaugeMetric)
示例#2
0
    def test_base64_encoding(self):
        metrics = common.set_metrics_file(
            [os.path.join(DATA_DIR, 'two_base64_lines.txt')],
            ts_mon.GaugeMetric)

        self.assertEqual(2, len(metrics))
        for metric in metrics:
            self.assertIsInstance(metric, ts_mon.GaugeMetric)

        # Make sure we get the two names we're supposed to get
        names = set(metric.name for metric in metrics)
        self.assertEqual(2, len(names))
        for name in names:
            self.assertTrue(name.startswith('json_line_'))
示例#3
0
    def test_set_two_files(self):
        metrics = common.set_metrics_file([
            os.path.join(DATA_DIR, 'one_json_line.txt'),
            os.path.join(DATA_DIR, 'two_json_lines.txt')
        ], ts_mon.GaugeMetric)
        self.assertEqual(3, len(metrics))
        for metric in metrics:
            self.assertIsInstance(metric, ts_mon.GaugeMetric)

        # Make sure we get all the names we're supposed to get
        names = set(metric.name for metric in metrics)
        self.assertEqual(3, len(names))
        for name in names:
            self.assertTrue(name.startswith('json_line_'))
示例#4
0
  def test_base64_encoding(self):
    metrics = common.set_metrics_file(
      [os.path.join(DATA_DIR, 'two_base64_lines.txt')],
      ts_mon.GaugeMetric)

    self.assertEqual(2, len(metrics))
    for metric in metrics:
      self.assertIsInstance(metric, ts_mon.GaugeMetric)

    # Make sure we get the two names we're supposed to get
    names = set(metric.name for metric in metrics)
    self.assertEqual(2, len(names))
    for name in names:
      self.assertTrue(name.startswith('json_line_'))
示例#5
0
  def test_set_two_files(self):
    metrics = common.set_metrics_file(
      [os.path.join(DATA_DIR, 'one_json_line.txt'),
       os.path.join(DATA_DIR, 'two_json_lines.txt')],
      ts_mon.GaugeMetric)
    self.assertEqual(3, len(metrics))
    for metric in metrics:
      self.assertIsInstance(metric, ts_mon.GaugeMetric)

    # Make sure we get all the names we're supposed to get
    names = set(metric.name for metric in metrics)
    self.assertEqual(3, len(names))
    for name in names:
      self.assertTrue(name.startswith('json_line_'))
示例#6
0
 def test_set_one_file(self):
     metrics = common.set_metrics_file(
         [os.path.join(DATA_DIR, 'one_json_line.txt')], ts_mon.GaugeMetric)
     print metrics
     self.assertEqual(1, len(metrics))
     self.assertIsInstance(metrics[0], ts_mon.GaugeMetric)
示例#7
0
 def test_set_no_file(self):
     metrics = common.set_metrics_file([], ts_mon.GaugeMetric)
     self.assertEqual(0, len(metrics))
示例#8
0
 def test_set_no_file(self):
   metrics = common.set_metrics_file([], ts_mon.GaugeMetric)
   self.assertEqual(0, len(metrics))