|
10 | 10 | import requests |
11 | 11 | import subprocess |
12 | 12 | import time |
| 13 | +import os |
13 | 14 | from behave.model import Scenario, Feature |
14 | 15 | from behave.runner import Context |
15 | 16 |
|
|
21 | 22 | ) |
22 | 23 |
|
23 | 24 |
|
24 | | -def _fetch_models_from_service(hostname: str = "localhost", port: int = 8080) -> dict: |
| 25 | +def _fetch_models_from_service() -> dict: |
25 | 26 | """Query /v1/models endpoint and return first LLM model. |
26 | 27 |
|
27 | 28 | Returns: |
28 | 29 | Dict with model_id and provider_id, or empty dict if unavailable |
29 | 30 | """ |
30 | 31 | try: |
31 | | - url = f"http://{hostname}:{port}/v1/models" |
| 32 | + host_env = os.getenv("E2E_LSC_HOSTNAME", "localhost") |
| 33 | + port_env = os.getenv("E2E_LSC_PORT", "8080") |
| 34 | + url = f"http://{host_env}:{port_env}/v1/models" |
32 | 35 | response = requests.get(url, timeout=5) |
33 | 36 | response.raise_for_status() |
34 | 37 | data = response.json() |
@@ -105,7 +108,7 @@ def after_scenario(context: Context, scenario: Scenario) -> None: |
105 | 108 | "llama-stack", |
106 | 109 | "curl", |
107 | 110 | "-f", |
108 | | - "http://localhost:8321/v1/health", |
| 111 | + f"http://{context.hostname_llama}:{context.port_llama}/v1/health", |
109 | 112 | ], |
110 | 113 | capture_output=True, |
111 | 114 | timeout=5, |
@@ -155,7 +158,7 @@ def after_feature(context: Context, feature: Feature) -> None: |
155 | 158 | if "Feedback" in feature.tags: |
156 | 159 | print(context.feedback_conversations) |
157 | 160 | for conversation_id in context.feedback_conversations: |
158 | | - url = f"http://localhost:8080/v1/conversations/{conversation_id}" |
| 161 | + url = f"http://{context.hostname}:{context.port}/v1/conversations/{conversation_id}" |
159 | 162 | headers = context.auth_headers if hasattr(context, "auth_headers") else {} |
160 | 163 | response = requests.delete(url, headers=headers) |
161 | 164 | assert response.status_code == 200, url |
0 commit comments