Skip to content

Commit

Permalink
Enable needs-restarting tests
Browse files Browse the repository at this point in the history
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 rpm-software-management/dnf5#887

For rpm-software-management/dnf5#743
  • Loading branch information
evan-goode authored and jan-kolarik committed Nov 15, 2023
1 parent 9942c73 commit 71bec5b
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 5 deletions.
35 changes: 30 additions & 5 deletions dnf-behave-tests/dnf/plugins-core/needs-restarting.feature
Original file line number Diff line number Diff line change
@@ -1,43 +1,68 @@
@dnf5
@bz1639468
Feature: Reboot hint

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
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
"""
<REPOSYNC>
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
"""
<REPOSYNC>
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
"""
<REPOSYNC>
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
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,27 @@
</collection>
</pkglist>
</update>
<update from="[email protected]" status="final" type="enhancement" version="3">
<id>FEDORA-2999:003-03</id>
<title>lz4 enhacements</title>
<issued date="2019-01-17 00:00:00"/>
<updated date="2019-01-17 00:00:00"/>
<severity>Moderate</severity>
<summary>summary_1</summary>
<description>Enhance some stuff, reboot_suggested=True</description>
<references>
<reference href="https://foobar/foobarupdate_1" id="1" type="self" title="update_1"/>
</references>
<pkglist>
<collection short="named collection">
<name>Bar component</name>
<package name="lz4" version="1.8.2" release="2.fc29" epoch="0" arch="x86_64" src="lz4-0:1.8.2-2.fc29.x86_64.rpm">
<filename>lz4-0:1.8.2-2.fc29.x86_64.rpm</filename>
<reboot_suggested>True</reboot_suggested>
</package>
</collection>
</pkglist>
</update>
<update from="[email protected]" status="final" type="bugfix" version="3">
<id>FEDORA-2019-348e185000</id>
<title>kernel bug fix</title>
Expand Down

0 comments on commit 71bec5b

Please sign in to comment.