Adam Litke has uploaded a new change for review. Change subject: tests: Avoid ResourceManagerTests failures when running parallel tests ......................................................................
tests: Avoid ResourceManagerTests failures when running parallel tests In the Jenkins test environment, tests are run in parallel. ResourceManagerTests.testStressTest spawns lots of threads and can easily exceed the system limit when multiple copies are active. To prevent failures in this case, allow the test to fallback to single threaded mode when more threads cannot be created. This does mean that the test may be less rigorous when run in parallel but I don't see a better way to work around this false positive issue. The test will still be full strength when run alone. Change-Id: Ibd18d683ea3b8f72d569a6151066179ef21d3d26 Signed-off-by: Adam Litke <[email protected]> --- M tests/resourceManagerTests.py 1 file changed, 17 insertions(+), 13 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/34/12034/1 diff --git a/tests/resourceManagerTests.py b/tests/resourceManagerTests.py index c873394..58de49e 100644 --- a/tests/resourceManagerTests.py +++ b/tests/resourceManagerTests.py @@ -637,6 +637,15 @@ res.release() threadLimit.release() + def tryThread(fn, *args): + t = threading.Thread(target=fn, args=args) + try: + t.start() + except: + fn(*args) + else: + threads.append(t) + manager = self.manager rnd = Random() @@ -645,9 +654,8 @@ threads = [] for i in range(nthreads): - threadLimit.acquire() - threads.append(threading.Thread(target=register)) - threads[-1].start() + threadLimit.acquire() + tryThread(register) while len(threads) > 0: for t in threads[:]: @@ -657,18 +665,14 @@ while len(resources) > 0: while len(resources) > 1: threadLimit.acquire() - threads.append( - threading.Thread(target=releaseShared, - args=[requests.pop(), - resources.pop()])) - threads[-1].start() + req = requests.pop() + res = resources.pop() + tryThread(releaseShared, req, res) threadLimit.acquire() - threads.append( - threading.Thread(target=releaseUnknown, - args=[requests.pop(), - resources.pop()])) - threads[-1].start() + req = requests.pop() + res = resources.pop() + tryThread(releaseUnknown, req, res) def tearDown(self): manager = self.manager -- To view, visit http://gerrit.ovirt.org/12034 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibd18d683ea3b8f72d569a6151066179ef21d3d26 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Adam Litke <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
