From 71bec5b85216d7c7b1ef42c92f3ce0f2a0e5127f Mon Sep 17 00:00:00 2001 From: Evan Goode Date: Wed, 8 Nov 2023 17:15:31 -0500 Subject: [PATCH] Enable needs-restarting tests Update the needs-restarting tests for DNF 5 and add a test for recommending a reboot when a package has an associated reboot_suggested advisory. Requires https://github.com/rpm-software-management/dnf5/pull/887 For https://github.com/rpm-software-management/dnf5/issues/743 --- .../dnf/plugins-core/needs-restarting.feature | 35 ++++++++++++++++--- .../dnf-ci-fedora-updates/updateinfo.xml | 21 +++++++++++ 2 files changed, 51 insertions(+), 5 deletions(-) diff --git a/dnf-behave-tests/dnf/plugins-core/needs-restarting.feature b/dnf-behave-tests/dnf/plugins-core/needs-restarting.feature index d0364738d..8a8cec0c2 100644 --- a/dnf-behave-tests/dnf/plugins-core/needs-restarting.feature +++ b/dnf-behave-tests/dnf/plugins-core/needs-restarting.feature @@ -1,3 +1,4 @@ +@dnf5 @bz1639468 Feature: Reboot hint @@ -5,8 +6,12 @@ Background: Given I enable plugin "needs_restarting" And I use repository "dnf-ci-fedora" And I move the clock backward to "before boot-up" - And I execute dnf with args "install lame kernel basesystem glibc wget" - And I move the clock forward to "2 hours" + And I execute dnf with args "install lame kernel basesystem glibc wget lz4" + And I move the clock forward to "the present" + # Boot time is measured down to the second, so sleep for one second so + # the time packages are installed is at least one second after container + # boot + And I sleep for "1" seconds And I use repository "dnf-ci-fedora-updates" @bz1913962 @@ -14,30 +19,50 @@ Scenario: Update core packages Given I execute dnf with args "upgrade kernel basesystem" And I execute dnf with args "upgrade glibc" And I execute dnf with args "upgrade lame wget" - When I execute dnf with args "needs-restarting -r" + When I execute dnf with args "needs-restarting" Then the exit code is 1 And stdout is """ + Core libraries or services have been updated since boot-up: * glibc * kernel + * kernel-core Reboot is required to fully utilize these updates. More information: https://access.redhat.com/solutions/27943 """ +@bz1913962 +Scenario: Install a package with an associated reboot_suggested advisory + Given I execute dnf with args "upgrade --advisory=FEDORA-2999:003-03 \*" + When I execute dnf with args "needs-restarting" + Then the exit code is 1 + And stdout is + """ + + Core libraries or services have been updated since boot-up: + * lz4 + + Reboot is required to fully utilize these updates. + More information: https://access.redhat.com/solutions/27943 + """ Scenario: Update non-core packages only Given I execute dnf with args "upgrade lame basesystem wget" - When I execute dnf with args "needs-restarting -r" + When I execute dnf with args "needs-restarting" Then the exit code is 0 And stdout is """ + No core libraries or services have been updated since boot-up. Reboot should not be necessary. """ +Scenario: -r short option (no-op for compatibility with DNF 4) + When I execute dnf with args "needs-restarting -r" + Then the exit code is 0 -Scenario: Long option form +Scenario: --reboothint long option (no-op for compatibility with DNF 4) When I execute dnf with args "needs-restarting --reboothint" Then the exit code is 0 diff --git a/dnf-behave-tests/fixtures/specs/dnf-ci-fedora-updates/updateinfo.xml b/dnf-behave-tests/fixtures/specs/dnf-ci-fedora-updates/updateinfo.xml index ad7909d8b..19e09d9da 100644 --- a/dnf-behave-tests/fixtures/specs/dnf-ci-fedora-updates/updateinfo.xml +++ b/dnf-behave-tests/fixtures/specs/dnf-ci-fedora-updates/updateinfo.xml @@ -44,6 +44,27 @@ + + FEDORA-2999:003-03 + lz4 enhacements + + + Moderate + summary_1 + Enhance some stuff, reboot_suggested=True + + + + + + Bar component + + lz4-0:1.8.2-2.fc29.x86_64.rpm + True + + + + FEDORA-2019-348e185000 kernel bug fix