From b04414fd49b54652137ddb6bf6082e43cdc16d8b Mon Sep 17 00:00:00 2001 From: bgrech Date: Thu, 6 Oct 2022 09:35:53 -0500 Subject: [PATCH] Fix recommended packages handling for rpm-ostree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bugfix for missing packages install failure on recommends fmf request, missing should retrieve parent.missing attribute not packages. Extend the test coverage for fedora-coreos as well. Co-authored-by: Petr Šplíchal --- tests/prepare/recommend/main.fmf | 11 +++++++++++ tests/prepare/recommend/test.sh | 25 ++++++++++++++++++++++--- tmt/steps/prepare/install.py | 2 +- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/tests/prepare/recommend/main.fmf b/tests/prepare/recommend/main.fmf index fa232b38b5..0503836796 100644 --- a/tests/prepare/recommend/main.fmf +++ b/tests/prepare/recommend/main.fmf @@ -3,3 +3,14 @@ description: Run a simple test which recommends two packages. Check that the existing one is installed and the other one is ignored. No error should be reported. +environment: + METHODS: container +adjust: + - when: trigger == commit + environment: + METHODS: container local + because: the pipeline does not support nested virtualization + - when: how == full + environment: + METHODS: container virtual local + because: local/virtual provision needs root/full virtualization diff --git a/tests/prepare/recommend/test.sh b/tests/prepare/recommend/test.sh index 22308efc76..7c4740ae56 100755 --- a/tests/prepare/recommend/test.sh +++ b/tests/prepare/recommend/test.sh @@ -6,10 +6,29 @@ rlJournalStart rlRun "pushd data" rlPhaseEnd - for image in centos:7 centos:stream8 fedora; do - rlPhaseStartTest "Test $image" - rlRun "tmt run -ar provision -h container -i $image" + for method in ${METHODS:-container}; do + tmt="tmt run --all --remove provision --how $method" + + # Verify against the default provision image + rlPhaseStartTest "Test the default image ($method)" + rlRun "$tmt" rlPhaseEnd + + # Check CentOS images for container provision + if [[ "$method" == "container" ]]; then + for image in centos:7 centos:stream8; do + rlPhaseStartTest "Test $image ($method)" + rlRun "$tmt --image $image" + rlPhaseEnd + done + fi + + # Add one extra CoreOS run for virtual provision + if [[ "$method" == "virtual" ]]; then + rlPhaseStartTest "Test fedora-coreos ($method)" + rlRun "$tmt --image fedora-coreos" + rlPhaseEnd + fi done rlPhaseStartCleanup diff --git a/tmt/steps/prepare/install.py b/tmt/steps/prepare/install.py index b41f4ec6e5..9072aa3516 100644 --- a/tmt/steps/prepare/install.py +++ b/tmt/steps/prepare/install.py @@ -292,7 +292,7 @@ def sort_packages(self) -> None: def prepare_command(self) -> None: """ Prepare installation command for rpm-ostree""" - missing = cast(tmt.steps.prepare.PreparePlugin, self.parent).get("package") + missing = cast(tmt.steps.prepare.PreparePlugin, self.parent).get("missing") self.skip = True if missing == 'skip' else False self.command = f"{self.sudo}rpm-ostree" self.options = '--apply-live --idempotent --allow-inactive'