diff options
author | Volodymyr Mytnyk <volodymyrx.mytnyk@intel.com> | 2019-02-06 16:32:50 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2019-02-06 16:32:50 +0000 |
commit | 88c5dda9712afc71742b164905f21cfff45926fa (patch) | |
tree | 2139e77314c397410b12ff7ea216b03d3d16421a | |
parent | 628e26a7516e4cf8b7648ad81c35695dba896536 (diff) | |
parent | 1342ab2acfbdeb39fd7aaeda7455ba6c16ad9095 (diff) |
Merge "Mock time.sleep in slow tests"
4 files changed, 14 insertions, 4 deletions
diff --git a/yardstick/tests/unit/network_services/traffic_profile/test_prox_irq.py b/yardstick/tests/unit/network_services/traffic_profile/test_prox_irq.py index 59f37befa..1a9947984 100644 --- a/yardstick/tests/unit/network_services/traffic_profile/test_prox_irq.py +++ b/yardstick/tests/unit/network_services/traffic_profile/test_prox_irq.py @@ -11,6 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +import time import unittest import mock @@ -28,7 +29,8 @@ class TestProxIrqProfile(unittest.TestCase): def _stop_mocks(self): self._mock_log_info.stop() - def test_execute_1(self): + @mock.patch.object(time, 'sleep') + def test_execute_1(self, *args): tp_config = { 'traffic_profile': { }, diff --git a/yardstick/tests/unit/network_services/traffic_profile/test_prox_profile.py b/yardstick/tests/unit/network_services/traffic_profile/test_prox_profile.py index 11bee03a4..2660d4134 100644 --- a/yardstick/tests/unit/network_services/traffic_profile/test_prox_profile.py +++ b/yardstick/tests/unit/network_services/traffic_profile/test_prox_profile.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import time import unittest import mock @@ -78,7 +79,8 @@ class TestProxProfile(unittest.TestCase): profile.init(queue) self.assertIs(profile.queue, queue) - def test_execute_traffic(self): + @mock.patch.object(time, 'sleep') + def test_execute_traffic(self, *args): packet_sizes = [ 10, 100, diff --git a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py index 9a30fb9e9..742dbfe24 100644 --- a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py +++ b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py @@ -2400,6 +2400,7 @@ class TestProxProfileHelper(unittest.TestCase): with helper.traffic_context(64, 1): pass + @mock.patch.object(time, 'sleep') def test_run_test(self, *args): resource_helper = mock.MagicMock() resource_helper.step_delta = 0.4 @@ -2549,6 +2550,7 @@ class TestProxBngProfileHelper(unittest.TestCase): self.assertEqual(helper.arp_task_cores, expected_arp_task) self.assertEqual(helper._cores_tuple, expected_combined) + @mock.patch.object(time, 'sleep') def test_run_test(self, *args): resource_helper = mock.MagicMock() resource_helper.step_delta = 0.4 @@ -2675,6 +2677,7 @@ class TestProxVpeProfileHelper(unittest.TestCase): self.assertEqual(helper.inet_ports, expected_inet) self.assertEqual(helper._ports_tuple, expected_combined) + @mock.patch.object(time, 'sleep') def test_run_test(self, *args): resource_helper = mock.MagicMock() resource_helper.step_delta = 0.4 @@ -2792,6 +2795,7 @@ class TestProxlwAFTRProfileHelper(unittest.TestCase): self.assertEqual(helper.inet_ports, expected_inet) self.assertEqual(helper._ports_tuple, expected_combined) + @mock.patch.object(time, 'sleep') def test_run_test(self, *args): resource_helper = mock.MagicMock() resource_helper.step_delta = 0.4 diff --git a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py index a9fa5f3c1..7ef94c3d8 100644 --- a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py +++ b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016-2017 Intel Corporation +# Copyright (c) 2016-2018 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,6 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +import time import mock import unittest @@ -24,7 +25,8 @@ from yardstick.network_services.vnf_generic.vnf import tg_rfc2544_trex class TestTrexRfcResouceHelper(unittest.TestCase): - def test__run_traffic_once(self): + @mock.patch.object(time, 'sleep') + def test__run_traffic_once(self, *args): mock_setup_helper = mock.Mock() mock_traffic_profile = mock.Mock() mock_traffic_profile.config.duration = 3 |