@@ -154,11 +154,8 @@ def model_registry_db_secret(
154154@pytest .fixture (scope = "class" )
155155def model_registry_db_deployment (
156156 pytestconfig : Config ,
157- admin_client : DynamicClient ,
158157 model_registry_namespace : str ,
159158 model_registry_db_secret : Secret ,
160- model_registry_db_pvc : PersistentVolumeClaim ,
161- model_registry_db_service : Service ,
162159 teardown_resources : bool ,
163160 is_model_registry_oauth : bool ,
164161) -> Generator [Deployment , Any , Any ]:
@@ -189,7 +186,17 @@ def model_registry_db_deployment(
189186
190187
191188@pytest .fixture (scope = "class" )
192- def model_registry_instance (
189+ def model_registry_mysql_metadata_db (
190+ model_registry_db_secret : Secret ,
191+ model_registry_db_pvc : PersistentVolumeClaim ,
192+ model_registry_db_service : Service ,
193+ model_registry_db_deployment : Deployment ,
194+ ) -> Deployment :
195+ return model_registry_db_deployment
196+
197+
198+ @pytest .fixture (scope = "class" )
199+ def model_registry_instance_mysql (
193200 pytestconfig : Config ,
194201 admin_client : DynamicClient ,
195202 model_registry_namespace : str ,
@@ -227,34 +234,29 @@ def model_registry_instance(
227234 ) as mr :
228235 mr .wait_for_condition (condition = "Available" , status = "True" )
229236 mr .wait_for_condition (condition = "OAuthProxyAvailable" , status = "True" )
230-
237+ wait_for_pods_running (
238+ admin_client = admin_client , namespace_name = model_registry_namespace , number_of_consecutive_checks = 3
239+ )
231240 yield mr
232241
233242
234243@pytest .fixture (scope = "class" )
235- def model_registry_mysql_config (
236- request : FixtureRequest ,
237- model_registry_db_deployment : Deployment ,
238- model_registry_db_secret : Secret ,
239- ) -> dict [str , Any ]:
244+ def model_registry_mysql_config (request : FixtureRequest , model_registry_namespace : str ) -> dict [str , Any ]:
240245 """
241246 Fixture to build the MySQL config dictionary for Model Registry.
242247 Expects request.param to be a dict. If 'sslRootCertificateConfigMap' is not present, it defaults to None.
243248 If 'sslRootCertificateConfigMap' is present, it will be used to configure the MySQL connection.
244-
245249 Args:
246250 request: The pytest request object
247- model_registry_db_deployment: The model registry db deployment
248- model_registry_db_secret: The model registry db secret
249-
251+ model_registry_namespace: The model registry namespoce
250252 Returns:
251253 dict[str, Any]: The MySQL config dictionary
252254 """
253255 param = request .param if hasattr (request , "param" ) else {}
254256 config = {
255- "host" : f"{ model_registry_db_deployment . name } .{ model_registry_db_deployment . namespace } .svc.cluster.local" ,
257+ "host" : f"{ DB_RESOURCES_NAME } .{ model_registry_namespace } .svc.cluster.local" ,
256258 "database" : MODEL_REGISTRY_DB_SECRET_STR_DATA ["database-name" ],
257- "passwordSecret" : {"key" : "database-password" , "name" : model_registry_db_deployment . name },
259+ "passwordSecret" : {"key" : "database-password" , "name" : DB_RESOURCES_NAME },
258260 "port" : param .get ("port" , 3306 ),
259261 "skipDBCreation" : False ,
260262 "username" : MODEL_REGISTRY_DB_SECRET_STR_DATA ["database-user" ],
@@ -266,39 +268,17 @@ def model_registry_mysql_config(
266268
267269
268270@pytest .fixture (scope = "class" )
269- def model_registry_instance_service (
270- admin_client : DynamicClient ,
271- model_registry_namespace : str ,
272- model_registry_instance : ModelRegistry ,
273- ) -> Service :
274- """
275- Get the service for the regular model registry instance.
276- Args:
277- admin_client: The admin client
278- model_registry_namespace: The namespace where the model registry is deployed
279- model_registry_instance: The model registry instance to get the service for
280- Returns:
281- Service: The service for the model registry instance
282- """
283- return get_mr_service_by_label (
284- client = admin_client , namespace_name = model_registry_namespace , mr_instance = model_registry_instance
271+ def model_registry_instance_rest_endpoint (admin_client : DynamicClient , model_registry_namespace : str ) -> str :
272+ return get_endpoint_from_mr_service (
273+ svc = get_mr_service_by_label (
274+ client = admin_client ,
275+ namespace_name = model_registry_namespace ,
276+ mr_instance = ModelRegistry (name = MR_INSTANCE_NAME , namespace = model_registry_namespace ),
277+ ),
278+ protocol = Protocols .REST ,
285279 )
286280
287281
288- @pytest .fixture (scope = "class" )
289- def model_registry_instance_rest_endpoint (
290- model_registry_instance_service : Service ,
291- ) -> str :
292- """
293- Get the REST endpoint for the model registry instance.
294- Args:
295- model_registry_instance_service: The service for the model registry instance
296- Returns:
297- str: The REST endpoint for the model registry instance
298- """
299- return get_endpoint_from_mr_service (svc = model_registry_instance_service , protocol = Protocols .REST )
300-
301-
302282@pytest .fixture (scope = "class" )
303283def generated_schema (pytestconfig : Config , model_registry_instance_rest_endpoint : str ) -> BaseOpenAPISchema :
304284 os .environ ["API_HOST" ] = model_registry_instance_rest_endpoint
@@ -339,9 +319,9 @@ def after_call(self, response: Response, case: Case) -> None:
339319@pytest .fixture (scope = "class" )
340320def updated_dsc_component_state_scope_class (
341321 pytestconfig : Config ,
322+ admin_client : DynamicClient ,
342323 request : FixtureRequest ,
343324 dsc_resource : DataScienceCluster ,
344- admin_client : DynamicClient ,
345325 teardown_resources : bool ,
346326 is_model_registry_oauth : bool ,
347327) -> Generator [DataScienceCluster , Any , Any ]:
0 commit comments