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

Add tests for dnf5 config-manager #1402

Merged

Conversation

jrohel
Copy link
Contributor

@jrohel jrohel commented Nov 7, 2023

@jrohel jrohel force-pushed the feature/dnf5_config_manager_tests branch from 7788d71 to 70bad0b Compare November 7, 2023 10:17
@j-mracek j-mracek self-assigned this Nov 9, 2023


Background:
Given I enable plugin "config_manager"
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not a problem of the PR, but personally I would prefer that we will not require to enable a particular plugin in test.

Copy link
Contributor Author

@jrohel jrohel Nov 13, 2023

Choose a reason for hiding this comment

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

I removed enabling of plugin. Plugins are enabled by default in configuration file.



Scenario: test "addrepo" from repofile, destination directory does not exist, "--create-missing-dir" creates missing directory
Given I delete directory "/etc/yum.repos.d/"
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor: I believe that there should be an additional space before Given:. This is valid for multiple steps.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added space before Given

enabled=1
baseurl=http://something1.com/os/
"""
And I create file "/etc/yum.repos.d/repo2.repo" with
Copy link
Contributor

@j-mracek j-mracek Nov 10, 2023

Choose a reason for hiding this comment

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

May be I overlooked something, but it looks like that repository repo2 is not used in any test in the feature file. Is there any reason to create it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Repo2 was unused in this file. I deleted its creation.



Scenario: repository configuration overrides - new option to "repo1"
Given I create directory "/etc/dnf/repos.override.d/"
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess that should be additional space.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added

"""


Scenario: unset/remove an main option, trying to unset an not set option is OK
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not a problem of the test. What about to create a warning when option is not present in config file. It will help to discover typos - dnf config-manager unsetopt bests. I think that return value 0 is OK for this case. What do you think?

priority=50
skip_if_unavailable=0
"""
When I execute dnf with args "config-manager unsetopt repo1.priority"
Copy link
Contributor

Choose a reason for hiding this comment

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

This use case must be well documented in man pages - config-manager does not touch original repository definition but only creates or remove overrides

"""


Scenario: repository configuration overrides - unset/remove option, trying to unset an not set option is OK
Copy link
Contributor

Choose a reason for hiding this comment

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

I think a warning for repository use case is essential. When I have a repository in yum.repos.d and I would like to modify the file by removing an option, config manager is not fulfill the requirement silently.

"""


Scenario: unset/remove an existing variable, removing non-existent variable is OK
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we have a warning for this case?

Copy link
Contributor

@j-mracek j-mracek left a comment

Choose a reason for hiding this comment

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

Only minor changes requested

@j-mracek
Copy link
Contributor

There are old test that use config-manager in CI-DNF-STACK that might be enabled:

config.feature and Scenario: Lines that contain only whitespaces do not spoil previous config options
plugins-core/config-manager.feature

They could be enabled in the next PR. @jrohel What do you think?

New tests for dnf5 "config-manager" have been written. They cover many more
use cases than the original tests for dnf4 "config-manager". It serves
as a replacement for the original tests.
In addition, dnf5 "config-manager" has incompatible parameters and
functionality, and therefore the original tests for dnf4 "config-manager"
could not be used.
Original dnf4 test "Scenario: Lines that contain only whitespaces do not
spoil previous config options" uses "config-manager --dump" to verify
the value of the repository configuration option.

In dnf5, the global configuration argument "--dump-repo-config" is used
instead.
@jrohel jrohel force-pushed the feature/dnf5_config_manager_tests branch from c56310c to 13e6514 Compare November 13, 2023 11:13
@jrohel
Copy link
Contributor Author

jrohel commented Nov 13, 2023

As agreed, I made changes to the CI tests that do not require modifications to the "config-manager" plugin source code.

Copy link
Contributor

@j-mracek j-mracek left a comment

Choose a reason for hiding this comment

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

LGTM

@j-mracek j-mracek merged commit 9942c73 into rpm-software-management:main Nov 13, 2023
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants