Skip to content

Commit

Permalink
test: simplify/improve osinfo_for() helper
Browse files Browse the repository at this point in the history
  • Loading branch information
mmartinv authored and mvo5 committed Oct 30, 2024
1 parent f8d8a1b commit cb29968
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,11 +453,15 @@ def test_iso_installs(image_type):


def osinfo_for(it: ImageBuildResult, arch: str) -> str:
osinfo = "Media is bootable.\nMedia is an installer for OS '{os}'\n"
os_str = ""
if it.container_ref == "quay.io/centos-bootc/centos-bootc:stream9":
return f"CentOS Stream 9 ({arch})"
os_str = f"CentOS Stream 9 ({arch})"
if it.container_ref.startswith("quay.io/fedora/fedora-bootc:"):
ver = it.container_ref.split(":", maxsplit=2)[1]
return f"Fedora Server {ver} ({arch})"
os_str = f"Fedora Server {ver} ({arch})"
if os_str:
return osinfo.format(os=os_str)
raise ValueError(f"cannot find osinfo_template for '{it.container_ref}'")


Expand All @@ -473,7 +477,7 @@ def test_iso_os_detection(image_type):
installer_iso_path,
], capture_output=True, text=True, check=True)
osinfo_output = result.stdout
expected_output = f"Media is bootable.\nMedia is an installer for OS '{osinfo_for(image_type, arch)}'\n"
expected_output = osinfo_for(image_type, arch)
assert osinfo_output == expected_output


Expand Down

0 comments on commit cb29968

Please sign in to comment.