Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[needs-restarting] add opt using config file (RhBug:1810123) #814

Merged

Conversation

inknos
Copy link
Contributor

@inknos inknos commented Apr 3, 2020

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 abcde"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this list of packages is unnecessary, you're only ever using wget and abcde from the list?

While not necessary, I'd prefer if you set up a single repository with the 3 packages you're using and used only that in the feature file, to make it a bit cleaner... I'm not requiring it though.

Scenario: restarting needed after updating package in conf files
Given I execute dnf with args "upgrade wget"
When I execute dnf with args "needs-restarting -r"
Then the exit code is 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to your PR, so consider this a rhetorical question 🙂 but is it really returning a non-zero exit status when there are packages to restart? That doesn't make sense...

@@ -0,0 +1,21 @@
Name: test
Version: 1.0.0
Release: 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: the release actually doesn't contain "fc29", which you have in the filename, you could remove it, but whatever... 🙂

Given I create and substitute file "/etc/dnf/plugins/needs-restarting.d/abcde.conf" with
"""
abcde
"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really sure at what indent we are putting the text blocks, but this is inconsistent with the other text blocks in this file, please unify it (more occurrences below).

abcde
"""
And I execute dnf with args "upgrade wget abcde"
Then the exit code is 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually is a setup step to test the needs-restarting functionality. You should use this instead of the two above lines:

Given I successfully execute dnf with args "upgrade wget abcde"

(Or, in this case Given is the active step so you should use And)

More occurrences of this below.

@@ -0,0 +1,22 @@
Name: abcde
Version: 2.9.3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to use simple versions for the test packages, like 1.0, so that you don't need to squint when you have multiple versions of a package like 3.14.1.1 and 3.14.7.1 and try to figure out which is which 😎 But feel free to keep it here, not much of an issue in this case.

BuildArch: noarch
Requires: wget
Recommends: flac
Suggests: lame
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are attributes on the packages like the above which are irrelevant to the test and therefore superfluous (also the lengthy %descriptions). Again, not hurting anything and they are not too long, so feel free to keep them but in general it's good practice to keep the test data minimal to the test case.

@lukash lukash merged commit cc90ea5 into rpm-software-management:master Jun 10, 2020
@inknos inknos deleted the ns-needs-restarting-list branch January 11, 2022 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants