Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions tests/profiling_v2/test_gunicorn.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,22 @@ def _test_gunicorn(gunicorn, tmp_path, monkeypatch, *args):

debug_print("Creating gunicorn workers")
# DEV: We only start 1 worker to simplify the test
proc = gunicorn("-w", "1", *args)
# Wait for the workers to start
time.sleep(5)
for i in range(5):
proc = gunicorn("-w", "1", *args)

if proc.poll() is not None:
# Wait for the workers to start
time.sleep(10)

if proc.poll() is not None:
debug_print(f"Gunicorn process exited prematurely (return code: {proc.returncode}), retrying ({i + 1}/5)")
debug_print(f"Output from gunicorn process:\n{proc.stdout.read().decode()}")

# Try again
proc.kill()
continue

break
else:
pytest.fail("Gunicorn failed to start")

debug_print("Making request to gunicorn server")
Expand Down
Loading