Skip to content

Commit

Permalink
test: tweak TestCaseC10S testcase and osinfo_for helper
Browse files Browse the repository at this point in the history
  • Loading branch information
mvo5 committed Dec 2, 2024
1 parent 8bf2719 commit d8113de
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
13 changes: 10 additions & 3 deletions test/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,11 +628,18 @@ def test_iso_installs(image_type):


def osinfo_for(it: ImageBuildResult, arch: str) -> str:
base = "Media is an installer for OS "
if it.container_ref.endswith("/centos-bootc/centos-bootc:stream9"):
return f"CentOS Stream 9 ({arch})"
return f"{base} CentOS Stream 9 ({arch})\n"
if it.container_ref.endswith("/centos-bootc/centos-bootc:stream10"):
# XXX: uncomment once
# https://gitlab.com/libosinfo/osinfo-db/-/commit/fc811ba5a792967e22a0108de5a245b23da3cc66
# gets released
#return f"CentOS Stream 10 ({arch})"
return ""
if "/fedora/fedora-bootc:" in it.container_ref:
ver = it.container_ref.rsplit(":", maxsplit=1)[1]
return f"Fedora Server {ver} ({arch})"
return f"{base} Fedora Server {ver} ({arch})\n"
raise ValueError(f"unknown osinfo string for '{it.container_ref}'")


Expand All @@ -648,7 +655,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 = f"Media is bootable.\n{osinfo_for(image_type, arch)}"
assert osinfo_output == expected_output


Expand Down
15 changes: 7 additions & 8 deletions test/testcases.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ class TestCaseC9S(TestCase):
"quay.io/centos-bootc/centos-bootc:stream9")


@dataclasses.dataclass
class TestCaseC10S(TestCase):
container_ref: str = os.getenv(
"BIB_TEST_BOOTC_CONTAINER_TAG",
"quay.io/centos-bootc/centos-bootc:stream10")


def test_testcase_nameing():
"""
Ensure the testcase naming does not change without us knowing as those
Expand All @@ -70,14 +77,6 @@ def test_testcase_nameing():
assert f"{tc}" == expected, f"{tc} != {expected}"


@dataclasses.dataclass
class TestCaseC10S(TestCase):
container_ref: str = os.getenv(
"BIB_TEST_BOOTC_CONTAINER_TAG",
"quay.io/centos-bootc/centos-bootc:stream10")
osinfo_template: str = "CentOS Stream 10 ({arch})"


def gen_testcases(what): # pylint: disable=too-many-return-statements
if what == "manifest":
return [TestCaseC9S(), TestCaseFedora(), TestCaseC10S()]
Expand Down

0 comments on commit d8113de

Please sign in to comment.