Exemplo n.º 1
0
 def test_set_one_metric_with_start_time(self):
   json_str = '{"name": "test/name", "value": 13, "start_time": 1234}'
   metric = common.set_metric(json_str, ts_mon.CounterMetric)
   self.assertIsInstance(metric, ts_mon.CounterMetric)
   self.assertTrue(metric._name.startswith("test/name"))
   self.assertEquals(metric._start_time, 1234)
   ts_mon.unregister(metric)  # Cleanup
Exemplo n.º 2
0
 def test_set_one_metric_missing_value(self):
   json_str = '{"name": "test/name", "start_time": 1234}'
   metric = common.set_metric(json_str, ts_mon.CounterMetric)
   self.assertIsNone(metric)
Exemplo n.º 3
0
 def test_set_metric_no_input(self):
   metric = common.set_metric(None, ts_mon.GaugeMetric)
   self.assertIsNone(metric)
Exemplo n.º 4
0
 def test_set_one_metric(self):
   json_str = '{"name": "test/name", "value": 13}'
   metric = common.set_metric(json_str, ts_mon.GaugeMetric)
   self.assertIsInstance(metric, ts_mon.GaugeMetric)
   ts_mon.unregister(metric)  # Cleanup