示例#1
0
 def test_influx_service_not_inited(self):
     self.setUpLogging()
     self.patch(storage_backends.influxdb_client, 'InfluxDBClient', fakestats.FakeInfluxDBClient)
     svc = InfluxStorageService(
         "fake_url", "fake_port", "fake_user", "fake_password", "fake_db", "fake_stats")
     svc._inited = False
     svc.thd_postStatsValue("test", "test", "test")
     self.assertLogged("Service.*not initialized")
示例#2
0
 def test_influx_service_not_inited(self):
     self.setUpLogging()
     self.patch(storage_backends.influxdb_client, 'InfluxDBClient', fakestats.FakeInfluxDBClient)
     svc = InfluxStorageService(
         "fake_url", "fake_port", "fake_user", "fake_password", "fake_db", "fake_stats")
     svc._inited = False
     svc.thd_postStatsValue("test", "test", "test")
     self.assertLogged("Service.*not initialized")
示例#3
0
 def test_influx_storage_service_post_value(self):
     # test the thd_postStatsValue method of InfluxStorageService
     self.patch(storage_backends.influxdb_client, 'InfluxDBClient',
                fakestats.FakeInfluxDBClient)
     svc = InfluxStorageService("fake_url", "fake_port", "fake_user",
                                "fake_password", "fake_db", "fake_stats")
     post_data = {'name': 'test', 'value': 'test'}
     context = {'x': 'y'}
     svc.thd_postStatsValue(post_data, "test_series_name", context)
     data = {
         'measurement': "test_series_name",
         'fields': {
             "name": "test",
             "value": "test"
         },
         'tags': {
             'x': 'y'
         }
     }
     points = [data]
     self.assertEqual(svc.client.points, points)
示例#4
0
 def test_influx_storage_service_post_value(self):
     # test the thd_postStatsValue method of InfluxStorageService
     self.patch(storage_backends.influxdb_client, 'InfluxDBClient', fakestats.FakeInfluxDBClient)
     svc = InfluxStorageService(
         "fake_url", "fake_port", "fake_user", "fake_password", "fake_db", "fake_stats")
     post_data = {
         'name': 'test',
         'value': 'test'
     }
     context = {'x': 'y'}
     svc.thd_postStatsValue(post_data, "test_series_name", context)
     data = {
         'measurement': "test_series_name",
         'fields': {
             "name": "test",
             "value": "test"
         },
         'tags': {'x': 'y'}
     }
     points = [data]
     self.assertEquals(svc.client.points, points)