Skip to content

Commit 2ec2b24

Browse files
committed
Fix the guardrails orchestrator gateway route
modified: tests/fixtures/guardrails.py modified: tests/model_explainability/guardrails/test_guardrails.py
1 parent 5f9b797 commit 2ec2b24

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

tests/fixtures/guardrails.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,26 @@ def guardrails_orchestrator_health_route(
139139
}
140140
):
141141
yield guardrails_orchestrator_health_route
142+
143+
@pytest.fixture(scope="class")
144+
def guardrails_orchestrator_gateway_route(
145+
admin_client: DynamicClient,
146+
model_namespace: Namespace,
147+
guardrails_orchestrator: GuardrailsOrchestrator,
148+
) -> Generator[Route, Any, Any]:
149+
guardrails_orchestrator_gateway_route = Route(
150+
name=f"{guardrails_orchestrator.name}-gateway",
151+
namespace=guardrails_orchestrator.namespace,
152+
wait_for_resource=True,
153+
ensure_exists=True,
154+
)
155+
with ResourceEditor(
156+
patches={
157+
guardrails_orchestrator_gateway_route: {
158+
"metadata": {
159+
"annotations": {Annotations.HaproxyRouterOpenshiftIo.TIMEOUT: "10m"},
160+
}
161+
}
162+
}
163+
):
164+
yield guardrails_orchestrator_gateway_route

tests/model_explainability/guardrails/test_guardrails.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ def test_guardrails_info_endpoint(self, qwen_isvc, guardrails_orchestrator_healt
163163
assert response_data["services"]["regex"]["status"] == healthy_status
164164

165165
def test_guardrails_builtin_detectors_unsuitable_input(
166-
self, current_client_token, openshift_ca_bundle_file, qwen_isvc, guardrails_orchestrator_route
166+
self, current_client_token, openshift_ca_bundle_file, qwen_isvc, guardrails_orchestrator_gateway_route
167167
):
168168
response = requests.post(
169-
url=f"https://{guardrails_orchestrator_route.host}{PII_ENDPOINT}{OpenAIEnpoints.CHAT_COMPLETIONS}",
169+
url=f"https://{guardrails_orchestrator_gateway_route.host}{PII_ENDPOINT}{OpenAIEnpoints.CHAT_COMPLETIONS}",
170170
headers=get_auth_headers(token=current_client_token),
171171
json=get_chat_detections_payload(
172172
content=PROMPT_WITH_PII,
@@ -184,10 +184,10 @@ def test_guardrails_builtin_detectors_unsuitable_input(
184184
)
185185

186186
def test_guardrails_builtin_detectors_unsuitable_output(
187-
self, current_client_token, openshift_ca_bundle_file, qwen_isvc, guardrails_orchestrator_route
187+
self, current_client_token, openshift_ca_bundle_file, qwen_isvc, guardrails_orchestrator_gateway_route
188188
):
189189
response = requests.post(
190-
url=f"https://{guardrails_orchestrator_route.host}{PII_ENDPOINT}{OpenAIEnpoints.CHAT_COMPLETIONS}",
190+
url=f"https://{guardrails_orchestrator_gateway_route.host}{PII_ENDPOINT}{OpenAIEnpoints.CHAT_COMPLETIONS}",
191191
headers=get_auth_headers(token=current_client_token),
192192
json=get_chat_detections_payload(
193193
content="Output example email address, nothing else.",
@@ -216,12 +216,12 @@ def test_guardrails_builtin_detectors_negative_detection(
216216
current_client_token,
217217
openshift_ca_bundle_file,
218218
qwen_isvc,
219-
guardrails_orchestrator_route,
219+
guardrails_orchestrator_gateway_route,
220220
message,
221221
url_path,
222222
):
223223
response = requests.post(
224-
url=f"https://{guardrails_orchestrator_route.host}{url_path}{OpenAIEnpoints.CHAT_COMPLETIONS}",
224+
url=f"https://{guardrails_orchestrator_gateway_route.host}{url_path}{OpenAIEnpoints.CHAT_COMPLETIONS}",
225225
headers=get_auth_headers(token=current_client_token),
226226
json=get_chat_detections_payload(
227227
content=str(message),

0 commit comments

Comments
 (0)