2121from simple_logger .logger import get_logger
2222
2323from utilities .data_science_cluster_utils import update_components_in_dsc
24- from utilities .infra import create_ns , login_with_user_password , get_openshift_token
24+ from utilities .infra import (
25+ create_ns ,
26+ get_dsci_applications_namespace ,
27+ get_operator_distribution ,
28+ login_with_user_password ,
29+ get_openshift_token ,
30+ )
2531from utilities .constants import AcceleratorType , DscComponents
2632from utilities .infra import update_configmap_data
2733
@@ -45,6 +51,21 @@ def tests_tmp_dir(request: FixtureRequest, tmp_path_factory: TempPathFactory) ->
4551 shutil .rmtree (path = str (tests_tmp_path ), ignore_errors = True )
4652
4753
54+ @pytest .fixture (scope = "session" , autouse = True )
55+ def updated_global_config (request : FixtureRequest , admin_client : DynamicClient ) -> None :
56+ if get_operator_distribution (client = admin_client ) == "Open Data Hub" :
57+ py_config ["distribution" ] = "upstream"
58+
59+ else :
60+ py_config ["distribution" ] = "downstream"
61+
62+ if applications_namespace := request .config .getoption ("applications_namespace" ):
63+ py_config ["applications_namespace" ] = applications_namespace
64+
65+ else :
66+ py_config ["applications_namespace" ] = get_dsci_applications_namespace (client = admin_client )
67+
68+
4869@pytest .fixture (scope = "session" )
4970def current_client_token (admin_client : DynamicClient ) -> str :
5071 return get_openshift_token ()
@@ -275,6 +296,17 @@ def enabled_modelmesh_in_dsc(dsc_resource: DataScienceCluster) -> Generator[Data
275296 yield dsc
276297
277298
299+ @pytest .fixture (scope = "package" )
300+ def enabled_kserve_in_dsc (
301+ dsc_resource : DataScienceCluster ,
302+ ) -> Generator [DataScienceCluster , Any , Any ]:
303+ with update_components_in_dsc (
304+ dsc = dsc_resource ,
305+ components = {DscComponents .KSERVE : DscComponents .ManagementState .MANAGED },
306+ ) as dsc :
307+ yield dsc
308+
309+
278310@pytest .fixture (scope = "session" )
279311def cluster_monitoring_config (admin_client : DynamicClient ) -> Generator [ConfigMap , Any , Any ]:
280312 data = {"config.yaml" : yaml .dump ({"enableUserWorkload" : True })}
0 commit comments