@@ -85,7 +85,7 @@ def updated_dsc_component_state_scope_session(
8585 resource_editor .update (backup_resources = True )
8686 wait_for_dsc_status_ready (dsc_resource = dsc_resource )
8787 # now delete the original namespace:
88- original_namespace = Namespace (name = original_namespace_name , wait_for_resource = True )
88+ original_namespace = Namespace (client = admin_client , name = original_namespace_name , wait_for_resource = True )
8989 original_namespace .delete (wait = True )
9090 # Now enable it with the custom namespace
9191 with ResourceEditor (
@@ -102,7 +102,9 @@ def updated_dsc_component_state_scope_session(
102102 }
103103 }
104104 ):
105- namespace = Namespace (name = py_config ["model_registry_namespace" ], wait_for_resource = True )
105+ namespace = Namespace (
106+ client = admin_client , name = py_config ["model_registry_namespace" ], wait_for_resource = True
107+ )
106108 namespace .wait_for_status (status = Namespace .Status .ACTIVE )
107109 wait_for_pods_running (
108110 admin_client = admin_client ,
@@ -200,7 +202,7 @@ def api_server_url(admin_client: DynamicClient) -> str:
200202
201203@pytest .fixture (scope = "module" )
202204def created_htpasswd_secret (
203- is_byoidc : bool , original_user : str , user_credentials_rbac : dict [str , str ]
205+ is_byoidc : bool , admin_client : DynamicClient , original_user : str , user_credentials_rbac : dict [str , str ]
204206) -> Generator [UserTestSession | None , None , None ]:
205207 """
206208 Session-scoped fixture that creates a test IDP user and cleans it up after all tests.
@@ -216,6 +218,7 @@ def created_htpasswd_secret(
216218 try :
217219 LOGGER .info (f"Creating secret { user_credentials_rbac ['secret_name' ]} in openshift-config namespace" )
218220 with Secret (
221+ client = admin_client ,
219222 name = user_credentials_rbac ["secret_name" ],
220223 namespace = "openshift-config" ,
221224 htpasswd = htpasswd_b64 ,
@@ -236,7 +239,7 @@ def updated_oauth_config(
236239 yield
237240 else :
238241 # Get current providers and add the new one
239- oauth = OAuth (name = "cluster" )
242+ oauth = OAuth (client = admin_client , name = "cluster" )
240243 identity_providers = oauth .instance .spec .identityProviders
241244
242245 new_idp = {
@@ -291,7 +294,9 @@ def model_registry_instance(
291294) -> Generator [list [Any ], Any , Any ]:
292295 param = getattr (request , "param" , {})
293296 if pytestconfig .option .post_upgrade :
294- mr_instance = ModelRegistry (name = MR_INSTANCE_NAME , namespace = model_registry_namespace , ensure_exists = True )
297+ mr_instance = ModelRegistry (
298+ client = admin_client , name = MR_INSTANCE_NAME , namespace = model_registry_namespace , ensure_exists = True
299+ )
295300 yield [mr_instance ]
296301 mr_instance .delete (wait = True )
297302 else :
@@ -333,15 +338,33 @@ def model_registry_metadata_db_resources(
333338
334339 if pytestconfig .option .post_upgrade :
335340 resources = {
336- Secret : [Secret (name = DB_RESOURCE_NAME , namespace = model_registry_namespace , ensure_exists = True )],
341+ Secret : [
342+ Secret (
343+ client = admin_client , name = DB_RESOURCE_NAME , namespace = model_registry_namespace , ensure_exists = True
344+ )
345+ ],
337346 PersistentVolumeClaim : [
338- PersistentVolumeClaim (name = DB_RESOURCE_NAME , namespace = model_registry_namespace , ensure_exists = True )
347+ PersistentVolumeClaim (
348+ client = admin_client , name = DB_RESOURCE_NAME , namespace = model_registry_namespace , ensure_exists = True
349+ )
350+ ],
351+ Service : [
352+ Service (
353+ client = admin_client , name = DB_RESOURCE_NAME , namespace = model_registry_namespace , ensure_exists = True
354+ )
339355 ],
340- Service : [Service (name = DB_RESOURCE_NAME , namespace = model_registry_namespace , ensure_exists = True )],
341- ConfigMap : [ConfigMap (name = DB_RESOURCE_NAME , namespace = model_registry_namespace , ensure_exists = True )]
356+ ConfigMap : [
357+ ConfigMap (
358+ client = admin_client , name = DB_RESOURCE_NAME , namespace = model_registry_namespace , ensure_exists = True
359+ )
360+ ]
342361 if db_backend == "mariadb"
343362 else [],
344- Deployment : [Deployment (name = DB_RESOURCE_NAME , namespace = model_registry_namespace , ensure_exists = True )],
363+ Deployment : [
364+ Deployment (
365+ client = admin_client , name = DB_RESOURCE_NAME , namespace = model_registry_namespace , ensure_exists = True
366+ )
367+ ],
345368 }
346369 yield resources
347370 for kind in [Deployment , ConfigMap , Service , PersistentVolumeClaim , Secret ]:
0 commit comments