summaryrefslogtreecommitdiffstats
path: root/tests/unit/benchmark/scenarios/networking/test_ping.py
diff options
context:
space:
mode:
authorhoujingwen <houjingwen@huawei.com>2015-10-19 15:37:06 +0800
committerHou Jingwen <houjingwen@huawei.com>2015-10-22 00:55:25 +0000
commite4e8688e0633ef22b2ff0ea8ba739313d5299ecc (patch)
tree0fee27d4e504b36e9eb24530cf85a0d33fd0b463 /tests/unit/benchmark/scenarios/networking/test_ping.py
parent9816c5aa786f7ec831c549b8ed4b5e8ef485da64 (diff)
Update sla check for scenarios
This patch modify the question that SLA check result is not complete. JIRA: YARDSTICK-172 Change-Id: I10438390baee92caf00dbfcdbdb833823ff8ce31 Signed-off-by: houjingwen <houjingwen@huawei.com>
Diffstat (limited to 'tests/unit/benchmark/scenarios/networking/test_ping.py')
-rw-r--r--tests/unit/benchmark/scenarios/networking/test_ping.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/unit/benchmark/scenarios/networking/test_ping.py b/tests/unit/benchmark/scenarios/networking/test_ping.py
index d930adcee..b2c5b9859 100644
--- a/tests/unit/benchmark/scenarios/networking/test_ping.py
+++ b/tests/unit/benchmark/scenarios/networking/test_ping.py
@@ -35,10 +35,11 @@ class PingTestCase(unittest.TestCase):
'options': {'packetsize': 200},
'ipaddr': '172.16.0.138'
}
+ result = {}
mock_ssh.SSH().execute.return_value = (0, '100', '')
- result = p.run(args)
- self.assertEqual(result, float(mock_ssh.SSH().execute.return_value[1]))
+ p.run(args, result)
+ self.assertEqual(result, {'rtt': 100.0})
@mock.patch('yardstick.benchmark.scenarios.networking.ping.ssh')
def test_ping_successful_sla(self, mock_ssh):
@@ -50,10 +51,11 @@ class PingTestCase(unittest.TestCase):
'ipaddr': '172.16.0.138',
'sla': {'max_rtt': 150}
}
+ result = {}
mock_ssh.SSH().execute.return_value = (0, '100', '')
- result = p.run(args)
- self.assertEqual(result, float(mock_ssh.SSH().execute.return_value[1]))
+ p.run(args, result)
+ self.assertEqual(result, {'rtt': 100.0})
@mock.patch('yardstick.benchmark.scenarios.networking.ping.ssh')
def test_ping_unsuccessful_sla(self, mock_ssh):
@@ -65,9 +67,10 @@ class PingTestCase(unittest.TestCase):
'ipaddr': '172.16.0.138',
'sla': {'max_rtt': 50}
}
+ result = {}
mock_ssh.SSH().execute.return_value = (0, '100', '')
- self.assertRaises(AssertionError, p.run, args)
+ self.assertRaises(AssertionError, p.run, args, result)
@mock.patch('yardstick.benchmark.scenarios.networking.ping.ssh')
def test_ping_unsuccessful_script_error(self, mock_ssh):
@@ -79,9 +82,10 @@ class PingTestCase(unittest.TestCase):
'ipaddr': '172.16.0.138',
'sla': {'max_rtt': 50}
}
+ result = {}
mock_ssh.SSH().execute.return_value = (1, '', 'FOOBAR')
- self.assertRaises(RuntimeError, p.run, args)
+ self.assertRaises(RuntimeError, p.run, args, result)
def main():