Code Review
/
yardstick.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "HA testcase containerized Compass support"
[yardstick.git]
/
tests
/
unit
/
benchmark
/
scenarios
/
networking
/
test_pktgen_dpdk.py
diff --git
a/tests/unit/benchmark/scenarios/networking/test_pktgen_dpdk.py
b/tests/unit/benchmark/scenarios/networking/test_pktgen_dpdk.py
index
496ee77
..
b4b8752
100644
(file)
--- a/
tests/unit/benchmark/scenarios/networking/test_pktgen_dpdk.py
+++ b/
tests/unit/benchmark/scenarios/networking/test_pktgen_dpdk.py
@@
-16,9
+16,11
@@
import unittest
import mock
import mock
+import yardstick.common.utils as utils
from yardstick.benchmark.scenarios.networking import pktgen_dpdk
from yardstick.benchmark.scenarios.networking import pktgen_dpdk
+@mock.patch('yardstick.benchmark.scenarios.networking.pktgen_dpdk.time')
@mock.patch('yardstick.benchmark.scenarios.networking.pktgen_dpdk.ssh')
class PktgenDPDKLatencyTestCase(unittest.TestCase):
@mock.patch('yardstick.benchmark.scenarios.networking.pktgen_dpdk.ssh')
class PktgenDPDKLatencyTestCase(unittest.TestCase):
@@
-37,7
+39,7
@@
class PktgenDPDKLatencyTestCase(unittest.TestCase):
}
}
}
}
- def test_pktgen_dpdk_successful_setup(self, mock_ssh):
+ def test_pktgen_dpdk_successful_setup(self, mock_ssh
, mock_time
):
args = {
'options': {'packetsize': 60},
args = {
'options': {'packetsize': 60},
@@
-50,7
+52,7
@@
class PktgenDPDKLatencyTestCase(unittest.TestCase):
self.assertIsNotNone(p.client)
self.assertEqual(p.setup_done, True)
self.assertIsNotNone(p.client)
self.assertEqual(p.setup_done, True)
- def test_pktgen_dpdk_successful_get_port_ip(self, mock_ssh):
+ def test_pktgen_dpdk_successful_get_port_ip(self, mock_ssh
, mock_time
):
args = {
'options': {'packetsize': 60},
args = {
'options': {'packetsize': 60},
@@
-60,13
+62,12
@@
class PktgenDPDKLatencyTestCase(unittest.TestCase):
mock_ssh.SSH.from_node().execute.return_value = (0, '', '')
mock_ssh.SSH.from_node().execute.return_value = (0, '', '')
-
p
.get_port_ip(p.server, "eth1")
+
utils
.get_port_ip(p.server, "eth1")
mock_ssh.SSH.from_node().execute.assert_called_with(
mock_ssh.SSH.from_node().execute.assert_called_with(
- "ifconfig eth1 |grep 'inet addr' |awk '{print $2}' \
- |cut -d ':' -f2 ")
+ "ifconfig eth1 |grep 'inet addr' |awk '{print $2}' |cut -d ':' -f2 ")
- def test_pktgen_dpdk_unsuccessful_get_port_ip(self, mock_ssh):
+ def test_pktgen_dpdk_unsuccessful_get_port_ip(self, mock_ssh
, mock_time
):
args = {
'options': {'packetsize': 60},
args = {
'options': {'packetsize': 60},
@@
-76,9
+77,9
@@
class PktgenDPDKLatencyTestCase(unittest.TestCase):
p.server = mock_ssh.SSH.from_node()
mock_ssh.SSH.from_node().execute.return_value = (1, '', 'FOOBAR')
p.server = mock_ssh.SSH.from_node()
mock_ssh.SSH.from_node().execute.return_value = (1, '', 'FOOBAR')
- self.assertRaises(RuntimeError,
p
.get_port_ip, p.server, "eth1")
+ self.assertRaises(RuntimeError,
utils
.get_port_ip, p.server, "eth1")
- def test_pktgen_dpdk_successful_get_port_mac(self, mock_ssh):
+ def test_pktgen_dpdk_successful_get_port_mac(self, mock_ssh
, mock_time
):
args = {
'options': {'packetsize': 60},
args = {
'options': {'packetsize': 60},
@@
-88,12
+89,12
@@
class PktgenDPDKLatencyTestCase(unittest.TestCase):
mock_ssh.SSH.from_node().execute.return_value = (0, '', '')
mock_ssh.SSH.from_node().execute.return_value = (0, '', '')
-
p
.get_port_mac(p.server, "eth1")
+
utils
.get_port_mac(p.server, "eth1")
mock_ssh.SSH.from_node().execute.assert_called_with(
"ifconfig |grep HWaddr |grep eth1 |awk '{print $5}' ")
mock_ssh.SSH.from_node().execute.assert_called_with(
"ifconfig |grep HWaddr |grep eth1 |awk '{print $5}' ")
- def test_pktgen_dpdk_unsuccessful_get_port_mac(self, mock_ssh):
+ def test_pktgen_dpdk_unsuccessful_get_port_mac(self, mock_ssh
, mock_time
):
args = {
'options': {'packetsize': 60},
args = {
'options': {'packetsize': 60},
@@
-103,9
+104,9
@@
class PktgenDPDKLatencyTestCase(unittest.TestCase):
p.server = mock_ssh.SSH.from_node()
mock_ssh.SSH.from_node().execute.return_value = (1, '', 'FOOBAR')
p.server = mock_ssh.SSH.from_node()
mock_ssh.SSH.from_node().execute.return_value = (1, '', 'FOOBAR')
- self.assertRaises(RuntimeError,
p
.get_port_mac, p.server, "eth1")
+ self.assertRaises(RuntimeError,
utils
.get_port_mac, p.server, "eth1")
- def test_pktgen_dpdk_successful_no_sla(self, mock_ssh):
+ def test_pktgen_dpdk_successful_no_sla(self, mock_ssh
, mock_time
):
args = {
'options': {'packetsize': 60},
args = {
'options': {'packetsize': 60},
@@
-124,7
+125,7
@@
class PktgenDPDKLatencyTestCase(unittest.TestCase):
delta = result['avg_latency'] - 132
self.assertLessEqual(delta, 1)
delta = result['avg_latency'] - 132
self.assertLessEqual(delta, 1)
- def test_pktgen_dpdk_successful_sla(self, mock_ssh):
+ def test_pktgen_dpdk_successful_sla(self, mock_ssh
, mock_time
):
args = {
'options': {'packetsize': 60},
args = {
'options': {'packetsize': 60},
@@
-141,7
+142,7
@@
class PktgenDPDKLatencyTestCase(unittest.TestCase):
self.assertEqual(result, {"avg_latency": 100})
self.assertEqual(result, {"avg_latency": 100})
- def test_pktgen_dpdk_unsuccessful_sla(self, mock_ssh):
+ def test_pktgen_dpdk_unsuccessful_sla(self, mock_ssh
, mock_time
):
args = {
'options': {'packetsize': 60},
args = {
'options': {'packetsize': 60},
@@
-158,7
+159,7
@@
class PktgenDPDKLatencyTestCase(unittest.TestCase):
mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '')
self.assertRaises(AssertionError, p.run, result)
mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '')
self.assertRaises(AssertionError, p.run, result)
- def test_pktgen_dpdk_unsuccessful_script_error(self, mock_ssh):
+ def test_pktgen_dpdk_unsuccessful_script_error(self, mock_ssh
, mock_time
):
args = {
'options': {'packetsize': 60},
args = {
'options': {'packetsize': 60},