Skip to content

Commit 1d6c135

Browse files
committed
Reapply "instead of ensure_exists for mr namespaces, use wait_for_resource"
This reverts commit 9b7c1ba.
1 parent 9b7c1ba commit 1d6c135

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

tests/model_registry/conftest.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ def updated_dsc_component_state_scope_class(
299299
)
300300
if component_patch.get(DscComponents.MODELREGISTRY):
301301
namespace = Namespace(
302-
name=dsc_resource.instance.spec.components.modelregistry.registriesNamespace, ensure_exists=True
302+
name=dsc_resource.instance.spec.components.modelregistry.registriesNamespace, wait_for_resource=True
303303
)
304304
namespace.wait_for_status(status=Namespace.Status.ACTIVE)
305305
wait_for_pods_running(
@@ -321,8 +321,8 @@ def updated_dsc_component_state_scope_class(
321321
):
322322
# Since namespace specified in registriesNamespace is automatically created after setting
323323
# managementStateto Managed. We need to explicitly delete it on clean up.
324-
namespace = Namespace(name=value["registriesNamespace"], ensure_exists=True)
325-
if namespace:
324+
namespace = Namespace(name=value["registriesNamespace"], wait_for_resource=True)
325+
if namespace.exists:
326326
namespace.delete(wait=True)
327327

328328

@@ -343,7 +343,7 @@ def pre_upgrade_dsc_patch(
343343
editor.update()
344344
dsc_resource.wait_for_condition(condition=DscComponents.COMPONENT_MAPPING["modelregistry"], status="True")
345345
namespace = Namespace(
346-
name=dsc_resource.instance.spec.components.modelregistry.registriesNamespace, ensure_exists=True
346+
name=dsc_resource.instance.spec.components.modelregistry.registriesNamespace, wait_for_resource=True
347347
)
348348
namespace.wait_for_status(status=Namespace.Status.ACTIVE)
349349
wait_for_pods_running(
@@ -375,8 +375,8 @@ def post_upgrade_dsc_patch(
375375
editor = ResourceEditor(patches={dsc_resource: {"spec": {"components": component_patch}}})
376376
editor.update()
377377
ns = original_components.get(DscComponents.MODELREGISTRY).get("registriesNamespace")
378-
namespace = Namespace(name=ns, ensure_exists=True)
379-
if namespace:
378+
namespace = Namespace(name=ns, wait_for_resource=True)
379+
if namespace.exists:
380380
namespace.delete(wait=True)
381381

382382

@@ -564,7 +564,7 @@ def updated_dsc_component_state_parametrized(
564564
dsc_resource.wait_for_condition(
565565
condition=DscComponents.COMPONENT_MAPPING[DscComponents.MODELREGISTRY], status="True"
566566
)
567-
namespace = Namespace(name=namespace_name, ensure_exists=True)
567+
namespace = Namespace(name=namespace_name, wait_for_resource=True)
568568
namespace.wait_for_status(status=Namespace.Status.ACTIVE)
569569
wait_for_pods_running(
570570
admin_client=admin_client,
@@ -574,8 +574,8 @@ def updated_dsc_component_state_parametrized(
574574
yield dsc_resource
575575

576576
# Clean up the dynamic namespace
577-
namespace = Namespace(name=namespace_name, ensure_exists=True)
578-
if namespace:
577+
namespace = Namespace(name=namespace_name, wait_for_resource=True)
578+
if namespace.exists:
579579
namespace.delete(wait=True)
580580

581581

0 commit comments

Comments
 (0)