3333from utilities .serving_runtime import ServingRuntimeFromTemplate
3434
3535
36- USER_ONE : str = "user-one "
36+ GUARDRAILS_ORCHESTRATOR_NAME = "guardrails-orchestrator "
3737
38- GORCH_NAME = "guardrails-orchestrator"
39- GORCH_CONFIGMAP_NAME = "fms-orchestr8-config-nlp"
40- GORCH_PORT : int = 8032
4138
42-
43- # GuardrailsOrchestrator related fixtures
39+ # Fixtures related to the Guardrails Orchestrator
4440@pytest .fixture (scope = "class" )
4541def guardrails_orchestrator (
4642 request : FixtureRequest ,
@@ -50,7 +46,7 @@ def guardrails_orchestrator(
5046) -> Generator [GuardrailsOrchestrator , Any , Any ]:
5147 gorch_kwargs = {
5248 "client" : admin_client ,
53- "name" : GORCH_NAME ,
49+ "name" : GUARDRAILS_ORCHESTRATOR_NAME ,
5450 "namespace" : model_namespace .name ,
5551 "orchestrator_config" : orchestrator_config .name ,
5652 "replicas" : 1 ,
@@ -104,7 +100,11 @@ def guardrails_orchestrator_pod(
104100 model_namespace : Namespace ,
105101 guardrails_orchestrator : GuardrailsOrchestrator ,
106102) -> Pod :
107- return list (Pod .get (namespace = model_namespace .name , label_selector = f"app.kubernetes.io/instance={ GORCH_NAME } " ))[0 ]
103+ return list (
104+ Pod .get (
105+ namespace = model_namespace .name , label_selector = f"app.kubernetes.io/instance={ GUARDRAILS_ORCHESTRATOR_NAME } "
106+ )
107+ )[0 ]
108108
109109
110110@pytest .fixture (scope = "class" )
@@ -154,10 +154,10 @@ def vllm_runtime(
154154 containers = {
155155 "kserve-container" : {
156156 "args" : [
157- f"--port={ str (GORCH_PORT )} " ,
157+ f"--port={ str (8032 )} " ,
158158 "--model=/mnt/models" ,
159159 ],
160- "ports" : [{"containerPort" : GORCH_PORT , "protocol" : "TCP" }],
160+ "ports" : [{"containerPort" : 8032 , "protocol" : "TCP" }],
161161 "volumeMounts" : [{"mountPath" : "/dev/shm" , "name" : "shm" }],
162162 }
163163 },
@@ -280,7 +280,7 @@ def prompt_injection_detector_route(
280280 )
281281
282282
283- # Llama-stack fixtures
283+ # LlamaStack fixtures
284284@pytest .fixture (scope = "class" )
285285def llamastack_distribution_trustyai (
286286 admin_client : DynamicClient ,
@@ -369,7 +369,7 @@ def llamastack_client_trustyai(
369369 return LlamaStackClient (base_url = f"http://{ llamastack_distribution_trustyai_route .host } " )
370370
371371
372- # Other
372+ # Other "helper" fixtures
373373@pytest .fixture (scope = "class" )
374374def openshift_ca_bundle_file (
375375 admin_client : DynamicClient ,
@@ -382,17 +382,16 @@ def guardrails_orchestrator_ssl_cert(guardrails_orchestrator_route: Route):
382382 hostname = guardrails_orchestrator_route .host
383383
384384 try :
385- cmd = ["openssl" , "s_client" , "-showcerts" , "-connect" , f"{ hostname } :443" ]
386-
387- process = subprocess .Popen (
388- args = cmd , stdin = subprocess .PIPE , stdout = subprocess .PIPE , stderr = subprocess .PIPE , text = True
385+ result = subprocess .run (
386+ args = ["openssl" , "s_client" , "-showcerts" , "-connect" , f"{ hostname } :443" ],
387+ input = "" ,
388+ capture_output = True ,
389+ text = True ,
389390 )
390391
391- stdout , _ = process .communicate (input = "" )
392-
393392 cert_lines = []
394393 in_cert = False
395- for line in stdout .split ( " \n " ):
394+ for line in result . stdout .splitlines ( ):
396395 if "-----BEGIN CERTIFICATE-----" in line :
397396 in_cert = True
398397 if in_cert :
0 commit comments