aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/dispatcher/test_influxdb.py
diff options
context:
space:
mode:
authorRex Lee <limingjiang@huawei.com>2017-03-09 01:25:03 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-03-09 01:25:03 +0000
commitcd393f1255f09c836461be06edee7e950081fe7e (patch)
tree1ed7a5778c6ae9234d3148f34066f51b0186d7c6 /tests/unit/dispatcher/test_influxdb.py
parent8b8d99ac86d62e1816353b1eccf0811aed965d7f (diff)
parentaf3478e95314b5147c7837831dc8113d552ba067 (diff)
Merge "Bugfix: yardstick will create stacks with the same name when run using API in parallel"
Diffstat (limited to 'tests/unit/dispatcher/test_influxdb.py')
-rw-r--r--tests/unit/dispatcher/test_influxdb.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/unit/dispatcher/test_influxdb.py b/tests/unit/dispatcher/test_influxdb.py
index b84389e7e..0c7b58135 100644
--- a/tests/unit/dispatcher/test_influxdb.py
+++ b/tests/unit/dispatcher/test_influxdb.py
@@ -90,19 +90,21 @@ class InfluxdbDispatcherTestCase(unittest.TestCase):
}
}
+ self.yardstick_conf = {'yardstick': {}}
+
def test_record_result_data_no_target(self):
- influxdb = InfluxdbDispatcher(None)
+ influxdb = InfluxdbDispatcher(None, self.yardstick_conf)
influxdb.target = ''
self.assertEqual(influxdb.record_result_data(self.data1), -1)
def test_record_result_data_no_case_name(self):
- influxdb = InfluxdbDispatcher(None)
+ influxdb = InfluxdbDispatcher(None, self.yardstick_conf)
self.assertEqual(influxdb.record_result_data(self.data2), -1)
@mock.patch('yardstick.dispatcher.influxdb.requests')
def test_record_result_data(self, mock_requests):
type(mock_requests.post.return_value).status_code = 204
- influxdb = InfluxdbDispatcher(None)
+ influxdb = InfluxdbDispatcher(None, self.yardstick_conf)
self.assertEqual(influxdb.record_result_data(self.data1), 0)
self.assertEqual(influxdb.record_result_data(self.data2), 0)
self.assertEqual(influxdb.flush_result_data(), 0)
@@ -112,7 +114,7 @@ class InfluxdbDispatcherTestCase(unittest.TestCase):
'mpstat.cpu0.%idle=99.00,mpstat.cpu0.%sys=0.00'
# need to sort for assert to work
line = ",".join(sorted(line.split(',')))
- influxdb = InfluxdbDispatcher(None)
+ influxdb = InfluxdbDispatcher(None, self.yardstick_conf)
flattened_data = influxdb._dict_key_flatten(
self.data3['benchmark']['data'])
result = ",".join(
@@ -120,7 +122,7 @@ class InfluxdbDispatcherTestCase(unittest.TestCase):
self.assertEqual(result, line)
def test__get_nano_timestamp(self):
- influxdb = InfluxdbDispatcher(None)
+ influxdb = InfluxdbDispatcher(None, self.yardstick_conf)
results = {'benchmark': {'timestamp': '1451461248.925574'}}
self.assertEqual(influxdb._get_nano_timestamp(results),
'1451461248925574144')
@@ -128,7 +130,7 @@ class InfluxdbDispatcherTestCase(unittest.TestCase):
@mock.patch('yardstick.dispatcher.influxdb.time')
def test__get_nano_timestamp_except(self, mock_time):
results = {}
- influxdb = InfluxdbDispatcher(None)
+ influxdb = InfluxdbDispatcher(None, self.yardstick_conf)
mock_time.time.return_value = 1451461248.925574
self.assertEqual(influxdb._get_nano_timestamp(results),
'1451461248925574144')