Skip to content

Commit

Permalink
Attempt to make itest spoolman up check more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
Donkie committed Aug 7, 2024
1 parent efa9361 commit 515722b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests_integration/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,19 @@ def get_db_type() -> DbType:
return db_type


@pytest.fixture(scope="session", autouse=True)
def _wait_for_server(): # noqa: ANN202
def pytest_sessionstart(_: pytest.Session) -> None:
"""Wait for the server to start up."""
start_time = time.time()
while True:
try:
print("pytest: Waiting for spoolman to be available...") # noqa: T201
response = httpx.get(URL, timeout=1)
response.raise_for_status()
print("pytest: Spoolman now seems to be up!") # noqa: T201
except httpx.HTTPError: # noqa: PERF203
if time.time() - start_time > TIMEOUT:
raise
time.sleep(0.5)
else:
break

Expand Down

0 comments on commit 515722b

Please sign in to comment.