Skip to content

Commit

Permalink
test: enable librepo as part of the test cases
Browse files Browse the repository at this point in the history
This commit make the use of librepo part of the testcases
and enables it for the problematic testcases like fedora
and centos-10.

Eventually we should switch entirely to librepo but there
is a regression risk with secrets so for now make it
optional.
  • Loading branch information
mvo5 committed Jan 17, 2025
1 parent 6e800aa commit 09b487c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,8 @@ def build_images(shared_tmpdir, build_container, request, force_aws_upload, gpg_
*target_arch_args,
*tc.bib_rootfs_args(),
"--local" if tc.local else "--local=false",
"--tls-verify=false" if tc.sign else "--tls-verify=true"
"--tls-verify=false" if tc.sign else "--tls-verify=true",
f"--use-librepo={tc.use_librepo}",
])

# print the build command for easier tracing
Expand Down
20 changes: 20 additions & 0 deletions test/test_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,3 +731,23 @@ def test_manifest_disk_customization_lvm_swap(tmp_path, build_container):
osbuild_manifest_path = tmp_path / "manifest.json"
osbuild_manifest_path.write_bytes(output)
subprocess.run(["osbuild", osbuild_manifest_path.as_posix()], check=True)


@pytest.mark.parametrize("use_librepo", [False, True])
def test_iso_manifest_use_librepo(build_container, use_librepo):
# no need to parameterize this test, --use-librepo behaves same for all containers
container_ref = "quay.io/centos-bootc/centos-bootc:stream9"

output = subprocess.check_output([
*testutil.podman_run_common,
build_container,
"manifest",
"--type=anaconda-iso",
container_ref,
f"--use-librepo={use_librepo}",
])
manifest = json.loads(output)
if use_librepo:
assert "org.osbuild.librepo" in manifest["sources"]
else:
assert "org.osbuild.curl" in manifest["sources"]
5 changes: 5 additions & 0 deletions test/testcases.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class TestCase:
sign: bool = False
# use special disk_config like "lvm"
disk_config: str = ""
# use librepo for the downloading
use_librepo: bool = False

def bib_rootfs_args(self):
if self.rootfs:
Expand All @@ -45,12 +47,14 @@ def __str__(self):
class TestCaseFedora(TestCase):
container_ref: str = "quay.io/fedora/fedora-bootc:40"
rootfs: str = "btrfs"
use_librepo: bool = True


@dataclasses.dataclass
class TestCaseFedora42(TestCase):
container_ref: str = "quay.io/fedora/fedora-bootc:42"
rootfs: str = "btrfs"
use_librepo: bool = True


@dataclasses.dataclass
Expand All @@ -65,6 +69,7 @@ class TestCaseC10S(TestCase):
container_ref: str = os.getenv(
"BIB_TEST_BOOTC_CONTAINER_TAG",
"quay.io/centos-bootc/centos-bootc:stream10")
use_librepo: bool = True


def test_testcase_nameing():
Expand Down

0 comments on commit 09b487c

Please sign in to comment.