Skip to content

Commit 566862b

Browse files
authored
Merge pull request #1309 from radofuchs/e2e_test_fix
fix logic in e2e tests to handle all providers
2 parents d238a82 + c9848f5 commit 566862b

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

tests/e2e/features/query.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ Scenario: Check if LLM responds for query request with error for missing query
175175
{"query": "Say hello", "model": "{MODEL}", "provider":"unknown"}
176176
"""
177177
Then The status code of the response is 404
178-
And The body of the response contains Model with ID gpt-4o-mini does not exist
178+
And The body of the response contains Model with ID {MODEL} does not exist
179179

180180
@skip-in-library-mode
181181
Scenario: Check if LLM responds for query request with error for inability to connect to llama-stack

tests/e2e/features/steps/common_http.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,17 @@ def check_response_body_schema(context: Context) -> None:
165165

166166
@then("The body of the response contains {substring}")
167167
def check_response_body_contains(context: Context, substring: str) -> None:
168-
"""Check that response body contains a substring."""
168+
"""Check that response body contains a substring.
169+
170+
Supports {MODEL} and {PROVIDER} placeholders in the substring so
171+
assertions work with any configured provider (e.g. unknown-provider
172+
error message includes the actual model id).
173+
"""
169174
assert context.response is not None, "Request needs to be performed first"
175+
expected = replace_placeholders(context, substring)
170176
assert (
171-
substring in context.response.text
172-
), f"The response text '{context.response.text}' doesn't contain '{substring}'"
177+
expected in context.response.text
178+
), f"The response text '{context.response.text}' doesn't contain '{expected}'"
173179

174180

175181
@then("The body of the response is the following")

tests/e2e/features/streaming_query.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ Feature: streaming_query endpoint API tests
133133
{"query": "Say hello", "model": "{MODEL}", "provider":"unknown"}
134134
"""
135135
Then The status code of the response is 404
136-
And The body of the response contains Model with ID gpt-4o-mini does not exist
136+
And The body of the response contains Model with ID {MODEL} does not exist
137137
And The token metrics should not have changed
138138

139139
Scenario: Check if LLM responds properly when XML and JSON attachments are sent

0 commit comments

Comments
 (0)