Skip to content

Commit 6844055

Browse files
authored
Merge pull request lightspeed-core#712 from radofuchs/fix_constant_hostname
fix constant hostname in e2e tests
2 parents f4f6684 + 31b2f10 commit 6844055

12 files changed

+12
-24
lines changed

tests/e2e/features/authorized_noop.feature

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ Feature: Authorized endpoint API tests for the noop authentication module
22

33
Background:
44
Given The service is started locally
5-
And REST API service hostname is localhost
6-
And REST API service port is 8080
75
And REST API service prefix is /v1
86

97
Scenario: Check if the authorized endpoint works fine when user_id and auth header are not provided

tests/e2e/features/authorized_noop_token.feature

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ Feature: Authorized endpoint API tests for the noop-with-token authentication mo
33

44
Background:
55
Given The service is started locally
6-
And REST API service hostname is localhost
7-
And REST API service port is 8080
86
And REST API service prefix is /v1
97

108
Scenario: Check if the authorized endpoint fails when user_id and auth header are not provided

tests/e2e/features/conversations.feature

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ Feature: conversations endpoint API tests
33

44
Background:
55
Given The service is started locally
6-
And REST API service hostname is localhost
7-
And REST API service port is 8080
86
And REST API service prefix is /v1
97

108

tests/e2e/features/environment.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import requests
1111
import subprocess
1212
import time
13+
import os
1314
from behave.model import Scenario, Feature
1415
from behave.runner import Context
1516

@@ -21,14 +22,16 @@
2122
)
2223

2324

24-
def _fetch_models_from_service(hostname: str = "localhost", port: int = 8080) -> dict:
25+
def _fetch_models_from_service() -> dict:
2526
"""Query /v1/models endpoint and return first LLM model.
2627
2728
Returns:
2829
Dict with model_id and provider_id, or empty dict if unavailable
2930
"""
3031
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"
3235
response = requests.get(url, timeout=5)
3336
response.raise_for_status()
3437
data = response.json()
@@ -105,7 +108,7 @@ def after_scenario(context: Context, scenario: Scenario) -> None:
105108
"llama-stack",
106109
"curl",
107110
"-f",
108-
"http://localhost:8321/v1/health",
111+
f"http://{context.hostname_llama}:{context.port_llama}/v1/health",
109112
],
110113
capture_output=True,
111114
timeout=5,
@@ -155,7 +158,7 @@ def after_feature(context: Context, feature: Feature) -> None:
155158
if "Feedback" in feature.tags:
156159
print(context.feedback_conversations)
157160
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}"
159162
headers = context.auth_headers if hasattr(context, "auth_headers") else {}
160163
response = requests.delete(url, headers=headers)
161164
assert response.status_code == 200, url

tests/e2e/features/feedback.feature

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ Feature: feedback endpoint API tests
44

55
Background:
66
Given The service is started locally
7-
And REST API service hostname is localhost
8-
And REST API service port is 8080
97
And REST API service prefix is /v1
108
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
119

tests/e2e/features/health.feature

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ Feature: REST API tests
33

44
Background:
55
Given The service is started locally
6-
And REST API service hostname is localhost
7-
And REST API service port is 8080
86
And REST API service prefix is /v1
97

108

tests/e2e/features/info.feature

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ Feature: Info tests
33

44
Background:
55
Given The service is started locally
6-
And REST API service hostname is localhost
7-
And REST API service port is 8080
86
And REST API service prefix is /v1
97

108
Scenario: Check if the OpenAPI endpoint works as expected

tests/e2e/features/query.feature

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ Feature: Query endpoint API tests
33

44
Background:
55
Given The service is started locally
6-
And REST API service hostname is localhost
7-
And REST API service port is 8080
86
And REST API service prefix is /v1
97

108
Scenario: Check if LLM responds properly to restrictive system prompt to sent question with different system prompt

tests/e2e/features/rest_api.feature

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ Feature: REST API tests
33

44
Background:
55
Given The service is started locally
6-
And REST API service hostname is localhost
7-
And REST API service port is 8080
86
And REST API service prefix is /v1
97

108
Scenario: Check if the OpenAPI endpoint works as expected

tests/e2e/features/smoketests.feature

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ Feature: Smoke tests
33

44
Background:
55
Given The service is started locally
6-
And REST API service hostname is localhost
7-
And REST API service port is 8080
86
And REST API service prefix is /v1
97

108

0 commit comments

Comments
 (0)