Skip to content

Commit 00ec405

Browse files
committed
feat: update guardrails tests
1 parent 958a56c commit 00ec405

File tree

3 files changed

+576
-586
lines changed

3 files changed

+576
-586
lines changed

tests/model_explainability/guardrails/conftest.py

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
from utilities.inference_utils import create_isvc
2626
from utilities.serving_runtime import ServingRuntimeFromTemplate
2727

28-
2928
USER_ONE: str = "user-one"
3029
GUARDRAILS_ORCHESTRATOR_PORT: int = 8032
3130

@@ -50,15 +49,16 @@ def guardrails_orchestrator(
5049
admin_client: DynamicClient,
5150
model_namespace: Namespace,
5251
orchestrator_configmap: ConfigMap,
53-
vllm_gateway_config: ConfigMap,
54-
vllm_images_configmap: ConfigMap,
52+
guardrails_gateway_config: ConfigMap,
5553
) -> Generator[GuardrailsOrchestrator, Any, Any]:
5654
with GuardrailsOrchestrator(
5755
client=admin_client,
5856
name="gorch-test",
5957
namespace=model_namespace.name,
58+
enable_built_in_detectors=True,
59+
enable_guardrails_gateway=True,
6060
orchestrator_config=orchestrator_configmap.name,
61-
vllm_gateway_config=vllm_gateway_config.name,
61+
guardrails_gateway_config=guardrails_gateway_config.name,
6262
replicas=1,
6363
wait_for_resource=True,
6464
) as gorch:
@@ -124,22 +124,6 @@ def vllm_runtime(
124124
yield serving_runtime
125125

126126

127-
@pytest.fixture(scope="class")
128-
def vllm_images_configmap(admin_client: DynamicClient, model_namespace: Namespace) -> Generator[ConfigMap, Any, Any]:
129-
with ConfigMap(
130-
client=admin_client,
131-
name="gorch-test-config",
132-
namespace=model_namespace.name,
133-
data={
134-
"regexDetectorImage": "quay.io/trustyai_testing/regex-detector"
135-
"@sha256:e9df9f7e7429e29da9b8d9920d80cdc85a496e7961f6edb19132d604a914049b",
136-
"vllmGatewayImage": "quay.io/trustyai_testing/vllm-orchestrator-gateway"
137-
"@sha256:d0bbf2de95c69f76215a016820f294202c48721dee452b3939e36133697d5b1d",
138-
},
139-
) as cm:
140-
yield cm
141-
142-
143127
@pytest.fixture(scope="class")
144128
def orchestrator_configmap(
145129
admin_client: DynamicClient,
@@ -176,7 +160,9 @@ def orchestrator_configmap(
176160

177161

178162
@pytest.fixture(scope="class")
179-
def vllm_gateway_config(admin_client: DynamicClient, model_namespace: Namespace) -> Generator[ConfigMap, Any, Any]:
163+
def guardrails_gateway_config(
164+
admin_client: DynamicClient, model_namespace: Namespace
165+
) -> Generator[ConfigMap, Any, Any]:
180166
with ConfigMap(
181167
client=admin_client,
182168
name="fms-orchestr8-config-gateway",
@@ -191,9 +177,15 @@ def vllm_gateway_config(admin_client: DynamicClient, model_namespace: Namespace)
191177
"detectors": [
192178
{
193179
"name": "regex",
180+
"input": True,
181+
"output": True,
194182
"detector_params": {"regex": ["email", "ssn"]},
195183
},
196-
{"name": "other_detector"},
184+
{
185+
"name": "other_detector",
186+
"input": True,
187+
"output": True,
188+
},
197189
],
198190
"routes": [
199191
{"name": "pii", "detectors": ["regex"]},

tests/model_explainability/trustyai_service/trustyai_service_utils.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,6 @@ def send_inferences_and_verify_trustyai_service_registered(
315315
token=token,
316316
)
317317
LOGGER.debug(f"Inference response: {res}")
318-
319318
samples = TimeoutSampler(
320319
wait_timeout=Timeout.TIMEOUT_5MIN,
321320
sleep=1,
@@ -496,7 +495,6 @@ def verify_trustyai_service_metric_scheduling_request(
496495
LOGGER.info(msg=f"TrustyAI scheduled metrics: {get_metrics_data}")
497496

498497
verify_trustyai_service_response(response=get_metrics_response, response_data=get_metrics_data)
499-
500498
errors = []
501499
# Validate metrics-specific requirements
502500
if "requests" not in get_metrics_data or not get_metrics_data["requests"]:

0 commit comments

Comments
 (0)