88from ocp_resources .deployment import Deployment
99from ocp_resources .inference_service import InferenceService
1010from ocp_resources .namespace import Namespace
11- from ocp_resources .project_project_openshift_io import Project
1211from ocp_resources .role import Role
1312from ocp_resources .role_binding import RoleBinding
1413from ocp_resources .route import Route
1514from ocp_resources .secret import Secret
1615from ocp_resources .service_account import ServiceAccount
17- from ocp_resources .serving_runtime import ServingRuntime
1816from pytest_testconfig import config as py_config
1917
2018from tests .model_explainability .evalhub .constants import (
@@ -203,9 +201,7 @@ def tenant_namespace(
203201
204202@pytest .fixture (scope = "class" )
205203def evalhub_job_service_account (
206- admin_client : DynamicClient ,
207- model_namespace : Namespace ,
208- tenant_namespace : Namespace
204+ admin_client : DynamicClient , model_namespace : Namespace , tenant_namespace : Namespace
209205) -> ServiceAccount :
210206 """Wait for the auto-created EvalHub job ServiceAccount in the tenant namespace."""
211207 sa_name = f"{ EVALHUB_JOB_SA_PREFIX } { model_namespace .name } { EVALHUB_JOB_SA_SUFFIX } "
@@ -363,10 +359,12 @@ def dspa_secret_patch(
363359 "AWS_DEFAULT_REGION" : "us-east-1" ,
364360 }
365361
366- secret .update (resource_dict = {
367- "metadata" : {"name" : secret .name , "namespace" : tenant_namespace .name },
368- "stringData" : secret_data ,
369- })
362+ secret .update (
363+ resource_dict = {
364+ "metadata" : {"name" : secret .name , "namespace" : tenant_namespace .name },
365+ "stringData" : secret_data ,
366+ }
367+ )
370368 LOGGER .info (f"Patched DSPA S3 secret with additional fields in { tenant_namespace .name } " )
371369 return secret
372370
@@ -379,20 +377,21 @@ def dsp_access_for_job_sa(
379377 tenant_dspa : DataSciencePipelinesApplication ,
380378) -> Generator [tuple [Role , RoleBinding , RoleBinding ], Any , Any ]:
381379 """Grant the EvalHub job ServiceAccount access to the DSP API and pipeline management."""
382- with Role (
383- client = admin_client ,
384- name = "evalhub-jobs-dspa-api" ,
385- namespace = tenant_namespace .name ,
386- rules = [
387- {
388- "apiGroups" : ["datasciencepipelinesapplications.opendatahub.io" ],
389- "resources" : ["datasciencepipelinesapplications/api" ],
390- "verbs" : ["get" , "create" ],
391- },
392- ],
393- wait_for_resource = True ,
394- ) as role :
395- with RoleBinding (
380+ with (
381+ Role (
382+ client = admin_client ,
383+ name = "evalhub-jobs-dspa-api" ,
384+ namespace = tenant_namespace .name ,
385+ rules = [
386+ {
387+ "apiGroups" : ["datasciencepipelinesapplications.opendatahub.io" ],
388+ "resources" : ["datasciencepipelinesapplications/api" ],
389+ "verbs" : ["get" , "create" ],
390+ },
391+ ],
392+ wait_for_resource = True ,
393+ ) as role ,
394+ RoleBinding (
396395 client = admin_client ,
397396 name = "evalhub-jobs-dspa-api" ,
398397 namespace = tenant_namespace .name ,
@@ -402,20 +401,20 @@ def dsp_access_for_job_sa(
402401 subjects_name = evalhub_job_service_account .name ,
403402 subjects_namespace = tenant_namespace .name ,
404403 wait_for_resource = True ,
405- ) as api_binding :
406- with RoleBinding (
407- client = admin_client ,
408- name = "evalhub-jobs-pipeline-management" ,
409- namespace = tenant_namespace .name ,
410- role_ref_kind = "Role" ,
411- role_ref_name = "ds-pipeline-dspa" ,
412- subjects_kind = "ServiceAccount" ,
413- subjects_name = evalhub_job_service_account .name ,
414- subjects_namespace = tenant_namespace .name ,
415- wait_for_resource = True ,
416- ) as pipeline_binding :
417- yield role , api_binding , pipeline_binding
418-
404+ ) as api_binding ,
405+ RoleBinding (
406+ client = admin_client ,
407+ name = "evalhub-jobs-pipeline-management" ,
408+ namespace = tenant_namespace .name ,
409+ role_ref_kind = "Role" ,
410+ role_ref_name = "ds-pipeline-dspa" ,
411+ subjects_kind = "ServiceAccount" ,
412+ subjects_name = evalhub_job_service_account .name ,
413+ subjects_namespace = tenant_namespace .name ,
414+ wait_for_resource = True ,
415+ ) as pipeline_binding ,
416+ ):
417+ yield role , api_binding , pipeline_binding
419418
420419
421420# ---------------------------------------------------------------------------
@@ -426,7 +425,4 @@ def dsp_access_for_job_sa(
426425@pytest .fixture (scope = "class" )
427426def garak_sim_isvc_url (llm_d_inference_sim_isvc : InferenceService ) -> str :
428427 """Get the internal service URL for the LLM-d inference simulator."""
429- return (
430- f"http://{ llm_d_inference_sim_isvc .name } -predictor.{ llm_d_inference_sim_isvc .namespace } "
431- f".svc.cluster.local/v1"
432- )
428+ return f"http://{ llm_d_inference_sim_isvc .name } -predictor.{ llm_d_inference_sim_isvc .namespace } .svc.cluster.local/v1"
0 commit comments