X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/f054bc3d7d3d26962e62c2ea7c27214b08e85bb6..a68773416fa1bb1a6724f6e5b020b3a900eecd26:/services/nodemanager/tests/testutil.py diff --git a/services/nodemanager/tests/testutil.py b/services/nodemanager/tests/testutil.py index 1ee76900bf..6e134375bb 100644 --- a/services/nodemanager/tests/testutil.py +++ b/services/nodemanager/tests/testutil.py @@ -1,4 +1,7 @@ #!/usr/bin/env python +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 from __future__ import absolute_import, print_function @@ -120,7 +123,10 @@ class ActorTestMixin(object): pykka.ActorRegistry.stop_all() def stop_proxy(self, proxy): - return proxy.actor_ref.stop(timeout=self.TIMEOUT) + th = proxy.get_thread().get() + t = proxy.actor_ref.stop(timeout=self.TIMEOUT) + th.join() + return t def wait_for_assignment(self, proxy, attr_name, unassigned=None, timeout=TIMEOUT): @@ -133,11 +139,13 @@ class ActorTestMixin(object): if result is not unassigned: return result - def busywait(self, f): + def busywait(self, f, finalize=None): n = 0 - while not f() and n < 10: + while not f() and n < 20: time.sleep(.1) n += 1 + if finalize is not None: + finalize() self.assertTrue(f())