Skip to content

Commit 71fb285

Browse files
[patch] Resolve master catalog
1 parent 0d5f6a6 commit 71fb285

2 files changed

Lines changed: 27 additions & 3 deletions

File tree

src/mas/devops/data/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ def getCatalog(name: str) -> dict:
2929
Load a specific IBM Operator Catalog definition by name.
3030
3131
This function reads a catalog YAML file from the catalogs directory and returns
32-
its contents as a dictionary. Special handling for dev/master catalogs: if a catalog
33-
doesn't exist and matches dev patterns (master, branch names), automatically resolves
34-
to the newest catalog for that architecture.
32+
its contents as a dictionary. Dev/master catalogs that don't exist will automatically
33+
resolve to the newest catalog for that architecture.
3534
3635
Args:
3736
name (str): The catalog name/tag (e.g., "v9-241205-amd64", "v8-240528-amd64", "v9-master-amd64").
@@ -59,6 +58,7 @@ def getCatalog(name: str) -> dict:
5958
is_dev_catalog = not (middle_part.isdigit() and len(middle_part) == 6)
6059

6160
if is_dev_catalog:
61+
# This is a dev catalog, resolve to newest catalog for this architecture
6262
try:
6363
newestCatalog = getNewestCatalogTag(arch)
6464
catalogFileName = f"{newestCatalog}.yaml"

test/src/test_data.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,27 @@ def test_get_newest_catalog_tag_fail():
4343
def test_get_catalog_fail():
4444
with pytest.raises(NoSuchCatalogError, match="Catalog nonexistent-catalog is unknown"):
4545
getCatalog("nonexistent-catalog")
46+
47+
48+
def test_get_dev_catalog_master():
49+
"""Test that master dev catalogs automatically resolve to newest catalog"""
50+
catalogData = getCatalog("v9-master-amd64")
51+
# Should resolve to newest catalog
52+
newestCatalog = getCatalog(getNewestCatalogTag("amd64"))
53+
assert catalogData == newestCatalog
54+
55+
56+
def test_get_dev_catalog_branch():
57+
"""Test that branch dev catalogs automatically resolve to newest catalog"""
58+
catalogData = getCatalog("v9-feature-branch-amd64")
59+
# Should resolve to newest catalog
60+
newestCatalog = getCatalog(getNewestCatalogTag("amd64"))
61+
assert catalogData == newestCatalog
62+
63+
64+
def test_get_dev_catalog_s390x():
65+
"""Test that dev catalogs work for different architectures"""
66+
catalogData = getCatalog("v9-master-s390x")
67+
# Should resolve to newest s390x catalog
68+
newestCatalog = getCatalog(getNewestCatalogTag("s390x"))
69+
assert catalogData == newestCatalog

0 commit comments

Comments
 (0)