From 4a28136293a210b9da725c7dc0a5f0eca37370ee Mon Sep 17 00:00:00 2001 From: Deepanshu Bhatia Date: Mon, 13 May 2019 12:52:17 +0530 Subject: Ping: Fix TypeError without SLA in timeout scenario In case of no SLA association with scenario, when the commands timeout, stdout is empty and it gives TypeError. Reverted the condition to the old one which was used before introduction of verifySLA() JIRA: YARDSTICK-1618 Change-Id: Ibd86ba7168f26ae5b15c21fd6129cc737a7038db Signed-off-by: Deepanshu Bhatia --- .../tests/unit/benchmark/scenarios/networking/test_ping.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'yardstick/tests/unit/benchmark/scenarios/networking') diff --git a/yardstick/tests/unit/benchmark/scenarios/networking/test_ping.py b/yardstick/tests/unit/benchmark/scenarios/networking/test_ping.py index 559e0599e..944202658 100644 --- a/yardstick/tests/unit/benchmark/scenarios/networking/test_ping.py +++ b/yardstick/tests/unit/benchmark/scenarios/networking/test_ping.py @@ -91,3 +91,17 @@ class PingTestCase(unittest.TestCase): mock_ssh.SSH.from_node().execute.return_value = (1, '', 'FOOBAR') self.assertRaises(RuntimeError, p.run, result) + + @mock.patch('yardstick.benchmark.scenarios.networking.ping.ssh') + def test_ping_unsuccessful_no_sla(self, mock_ssh): + + args = { + 'options': {'packetsize': 200}, + 'target': 'ares.demo' + } + result = {} + + p = ping.Ping(args, self.ctx) + + mock_ssh.SSH.from_node().execute.return_value = (0, '', '') + self.assertRaises(y_exc.SLAValidationError, p.run, result) -- cgit 1.2.3-korg