Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix loop #744

Merged
merged 1 commit into from
Jul 17, 2024
Merged
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
36 changes: 28 additions & 8 deletions test/workspace_container_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,48 @@ def ready():

def wait_for_auth():
print("waiting for auth service...")
for t in WAIT_TIMES:

attempt = 1
max_attempts = len(WAIT_TIMES) + 1
while attempt <= max_attempts:
print(f"Attempt {attempt} of {max_attempts}")
try:
res = requests.get(AUTH_URL)
res.raise_for_status()
return
except Exception as e:
print(f"Failed to connect to auth, waiting {t} sec and trying again:\n\t{e}")
time.sleep(t)
raise Exception(f"Couldn't connect to the auth after {len(WAIT_TIMES)} attempts")
if attempt < max_attempts:
t = WAIT_TIMES[attempt - 1]
print(
f"Failed to connect to auth, waiting {t} sec "
f"and trying again:\n\t{e}"
)
time.sleep(t)
attempt += 1
raise Exception(f"Couldn't connect to the auth after {max_attempts} attempts")


def wait_for_ws():
print("waiting for workspace service...")

attempt = 1
max_attempts = len(WAIT_TIMES) + 1
ws = Workspace(WS_URL)
for t in WAIT_TIMES:
while attempt <= max_attempts:
print(f"Attempt {attempt} of {max_attempts}")
try:
ws.ver()
return
except Exception as e:
print(f"Failed to connect to workspace, waiting {t} sec and trying again:\n\t{e}")
time.sleep(t)
raise Exception(f"Couldn't connect to the workspace after {len(WAIT_TIMES)} attempts")
if attempt < max_attempts:
t = WAIT_TIMES[attempt - 1]
print(
f"Failed to connect to workspace, waiting {t} sec "
f"and trying again:\n\t{e}"
)
time.sleep(t)
attempt += 1
raise Exception(f"Couldn't connect to the workspace after {max_attempts} attempts")


def test_create_user_create_workspace(ready):
Expand Down
Loading