Merge "HA testcase containerized Compass support"
[yardstick.git] / tests / unit / benchmark / runner / test_base.py
index 7880fe5..0313ef8 100644 (file)
@@ -13,17 +13,18 @@ from __future__ import print_function
 from __future__ import absolute_import
 
 import unittest
-import multiprocessing
 import time
 
+from mock import mock
+
 from yardstick.benchmark.runners.iteration import IterationRunner
 
 
 class RunnerTestCase(unittest.TestCase):
 
-    def test_get_output(self):
-        queue = multiprocessing.Queue()
-        runner = IterationRunner({}, queue)
+    @mock.patch("yardstick.benchmark.runners.iteration.multiprocessing")
+    def test_get_output(self, mock_process):
+        runner = IterationRunner({})
         runner.output_queue.put({'case': 'opnfv_yardstick_tc002'})
         runner.output_queue.put({'criteria': 'PASS'})
 
@@ -32,7 +33,10 @@ class RunnerTestCase(unittest.TestCase):
             'criteria': 'PASS'
         }
 
-        time.sleep(1)
+        for retries in range(1000):
+            time.sleep(0.01)
+            if not runner.output_queue.empty():
+                break
         actual_result = runner.get_output()
         self.assertEqual(idle_result, actual_result)