Fix waitUntilSettled nodepool race

Change cebebf0f42 closed most of a
race condition regarding determining when Zuul was settled in unit
tests.  It relies on verifying that the scheduler's cache of nodepool
requests matches ZK, and in doing so, it uses a method that retrieves
the cached request object.  But that method will perform a ZK lookup
if it encounters a cache miss.  That would make it appear the cache
is in sync when it is not.

To correct this, inspect the cache dictionary directly within the
unit tests.

Change-Id: I7914a70686fa5cf680a1a431aa15faa66c40687d
This commit is contained in:
James E. Blair 2021-09-14 14:03:31 -07:00
parent 97a76de403
commit 9107bd03c6
1 changed files with 2 additions and 2 deletions

View File

@ -5257,8 +5257,8 @@ class ZuulTestCase(BaseTestCase):
for req in self.fake_nodepool.getNodeRequests():
if req['state'] != model.STATE_FULFILLED:
return False
r2 = nodepool.zk_nodepool.getNodeRequest(req['_oid'],
cached=True)
r2 = nodepool.zk_nodepool._node_request_cache.get(
req['_oid'])
if r2 and r2.state != req['state']:
return False
if req and not r2: