Browse Source

AMBARI-12027 ambari-server unit tests: HDP stack test suite freezes on test error/failure

Avoided waiting on the results queue
Florian Barca 10 years ago
parent
commit
53969a5304
1 changed files with 14 additions and 5 deletions
  1. 14 5
      ambari-server/src/test/python/unitTests.py

+ 14 - 5
ambari-server/src/test/python/unitTests.py

@@ -20,6 +20,7 @@ import unittest
 import multiprocessing
 import multiprocessing
 import os
 import os
 import sys
 import sys
+from Queue import Empty
 from random import shuffle
 from random import shuffle
 import fnmatch
 import fnmatch
 import tempfile
 import tempfile
@@ -187,11 +188,19 @@ def main():
                                             executor_result)
                                             executor_result)
           )
           )
     process.start()
     process.start()
-    process.join()
-    #for pretty output
-    sys.stdout.flush()
-    sys.stderr.flush()
-    variant_result = executor_result.get()
+    while process.is_alive():
+      process.join(10)
+
+      #for pretty output
+      sys.stdout.flush()
+      sys.stderr.flush()
+
+      try:
+        variant_result = executor_result.get_nowait()
+        break
+      except Empty as ex:
+        pass
+
     test_runs += variant_result['tests_run']
     test_runs += variant_result['tests_run']
     test_errors.extend(variant_result['errors'])
     test_errors.extend(variant_result['errors'])
     test_failures.extend(variant_result['failures'])
     test_failures.extend(variant_result['failures'])