From 66c5efdd1705281abb57dcb14fff502ad125c0c1 Mon Sep 17 00:00:00 2001 From: Miikka Koistinen Date: Tue, 12 Jun 2018 16:19:16 +0300 Subject: Refactor remote command execution in pktgen_dpdk PktgenDPDKLatency.run will raise a RuntimeError if a remote command fails. This commit makes it use the already existing exception raising mechanism in yardstick's ssh client. JIRA: YARDSTICK-1166 Change-Id: I3a3c7691399044b174f5d040c015c9b907b2fe5d Signed-off-by: Miikka Koistinen --- .../benchmark/scenarios/networking/test_pktgen_dpdk.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'yardstick/tests/unit/benchmark/scenarios/networking') diff --git a/yardstick/tests/unit/benchmark/scenarios/networking/test_pktgen_dpdk.py b/yardstick/tests/unit/benchmark/scenarios/networking/test_pktgen_dpdk.py index b141591f7..bcd417830 100644 --- a/yardstick/tests/unit/benchmark/scenarios/networking/test_pktgen_dpdk.py +++ b/yardstick/tests/unit/benchmark/scenarios/networking/test_pktgen_dpdk.py @@ -165,7 +165,7 @@ class PktgenDPDKLatencyTestCase(unittest.TestCase): self.mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '') self.assertRaises(y_exc.SLAValidationError, p.run, result) - def test_pktgen_dpdk_unsuccessful_script_error(self): + def test_pktgen_dpdk_run_unsuccessful_get_port_mac(self): args = { 'options': {'packetsize': 60}, @@ -177,3 +177,19 @@ class PktgenDPDKLatencyTestCase(unittest.TestCase): self.mock_ssh.SSH.from_node().execute.return_value = (1, '', 'FOOBAR') self.assertRaises(RuntimeError, p.run, result) + + def test_pktgen_dpdk_run_unsuccessful_script_error(self): + args = { + 'options': {'packetsize': 60} + } + + p = pktgen_dpdk.PktgenDPDKLatency(args, self.ctx) + + self.mock_ssh.SSH.from_node().execute.side_effect = ((0, '', ''), + (0, '', ''), + (0, '', ''), + (0, '', ''), + (0, '', ''), + y_exc.SSHError) + self.assertRaises(y_exc.SSHError, p.run, {}) + self.assertEqual(self.mock_ssh.SSH.from_node().execute.call_count, 6) -- cgit 1.2.3-korg