From 7719f1641107e337843792011169dc5999d8b018 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Mon, 17 Jul 2023 15:30:18 +0200 Subject: [PATCH] Add a new test to check that extras pkgs can be installed This test gets a list of extra packages from https://reports.xcp-ng.org//extra_installable.txt and checks that: - the package is available and dependencies resolved using yumdownloader - all packages can be installed. Before installing packages it saves the yum state and restores it after the installation. Signed-off-by: Guillaume --- tests/packages/extra/conftest.py | 12 ++++++++++++ tests/packages/extra/test_extra_group_pkgs.py | 11 +++++++++++ 2 files changed, 23 insertions(+) create mode 100644 tests/packages/extra/conftest.py create mode 100644 tests/packages/extra/test_extra_group_pkgs.py diff --git a/tests/packages/extra/conftest.py b/tests/packages/extra/conftest.py new file mode 100644 index 000000000..b67b56356 --- /dev/null +++ b/tests/packages/extra/conftest.py @@ -0,0 +1,12 @@ +import logging +import pytest +import urllib.request + +@pytest.fixture(scope="session") +def extra_pkgs(host): + version = host.xcp_version + url = f"https://reports.xcp-ng.org/{version}/extra_installable.txt" + + logging.info(f"Getting extra packages from {url}") + response = urllib.request.urlopen(url) + return response.read().decode('utf-8').splitlines() diff --git a/tests/packages/extra/test_extra_group_pkgs.py b/tests/packages/extra/test_extra_group_pkgs.py new file mode 100644 index 000000000..f590242be --- /dev/null +++ b/tests/packages/extra/test_extra_group_pkgs.py @@ -0,0 +1,11 @@ +# Explicitly import package-scoped fixtures (see explanation in pkgfixtures.py) +from pkgfixtures import host_with_saved_yum_state + +def test_extra_group_packages_url_resolved(host, extra_pkgs): + for p in extra_pkgs: + host.ssh(['yumdownloader', '--resolve', '--urls', p]) + +def test_extra_group_packages_can_be_installed(host_with_saved_yum_state, extra_pkgs): + # Just try to install all packages together. Installing them one by one + # takes too much time due to the generation of the initrd. + host_with_saved_yum_state.yum_install(extra_pkgs)