From 25a37b2048281c64719bd6ad67860f65f6c31546 Mon Sep 17 00:00:00 2001 From: rexlee8776 Date: Wed, 5 Jul 2017 02:50:06 +0000 Subject: move flatten dict key to common utils So it can easily be used by other testcase to unify result JIRA: YARDSTICK-702 Change-Id: Id4fde38a9a0c2a87a6c870bdb7b0c8f3a3b371ac Signed-off-by: rexlee8776 --- tests/unit/benchmark/scenarios/networking/test_iperf3.py | 7 ++++--- tests/unit/benchmark/scenarios/networking/test_ping.py | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'tests/unit/benchmark/scenarios/networking') diff --git a/tests/unit/benchmark/scenarios/networking/test_iperf3.py b/tests/unit/benchmark/scenarios/networking/test_iperf3.py index 45ff1b779..331245357 100644 --- a/tests/unit/benchmark/scenarios/networking/test_iperf3.py +++ b/tests/unit/benchmark/scenarios/networking/test_iperf3.py @@ -19,6 +19,7 @@ import unittest import mock from oslo_serialization import jsonutils +from yardstick.common import utils from yardstick.benchmark.scenarios.networking import iperf3 @@ -81,7 +82,7 @@ class IperfTestCase(unittest.TestCase): sample_output = self._read_sample_output(self.output_name_tcp) mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '') - expected_result = jsonutils.loads(sample_output) + expected_result = utils.flatten_dict_key(jsonutils.loads(sample_output)) p.run(result) self.assertEqual(result, expected_result) @@ -100,7 +101,7 @@ class IperfTestCase(unittest.TestCase): sample_output = self._read_sample_output(self.output_name_tcp) mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '') - expected_result = jsonutils.loads(sample_output) + expected_result = utils.flatten_dict_key(jsonutils.loads(sample_output)) p.run(result) self.assertEqual(result, expected_result) @@ -135,7 +136,7 @@ class IperfTestCase(unittest.TestCase): sample_output = self._read_sample_output(self.output_name_udp) mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '') - expected_result = jsonutils.loads(sample_output) + expected_result = utils.flatten_dict_key(jsonutils.loads(sample_output)) p.run(result) self.assertEqual(result, expected_result) diff --git a/tests/unit/benchmark/scenarios/networking/test_ping.py b/tests/unit/benchmark/scenarios/networking/test_ping.py index 5269309c2..06353249a 100644 --- a/tests/unit/benchmark/scenarios/networking/test_ping.py +++ b/tests/unit/benchmark/scenarios/networking/test_ping.py @@ -45,7 +45,7 @@ class PingTestCase(unittest.TestCase): mock_ssh.SSH.from_node().execute.return_value = (0, '100', '') p.run(result) - self.assertEqual(result, {'rtt': {'ares': 100.0}}) + self.assertEqual(result, {'rtt.ares': 100.0}) @mock.patch('yardstick.benchmark.scenarios.networking.ping.ssh') def test_ping_successful_sla(self, mock_ssh): @@ -61,7 +61,7 @@ class PingTestCase(unittest.TestCase): mock_ssh.SSH.from_node().execute.return_value = (0, '100', '') p.run(result) - self.assertEqual(result, {'rtt': {'ares': 100.0}}) + self.assertEqual(result, {'rtt.ares': 100.0}) @mock.patch('yardstick.benchmark.scenarios.networking.ping.ssh') def test_ping_unsuccessful_sla(self, mock_ssh): -- cgit 1.2.3-korg