aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/tests
diff options
context:
space:
mode:
authorAbhijit Sinha <abhijit.sinha@intel.com>2018-10-03 09:00:07 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-10-03 09:00:07 +0000
commit0ddf777a4d0621f19ad2017292b8d2c548d5e038 (patch)
tree3bc95c8d5a70c4c2b7da8a779fd85740828276d1 /yardstick/tests
parent7237241a396871d637f9906c1fc93a8587a7b726 (diff)
parent7d5ff45a3b793f5e50b4a32b2438ab11fed6c899 (diff)
Merge "NSB PROX NFVi Test does not stop after reaching expected precision"
Diffstat (limited to 'yardstick/tests')
-rw-r--r--yardstick/tests/unit/benchmark/runner/test_duration.py18
-rw-r--r--yardstick/tests/unit/benchmark/runner/test_proxduration.py2
-rw-r--r--yardstick/tests/unit/network_services/traffic_profile/test_prox_profile.py4
-rw-r--r--yardstick/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py6
4 files changed, 16 insertions, 14 deletions
diff --git a/yardstick/tests/unit/benchmark/runner/test_duration.py b/yardstick/tests/unit/benchmark/runner/test_duration.py
index d4801ef2c..fa47e96bf 100644
--- a/yardstick/tests/unit/benchmark/runner/test_duration.py
+++ b/yardstick/tests/unit/benchmark/runner/test_duration.py
@@ -97,9 +97,9 @@ class DurationRunnerTest(unittest.TestCase):
multiprocessing.Event(), mock.Mock())
self._assert_defaults__worker_run_setup_and_teardown()
- self.assertGreater(self.benchmark.pre_run_wait_time.call_count, 2)
- self.assertGreater(self.benchmark.my_method.call_count, 2)
- self.assertGreater(self.benchmark.post_run_wait_time.call_count, 2)
+ self.assertGreater(self.benchmark.pre_run_wait_time.call_count, 0)
+ self.assertGreater(self.benchmark.my_method.call_count, 0)
+ self.assertGreater(self.benchmark.post_run_wait_time.call_count, 0)
def test__worker_process_called_without_cfg(self):
scenario_cfg = {'runner': {}}
@@ -140,9 +140,9 @@ class DurationRunnerTest(unittest.TestCase):
time.sleep(0.1)
self._assert_defaults__worker_run_setup_and_teardown()
- self.assertGreater(self.benchmark.pre_run_wait_time.call_count, 2)
- self.assertGreater(self.benchmark.my_method.count, 103)
- self.assertGreater(self.benchmark.post_run_wait_time.call_count, 2)
+ self.assertGreater(self.benchmark.pre_run_wait_time.call_count, 0)
+ self.assertGreater(self.benchmark.my_method.count, 1)
+ self.assertGreater(self.benchmark.post_run_wait_time.call_count, 0)
count = 101
while not output_queue.empty():
@@ -181,9 +181,9 @@ class DurationRunnerTest(unittest.TestCase):
time.sleep(0.1)
self._assert_defaults__worker_run_setup_and_teardown()
- self.assertGreater(self.benchmark.pre_run_wait_time.call_count, 2)
- self.assertGreater(self.benchmark.my_method.count, 103)
- self.assertGreater(self.benchmark.post_run_wait_time.call_count, 2)
+ self.assertGreater(self.benchmark.pre_run_wait_time.call_count, 0)
+ self.assertGreater(self.benchmark.my_method.count, 1)
+ self.assertGreater(self.benchmark.post_run_wait_time.call_count, 0)
count = 0
while not queue.empty():
diff --git a/yardstick/tests/unit/benchmark/runner/test_proxduration.py b/yardstick/tests/unit/benchmark/runner/test_proxduration.py
index 3299c5b05..056195fd3 100644
--- a/yardstick/tests/unit/benchmark/runner/test_proxduration.py
+++ b/yardstick/tests/unit/benchmark/runner/test_proxduration.py
@@ -97,7 +97,7 @@ class ProxDurationRunnerTest(unittest.TestCase):
{}, multiprocessing.Event(), mock.Mock())
self._assert_defaults__worker_run_setup_and_teardown()
- self.assertGreater(self.benchmark.my_method.call_count, 2)
+ self.assertGreater(self.benchmark.my_method.call_count, 0)
def test__worker_process_called_without_cfg(self):
scenario_cfg = {'runner': {}}
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 cf31cc27c..11bee03a4 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
@@ -100,13 +100,13 @@ class TestProxProfile(unittest.TestCase):
profile = ProxProfile(tp_config)
- self.assertFalse(profile.done)
+ self.assertFalse(profile.done.is_set())
for _ in packet_sizes:
with self.assertRaises(NotImplementedError):
profile.execute_traffic(traffic_generator)
self.assertIsNone(profile.execute_traffic(traffic_generator))
- self.assertTrue(profile.done)
+ self.assertTrue(profile.done.is_set())
def test_bounds_iterator(self):
tp_config = {
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 3b095647c..3d6ebb25b 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
@@ -1527,14 +1527,16 @@ class TestProxResourceHelper(unittest.TestCase):
def test_run_traffic(self):
setup_helper = mock.MagicMock()
helper = prox_helpers.ProxResourceHelper(setup_helper)
- traffic_profile = mock.MagicMock(**{"done": True})
+ traffic_profile = mock.MagicMock()
+ traffic_profile.done.is_set.return_value = True
helper.run_traffic(traffic_profile)
self.assertEqual(helper._terminated.value, 1)
def test__run_traffic_once(self):
setup_helper = mock.MagicMock()
helper = prox_helpers.ProxResourceHelper(setup_helper)
- traffic_profile = mock.MagicMock(**{"done": True})
+ traffic_profile = mock.MagicMock()
+ traffic_profile.done.is_set.return_value = True
helper._run_traffic_once(traffic_profile)
self.assertEqual(helper._terminated.value, 1)