tests: make neon_fixtures a bit thinner by splitting out some pageserver related helpers (#3977)

neon_fixture is quite big and messy, lets clean it up a bit.
This commit is contained in:
Dmitry Rodionov
2023-04-07 13:47:28 +03:00
committed by GitHub
parent b1c2a6384a
commit bfeb428d1b
27 changed files with 779 additions and 779 deletions
+16
View File
@@ -278,3 +278,19 @@ def wait_until(number_of_iterations: int, interval: float, func: Fn):
continue
return res
raise Exception("timed out while waiting for %s" % func) from last_exception
def wait_while(number_of_iterations: int, interval: float, func):
"""
Wait until 'func' returns false, or throws an exception.
"""
for i in range(number_of_iterations):
try:
if not func():
return
log.info("waiting for %s iteration %s failed", func, i + 1)
time.sleep(interval)
continue
except Exception:
return
raise Exception("timed out while waiting for %s" % func)