Skip to content

Commit 793943e

Browse files
committed
minor updates to updated_catalog_config_map for upgrade scenarios
1 parent c751a6b commit 793943e

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

tests/model_registry/model_catalog/conftest.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,27 @@ def model_catalog_config_map(
4545

4646
@pytest.fixture(scope="class")
4747
def updated_catalog_config_map(
48+
pytestconfig: pytest.Config,
4849
request: pytest.FixtureRequest,
4950
catalog_config_map: ConfigMap,
5051
model_registry_namespace: str,
5152
admin_client: DynamicClient,
5253
model_catalog_rest_url: list[str],
5354
model_registry_rest_headers: dict[str, str],
5455
) -> Generator[ConfigMap, None, None]:
55-
patches = {"data": {"sources.yaml": request.param["sources_yaml"]}}
56-
if "sample_yaml" in request.param:
57-
for key in request.param["sample_yaml"]:
58-
patches["data"][key] = request.param["sample_yaml"][key]
59-
60-
with ResourceEditor(patches={catalog_config_map: patches}):
61-
is_model_catalog_ready(client=admin_client, model_registry_namespace=model_registry_namespace)
62-
wait_for_model_catalog_api(url=model_catalog_rest_url[0], headers=model_registry_rest_headers)
56+
if pytestconfig.option.post_upgrade or pytestconfig.option.pre_upgrade:
6357
yield catalog_config_map
64-
is_model_catalog_ready(client=admin_client, model_registry_namespace=model_registry_namespace)
58+
else:
59+
patches = {"data": {"sources.yaml": request.param["sources_yaml"]}}
60+
if "sample_yaml" in request.param:
61+
for key in request.param["sample_yaml"]:
62+
patches["data"][key] = request.param["sample_yaml"][key]
63+
64+
with ResourceEditor(patches={catalog_config_map: patches}):
65+
is_model_catalog_ready(client=admin_client, model_registry_namespace=model_registry_namespace)
66+
wait_for_model_catalog_api(url=model_catalog_rest_url[0], headers=model_registry_rest_headers)
67+
yield catalog_config_map
68+
is_model_catalog_ready(client=admin_client, model_registry_namespace=model_registry_namespace)
6569

6670

6771
@pytest.fixture(scope="class")

0 commit comments

Comments
 (0)