summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames E. Blair <jim@acmegating.com>2022-07-02 11:14:21 -0700
committerJames E. Blair <jim@acmegating.com>2022-07-02 11:14:21 -0700
commit78953e9580120ecfe9c921bdb3f5ed9ce2936171 (patch)
tree396dbe89f789e6246010fe6dc522d9cd9955267a
parent87ea63eee39b061e6cb5e11697ac7c4df8247c6d (diff)
downloadzuul-78953e9580120ecfe9c921bdb3f5ed9ce2936171.tar.gz
Fix race is test_tenant_add_remove
Change I101fc42e29f4b376272c417ec536c17f05cb1a60 introduced a race in test_tenant_add_remove. If the test takes longer than 1 second, it will succeed, but less than the 1 second cache interval and it will fail. Correct that by disabling caching for the test. Change-Id: I313e519ab26cdbdad0cc17cd4d3489b49482f0b3
-rw-r--r--tests/unit/test_web.py2
-rwxr-xr-xzuul/web/__init__.py1
2 files changed, 3 insertions, 0 deletions
diff --git a/tests/unit/test_web.py b/tests/unit/test_web.py
index 4bbde2b41..de4835565 100644
--- a/tests/unit/test_web.py
+++ b/tests/unit/test_web.py
@@ -1344,6 +1344,8 @@ class TestWebMultiTenant(BaseTestWeb):
def test_tenant_add_remove(self):
"Test that tenants are correctly added/removed to/from the layout"
+ # Disable tenant list caching
+ self.web.web.api.cache_expiry = 0
resp = self.get_url("api/tenants")
data = resp.json()
self.assertEqual(sorted(d["name"] for d in data),
diff --git a/zuul/web/__init__.py b/zuul/web/__init__.py
index 01f7dd33d..f06dd0b52 100755
--- a/zuul/web/__init__.py
+++ b/zuul/web/__init__.py
@@ -1845,6 +1845,7 @@ class ZuulWeb(object):
route_map = cherrypy.dispatch.RoutesDispatcher()
api = ZuulWebAPI(self)
+ self.api = api
route_map.connect('api', '/api',
controller=api, action='index')
route_map.connect('api', '/api/info',