Skip to content

Commit f1777e2

Browse files
dbasunaglugi0
andauthored
Update pod test to count for newly added mc pod (#694)
Signed-off-by: Debarati Basu-Nag <dbasunag@redhat.com> Co-authored-by: Luca Giorgi <lgiorgi@redhat.com>
1 parent 4217db5 commit f1777e2

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

tests/model_registry/model_catalog/test_default_model_catalog.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,33 +57,44 @@ def test_config_map_exists(self: Self, model_catalog_config_map: ConfigMap):
5757
validate_default_catalog(default_catalog=catalogs[0])
5858

5959
@pytest.mark.parametrize(
60-
"resource_name",
60+
"resource_name, expected_resource_count",
6161
[
6262
pytest.param(
6363
Deployment,
64+
1,
6465
id="test_model_catalog_deployment_resource",
6566
),
6667
pytest.param(
6768
Route,
69+
1,
6870
id="test_model_catalog_route_resource",
6971
),
7072
pytest.param(
7173
Service,
74+
1,
7275
id="test_model_catalog_service_resource",
7376
),
7477
pytest.param(
7578
Pod,
79+
2,
7680
id="test_model_catalog_pod_resource",
7781
),
7882
],
7983
)
8084
@pytest.mark.post_upgrade
8185
@pytest.mark.install
8286
def test_model_catalog_resources_exists(
83-
self: Self, admin_client: DynamicClient, model_registry_namespace: str, resource_name: Any
87+
self: Self,
88+
admin_client: DynamicClient,
89+
model_registry_namespace: str,
90+
resource_name: Any,
91+
expected_resource_count: int,
8492
):
8593
validate_model_catalog_resource(
86-
kind=resource_name, admin_client=admin_client, namespace=model_registry_namespace
94+
kind=resource_name,
95+
admin_client=admin_client,
96+
namespace=model_registry_namespace,
97+
expected_resource_count=expected_resource_count,
8798
)
8899

89100
def test_operator_pod_enabled_model_catalog(self: Self, model_registry_operator_pod: Pod):

tests/model_registry/model_catalog/utils.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,15 @@ def wait_for_model_catalog_pod_created(client: DynamicClient, model_registry_nam
8484
raise PodNotFound("Model catalog pod not found")
8585

8686

87-
def validate_model_catalog_resource(kind: Any, admin_client: DynamicClient, namespace: str) -> None:
87+
def validate_model_catalog_resource(
88+
kind: Any, admin_client: DynamicClient, namespace: str, expected_resource_count: int
89+
) -> None:
8890
resource = list(kind.get(namespace=namespace, label_selector="component=model-catalog", dyn_client=admin_client))
8991
assert resource
90-
assert len(resource) == 1, f"Unexpected number of {kind} resources found: {[res.name for res in resource]}"
92+
LOGGER.info(f"Validating resource: {kind}: Found {len(resource)})")
93+
assert len(resource) == expected_resource_count, (
94+
f"Unexpected number of {kind} resources found: {[res.name for res in resource]}"
95+
)
9196

9297

9398
def validate_default_catalog(default_catalog) -> None:

0 commit comments

Comments
 (0)