diff --git a/tests/base.py b/tests/base.py index fc3e4ebff8..ebcb6c7a79 100644 --- a/tests/base.py +++ b/tests/base.py @@ -3716,7 +3716,6 @@ class ZuulTestCase(BaseTestCase): self.fake_github.github_event_connector._event_forward_queue) self.merge_server = None - self.nodepool = sched_app.sched.nodepool self.zk = sched_app.sched.zk # Cleanups are run in reverse order @@ -4323,11 +4322,12 @@ class ZuulTestCase(BaseTestCase): return False return True - def areAllNodeRequestsComplete(self): + def __areAllNodeRequestsComplete(self, matcher) -> bool: if self.fake_nodepool.paused: return True - if self.nodepool.requests: - return False + for app in self.scheds.filter(matcher): + if app.sched.nodepool.requests: + return False return True def __areAllMergeJobsWaiting(self, matcher) -> bool: @@ -4375,7 +4375,7 @@ class ZuulTestCase(BaseTestCase): self.log.error("All builds reported: %s" % (self.__haveAllBuildsReported(matcher),)) self.log.error("All requests completed: %s" % - (self.areAllNodeRequestsComplete(),)) + (self.__areAllNodeRequestsComplete(matcher),)) for app in self.scheds.filter(matcher): self.log.error("[Sched: %s] Merge client jobs: %s" % (app.sched, app.sched.merger.jobs,)) @@ -4393,7 +4393,7 @@ class ZuulTestCase(BaseTestCase): if (self.__areAllMergeJobsWaiting(matcher) and self.__haveAllBuildsReported(matcher) and self.__areAllBuildsWaiting(matcher) and - self.areAllNodeRequestsComplete() and + self.__areAllNodeRequestsComplete(matcher) and all(self.eventQueuesEmpty())): # The queue empty check is placed at the end to # ensure that if a component adds an event between diff --git a/tests/unit/test_scheduler.py b/tests/unit/test_scheduler.py index dbd72a9e25..5b5f93d788 100644 --- a/tests/unit/test_scheduler.py +++ b/tests/unit/test_scheduler.py @@ -7341,14 +7341,14 @@ class TestSemaphore(ZuulTestCase): tenant.semaphore_handler.semaphores) # Simulate a single zk error in useNodeSet - orig_useNodeSet = self.nodepool.useNodeSet + orig_useNodeSet = self.scheds.first.sched.nodepool.useNodeSet def broken_use_nodeset(nodeset, build_set=None, event=None): # restore original useNodeSet - self.nodepool.useNodeSet = orig_useNodeSet + self.scheds.first.sched.nodepool.useNodeSet = orig_useNodeSet raise NoNodeError() - self.nodepool.useNodeSet = broken_use_nodeset + self.scheds.first.sched.nodepool.useNodeSet = broken_use_nodeset self.fake_gerrit.addEvent(A.getPatchsetCreatedEvent(1)) self.waitUntilSettled() @@ -7451,13 +7451,13 @@ class TestSemaphore(ZuulTestCase): self.fake_gerrit.addEvent(A.getPatchsetCreatedEvent(1)) self.waitUntilSettled() - self.assertEqual(len(self.nodepool.requests), 2) + self.assertEqual(len(self.scheds.first.sched.nodepool.requests), 2) # Now unpause nodepool to fulfill the node requests. We cannot use # waitUntilSettled here because the executor is paused. self.fake_nodepool.paused = False for _ in iterate_timeout(30, 'fulfill node requests'): - if len(self.nodepool.requests) == 0: + if len(self.scheds.first.sched.nodepool.requests) == 0: break self.assertTrue('test-semaphore' in