Skip to content

Commit 2c6962f

Browse files
committed
fix loop error check
1 parent 4ecf9dc commit 2c6962f

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

tests/e2e/features/environment.py

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,25 @@ def after_scenario(context: Context, scenario: Scenario) -> None:
4848

4949
# Check if it's healthy
5050
for attempt in range(6): # Try for 30 seconds
51-
result = subprocess.run(
52-
[
53-
"docker",
54-
"exec",
55-
"llama-stack",
56-
"curl",
57-
"-f",
58-
"http://localhost:8321/v1/health",
59-
],
60-
capture_output=True,
61-
timeout=5,
62-
check=True,
63-
)
64-
if result.returncode == 0:
65-
print("✓ Llama Stack connection restored successfully")
66-
break
51+
try:
52+
result = subprocess.run(
53+
[
54+
"docker",
55+
"exec",
56+
"llama-stack",
57+
"curl",
58+
"-f",
59+
"http://localhost:8321/v1/health",
60+
],
61+
capture_output=True,
62+
timeout=5,
63+
check=True,
64+
)
65+
if result.returncode == 0:
66+
print("✓ Llama Stack connection restored successfully")
67+
break
68+
except subprocess.TimeoutExpired:
69+
print(f"⏱Health check timed out on attempt {attempt + 1}/6")
6770

6871
if attempt < 5:
6972
print(
@@ -77,7 +80,7 @@ def after_scenario(context: Context, scenario: Scenario) -> None:
7780

7881
except subprocess.CalledProcessError as e:
7982
print(f"Warning: Could not restore Llama Stack connection: {e}")
80-
83+
8184

8285
def before_feature(context: Context, feature: Scenario) -> None:
8386
"""Run before each feature file is exercised."""

0 commit comments

Comments
 (0)