diff --git a/tests/e2e/features/authorized_noop.feature b/tests/e2e/features/authorized_noop.feature index 9f04f7d4..62edb9bf 100644 --- a/tests/e2e/features/authorized_noop.feature +++ b/tests/e2e/features/authorized_noop.feature @@ -2,8 +2,6 @@ Feature: Authorized endpoint API tests for the noop authentication module Background: Given The service is started locally - And REST API service hostname is localhost - And REST API service port is 8080 And REST API service prefix is /v1 Scenario: Check if the authorized endpoint works fine when user_id and auth header are not provided diff --git a/tests/e2e/features/authorized_noop_token.feature b/tests/e2e/features/authorized_noop_token.feature index d324f977..1169c609 100644 --- a/tests/e2e/features/authorized_noop_token.feature +++ b/tests/e2e/features/authorized_noop_token.feature @@ -3,8 +3,6 @@ Feature: Authorized endpoint API tests for the noop-with-token authentication mo Background: Given The service is started locally - And REST API service hostname is localhost - And REST API service port is 8080 And REST API service prefix is /v1 Scenario: Check if the authorized endpoint fails when user_id and auth header are not provided diff --git a/tests/e2e/features/conversations.feature b/tests/e2e/features/conversations.feature index 31e2235f..dfbea8fe 100644 --- a/tests/e2e/features/conversations.feature +++ b/tests/e2e/features/conversations.feature @@ -3,8 +3,6 @@ Feature: conversations endpoint API tests Background: Given The service is started locally - And REST API service hostname is localhost - And REST API service port is 8080 And REST API service prefix is /v1 diff --git a/tests/e2e/features/environment.py b/tests/e2e/features/environment.py index f3d49f19..1fb031f0 100644 --- a/tests/e2e/features/environment.py +++ b/tests/e2e/features/environment.py @@ -10,6 +10,7 @@ import requests import subprocess import time +import os from behave.model import Scenario, Feature from behave.runner import Context @@ -21,14 +22,16 @@ ) -def _fetch_models_from_service(hostname: str = "localhost", port: int = 8080) -> dict: +def _fetch_models_from_service() -> dict: """Query /v1/models endpoint and return first LLM model. Returns: Dict with model_id and provider_id, or empty dict if unavailable """ try: - url = f"http://{hostname}:{port}/v1/models" + host_env = os.getenv("E2E_LSC_HOSTNAME", "localhost") + port_env = os.getenv("E2E_LSC_PORT", "8080") + url = f"http://{host_env}:{port_env}/v1/models" response = requests.get(url, timeout=5) response.raise_for_status() data = response.json() @@ -105,7 +108,7 @@ def after_scenario(context: Context, scenario: Scenario) -> None: "llama-stack", "curl", "-f", - "http://localhost:8321/v1/health", + f"http://{context.hostname_llama}:{context.port_llama}/v1/health", ], capture_output=True, timeout=5, @@ -155,7 +158,7 @@ def after_feature(context: Context, feature: Feature) -> None: if "Feedback" in feature.tags: print(context.feedback_conversations) for conversation_id in context.feedback_conversations: - url = f"http://localhost:8080/v1/conversations/{conversation_id}" + url = f"http://{context.hostname}:{context.port}/v1/conversations/{conversation_id}" headers = context.auth_headers if hasattr(context, "auth_headers") else {} response = requests.delete(url, headers=headers) assert response.status_code == 200, url diff --git a/tests/e2e/features/feedback.feature b/tests/e2e/features/feedback.feature index 5e8edfd3..90d172e8 100644 --- a/tests/e2e/features/feedback.feature +++ b/tests/e2e/features/feedback.feature @@ -4,8 +4,6 @@ Feature: feedback endpoint API tests Background: Given The service is started locally - And REST API service hostname is localhost - And REST API service port is 8080 And REST API service prefix is /v1 And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva diff --git a/tests/e2e/features/health.feature b/tests/e2e/features/health.feature index 5898f81f..5d47c0be 100644 --- a/tests/e2e/features/health.feature +++ b/tests/e2e/features/health.feature @@ -3,8 +3,6 @@ Feature: REST API tests Background: Given The service is started locally - And REST API service hostname is localhost - And REST API service port is 8080 And REST API service prefix is /v1 diff --git a/tests/e2e/features/info.feature b/tests/e2e/features/info.feature index 5d2eafe0..3d266a09 100644 --- a/tests/e2e/features/info.feature +++ b/tests/e2e/features/info.feature @@ -3,8 +3,6 @@ Feature: Info tests Background: Given The service is started locally - And REST API service hostname is localhost - And REST API service port is 8080 And REST API service prefix is /v1 Scenario: Check if the OpenAPI endpoint works as expected diff --git a/tests/e2e/features/query.feature b/tests/e2e/features/query.feature index ed217556..5298431f 100644 --- a/tests/e2e/features/query.feature +++ b/tests/e2e/features/query.feature @@ -3,8 +3,6 @@ Feature: Query endpoint API tests Background: Given The service is started locally - And REST API service hostname is localhost - And REST API service port is 8080 And REST API service prefix is /v1 Scenario: Check if LLM responds properly to restrictive system prompt to sent question with different system prompt diff --git a/tests/e2e/features/rest_api.feature b/tests/e2e/features/rest_api.feature index 41b312c8..9acb7463 100644 --- a/tests/e2e/features/rest_api.feature +++ b/tests/e2e/features/rest_api.feature @@ -3,8 +3,6 @@ Feature: REST API tests Background: Given The service is started locally - And REST API service hostname is localhost - And REST API service port is 8080 And REST API service prefix is /v1 Scenario: Check if the OpenAPI endpoint works as expected diff --git a/tests/e2e/features/smoketests.feature b/tests/e2e/features/smoketests.feature index b1093d19..9d5fa0d1 100644 --- a/tests/e2e/features/smoketests.feature +++ b/tests/e2e/features/smoketests.feature @@ -3,8 +3,6 @@ Feature: Smoke tests Background: Given The service is started locally - And REST API service hostname is localhost - And REST API service port is 8080 And REST API service prefix is /v1 diff --git a/tests/e2e/features/steps/common.py b/tests/e2e/features/steps/common.py index 8add38a1..9569ab90 100644 --- a/tests/e2e/features/steps/common.py +++ b/tests/e2e/features/steps/common.py @@ -2,12 +2,17 @@ from behave import given # pyright: ignore[reportAttributeAccessIssue] from behave.runner import Context +import os @given("The service is started locally") def service_is_started_locally(context: Context) -> None: """Check the service status.""" assert context is not None + context.hostname = os.getenv("E2E_LSC_HOSTNAME", "localhost") + context.port = os.getenv("E2E_LSC_PORT", "8080") + context.hostname_llama = os.getenv("E2E_LLAMA_HOSTNAME", "localhost") + context.port_llama = os.getenv("E2E_LLAMA_PORT", "8321") @given("The system is in default state") diff --git a/tests/e2e/features/streaming_query.feature b/tests/e2e/features/streaming_query.feature index 17f9c978..c9422b4c 100644 --- a/tests/e2e/features/streaming_query.feature +++ b/tests/e2e/features/streaming_query.feature @@ -2,8 +2,6 @@ Feature: streaming_query endpoint API tests Background: Given The service is started locally - And REST API service hostname is localhost - And REST API service port is 8080 And REST API service prefix is /v1