aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRoss Brattain <ross.b.brattain@intel.com>2017-07-12 21:05:56 -0700
committerRoss Brattain <ross.b.brattain@intel.com>2017-07-13 12:51:39 -0700
commite8ba3c33321765eaccea0b346a1603dfaca58d81 (patch)
tree2e4d612fc70b6eab02cfa3ba5b36a42b1696680a /tests
parent49d358550209ab39bf618d8b226f655a0b54d13f (diff)
test_pktgen_dpdk_throughput: speedup unittest, mock time.sleep()
Change-Id: I74bbdee1a503ef9bad32db7d4444921f6730f465 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/benchmark/scenarios/networking/test_pktgen_dpdk_throughput.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/unit/benchmark/scenarios/networking/test_pktgen_dpdk_throughput.py b/tests/unit/benchmark/scenarios/networking/test_pktgen_dpdk_throughput.py
index 0178165f8..d34097008 100644
--- a/tests/unit/benchmark/scenarios/networking/test_pktgen_dpdk_throughput.py
+++ b/tests/unit/benchmark/scenarios/networking/test_pktgen_dpdk_throughput.py
@@ -20,6 +20,7 @@ from yardstick.benchmark.scenarios.networking import pktgen_dpdk_throughput
@mock.patch('yardstick.benchmark.scenarios.networking.pktgen_dpdk_throughput.ssh')
+@mock.patch('yardstick.benchmark.scenarios.networking.pktgen_dpdk_throughput.time')
class PktgenDPDKTestCase(unittest.TestCase):
def setUp(self):
@@ -36,7 +37,7 @@ class PktgenDPDKTestCase(unittest.TestCase):
}
}
- def test_pktgen_dpdk_throughput_successful_setup(self, mock_ssh):
+ def test_pktgen_dpdk_throughput_successful_setup(self, mock__time, mock_ssh):
args = {
'options': {'packetsize': 60},
}
@@ -48,7 +49,7 @@ class PktgenDPDKTestCase(unittest.TestCase):
self.assertIsNotNone(p.client)
self.assertEqual(p.setup_done, True)
- def test_pktgen_dpdk_throughput_successful_no_sla(self, mock_ssh):
+ def test_pktgen_dpdk_throughput_successful_no_sla(self, mock__time, mock_ssh):
args = {
'options': {'packetsize': 60, 'number_of_ports': 10},
}
@@ -74,7 +75,7 @@ class PktgenDPDKTestCase(unittest.TestCase):
expected_result["packetsize"] = 60
self.assertEqual(result, expected_result)
- def test_pktgen_dpdk_throughput_successful_sla(self, mock_ssh):
+ def test_pktgen_dpdk_throughput_successful_sla(self, mock__time, mock_ssh):
args = {
'options': {'packetsize': 60, 'number_of_ports': 10},
'sla': {'max_ppm': 10000}
@@ -100,7 +101,7 @@ class PktgenDPDKTestCase(unittest.TestCase):
expected_result["packetsize"] = 60
self.assertEqual(result, expected_result)
- def test_pktgen_dpdk_throughput_unsuccessful_sla(self, mock_ssh):
+ def test_pktgen_dpdk_throughput_unsuccessful_sla(self, mock__time, mock_ssh):
args = {
'options': {'packetsize': 60, 'number_of_ports': 10},
'sla': {'max_ppm': 1000}
@@ -121,7 +122,7 @@ class PktgenDPDKTestCase(unittest.TestCase):
mock_ssh.SSH().execute.return_value = (0, sample_output, '')
self.assertRaises(AssertionError, p.run, result)
- def test_pktgen_dpdk_throughput_unsuccessful_script_error(self, mock_ssh):
+ def test_pktgen_dpdk_throughput_unsuccessful_script_error(self, mock__time, mock_ssh):
args = {
'options': {'packetsize': 60, 'number_of_ports': 10},
'sla': {'max_ppm': 1000}
@@ -136,7 +137,7 @@ class PktgenDPDKTestCase(unittest.TestCase):
mock_ssh.SSH().execute.return_value = (1, '', 'FOOBAR')
self.assertRaises(RuntimeError, p.run, result)
- def test_pktgen_dpdk_throughput_is_dpdk_setup(self, mock_ssh):
+ def test_pktgen_dpdk_throughput_is_dpdk_setup(self, mock__time, mock_ssh):
args = {
'options': {'packetsize': 60},
}
@@ -150,7 +151,7 @@ class PktgenDPDKTestCase(unittest.TestCase):
mock_ssh.SSH().execute.assert_called_with(
"ip a | grep eth1 2>/dev/null")
- def test_pktgen_dpdk_throughput_dpdk_setup(self, mock_ssh):
+ def test_pktgen_dpdk_throughput_dpdk_setup(self, mock__time, mock_ssh):
args = {
'options': {'packetsize': 60},
}
@@ -164,7 +165,7 @@ class PktgenDPDKTestCase(unittest.TestCase):
self.assertEqual(p.dpdk_setup_done, True)
- def test_pktgen_dpdk_throughput_dpdk_get_result(self, mock_ssh):
+ def test_pktgen_dpdk_throughput_dpdk_get_result(self, mock__time, mock_ssh):
args = {
'options': {'packetsize': 60},
}