66
77import json
88import re
9+ import os
910
1011import pytest
1112import requests
@@ -53,6 +54,7 @@ def construct_response_from_streamed_events(events: dict) -> str:
5354 return response
5455
5556
57+ @pytest .mark .skip_with_lcore
5658def test_invalid_question ():
5759 """Check the endpoint POST method for invalid question."""
5860 with metrics_utils .RestAPICallCounterChecker (
@@ -98,7 +100,8 @@ def test_invalid_question_without_conversation_id():
98100 # new conversation ID should be generated
99101 assert events [0 ]["event" ] == "start"
100102 assert events [0 ]["data" ]
101- assert suid .check_suid (events [0 ]["data" ]["conversation_id" ])
103+ if os .getenv ("LCORE" , "False" ).lower () not in ("true" , "1" , "t" ):
104+ assert suid .check_suid (events [0 ]["data" ]["conversation_id" ])
102105
103106
104107def test_query_call_without_payload ():
@@ -139,6 +142,7 @@ def test_query_call_with_improper_payload():
139142 assert "missing" in response .text
140143
141144
145+ @pytest .mark .skip_with_lcore
142146def test_valid_question_improper_conversation_id () -> None :
143147 """Check the endpoint with POST HTTP method for improper conversation ID."""
144148 with metrics_utils .RestAPICallCounterChecker (
@@ -163,6 +167,7 @@ def test_valid_question_improper_conversation_id() -> None:
163167 assert json_response == expected_response
164168
165169
170+ @pytest .mark .skip_with_lcore
166171def test_too_long_question () -> None :
167172 """Check the endpoint with too long question."""
168173 # let's make the query really large, larger that context window size
@@ -200,11 +205,24 @@ def test_valid_question() -> None:
200205 with metrics_utils .RestAPICallCounterChecker (
201206 pytest .metrics_client , STREAMING_QUERY_ENDPOINT
202207 ):
203- cid = suid .get_suid ()
204- response = post_with_defaults (
205- STREAMING_QUERY_ENDPOINT ,
206- json = {"conversation_id" : cid , "query" : "what is kubernetes?" },
207- )
208+ if os .getenv ("LCORE" , "False" ).lower () not in ("true" , "1" , "t" ):
209+ cid = suid .get_suid ()
210+ response = pytest .client .post (
211+ STREAMING_QUERY_ENDPOINT ,
212+ json = {
213+ "conversation_id" : cid ,
214+ "query" : "what is kubernetes in the context of OpenShift?" ,
215+ },
216+ timeout = test_api .LLM_REST_API_TIMEOUT ,
217+ )
218+ else :
219+ response = pytest .client .post (
220+ STREAMING_QUERY_ENDPOINT ,
221+ json = {
222+ "query" : "what is kubernetes in the context of OpenShift?" ,
223+ },
224+ timeout = test_api .LLM_REST_API_TIMEOUT ,
225+ )
208226 assert response .status_code == requests .codes .ok
209227
210228 response_utils .check_content_type (response , constants .MEDIA_TYPE_TEXT )
@@ -244,6 +262,7 @@ def test_ocp_docs_version_same_as_cluster_version() -> None:
244262 )
245263
246264
265+ @pytest .mark .skip_with_lcore
247266def test_valid_question_tokens_counter () -> None :
248267 """Check how the tokens counter are updated accordingly."""
249268 model , provider = metrics_utils .get_enabled_model_and_provider (
@@ -264,6 +283,7 @@ def test_valid_question_tokens_counter() -> None:
264283 response_utils .check_content_type (response , constants .MEDIA_TYPE_TEXT )
265284
266285
286+ @pytest .mark .skip_with_lcore
267287def test_invalid_question_tokens_counter () -> None :
268288 """Check how the tokens counter are updated accordingly."""
269289 model , provider = metrics_utils .get_enabled_model_and_provider (
@@ -284,6 +304,7 @@ def test_invalid_question_tokens_counter() -> None:
284304 response_utils .check_content_type (response , constants .MEDIA_TYPE_TEXT )
285305
286306
307+ @pytest .mark .skip_with_lcore
287308def test_token_counters_for_query_call_without_payload () -> None :
288309 """Check how the tokens counter are updated accordingly."""
289310 model , provider = metrics_utils .get_enabled_model_and_provider (
@@ -311,6 +332,7 @@ def test_token_counters_for_query_call_without_payload() -> None:
311332 response_utils .check_content_type (response , constants .MEDIA_TYPE_JSON )
312333
313334
335+ @pytest .mark .skip_with_lcore
314336def test_token_counters_for_query_call_with_improper_payload () -> None :
315337 """Check how the tokens counter are updated accordingly."""
316338 model , provider = metrics_utils .get_enabled_model_and_provider (
@@ -372,6 +394,7 @@ def test_rag_question() -> None:
372394 assert len (set (docs_urls )) == len (docs_urls )
373395
374396
397+ @pytest .mark .skip_with_lcore
375398@pytest .mark .cluster
376399def test_query_filter () -> None :
377400 """Ensure responses does not include filtered words and redacted words are not logged."""
@@ -463,6 +486,7 @@ def test_conversation_history() -> None:
463486 assert "ingress" in response_text , scenario_fail_msg
464487
465488
489+ @pytest .mark .skip_with_lcore
466490def test_query_with_provider_but_not_model () -> None :
467491 """Check the endpoint with POST HTTP method for provider specified, but no model."""
468492 with metrics_utils .RestAPICallCounterChecker (
@@ -491,6 +515,7 @@ def test_query_with_provider_but_not_model() -> None:
491515 )
492516
493517
518+ @pytest .mark .skip_with_lcore
494519def test_query_with_model_but_not_provider () -> None :
495520 """Check the endpoint with POST HTTP method for model specified, but no provider."""
496521 with metrics_utils .RestAPICallCounterChecker (
@@ -518,6 +543,7 @@ def test_query_with_model_but_not_provider() -> None:
518543 )
519544
520545
546+ @pytest .mark .skip_with_lcore
521547def test_query_with_unknown_provider () -> None :
522548 """Check the endpoint with POST HTTP method for unknown provider specified."""
523549 # retrieve currently selected model
@@ -554,6 +580,7 @@ def test_query_with_unknown_provider() -> None:
554580 )
555581
556582
583+ @pytest .mark .skip_with_lcore
557584def test_query_with_unknown_model () -> None :
558585 """Check the endpoint with POST HTTP method for unknown model specified."""
559586 # retrieve currently selected provider
0 commit comments