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

revise config.feature for dnf5 #1564

Merged
merged 4 commits into from
Oct 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 49 additions & 54 deletions dnf-behave-tests/dnf/config.feature
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
Feature: DNF config files testing


@dnf5
Scenario: Test removal of dependency when clean_requirements_on_remove=false
Given I use repository "dnf-ci-fedora"
And I configure dnf with
| key | value |
| exclude | filesystem |
| clean_requirements_on_remove | False |
When I execute dnf with args "install --disableexcludes=main filesystem"
When I execute dnf with args "install --setopt=disable_excludes=main filesystem"
Then the exit code is 0
And Transaction is following
| Action | Package |
| install | filesystem-0:3.9-2.fc29.x86_64 |
| install-dep | setup-0:2.12.1-1.fc29.noarch |
When I execute dnf with args "remove --disableexcludes=all filesystem"
When I execute dnf with args "remove --setopt=disable_excludes=* filesystem"
Then the exit code is 0
And Transaction is following
| Action | Package |
Expand Down Expand Up @@ -59,6 +60,7 @@ Scenario: Test with dnf.conf in installroot and --config (dnf.conf is taken from
"""


@dnf5
Scenario: Reposdir option in dnf.conf file in installroot
Given I configure dnf with
| key | value |
Expand All @@ -75,6 +77,7 @@ Scenario: Reposdir option in dnf.conf file in installroot
| install-dep | setup-0:2.12.1-1.fc29.noarch |


@dnf5
Scenario: Reposdir option in dnf.conf file with --config option in installroot
Given I create file "/test/dnf.conf" with
"""
Expand All @@ -93,30 +96,7 @@ Scenario: Reposdir option in dnf.conf file with --config option in installroot
| install-dep | setup-0:2.12.1-1.fc29.noarch |


Scenario: Reposdir option in dnf.conf file with --config option in installroot is taken first from installroot then from host
Given I create and substitute file "/test/dnf.conf" with
"""
[main]
reposdir={context.dnf.installroot}/testrepos,/othertestrepos
"""
And I generate repodata for repository "dnf-ci-fedora"
And I configure a new repository "testrepo" in "{context.dnf.installroot}/testrepos" with
| key | value |
| baseurl | {context.scenario.repos_location}/dnf-ci-fedora |
And I create directory "/othertestrepos"
When I execute dnf with args "--config {context.dnf.installroot}/test/dnf.conf install filesystem"
Then the exit code is 1
And stderr contains "No match for argument: filesystem"
And stdout contains "No repositories were loaded from the installroot. To use the configuration and repositories of the host system, pass --use-host-config."
Given I delete directory "/othertestrepos"
When I execute dnf with args "--config {context.dnf.installroot}/test/dnf.conf install filesystem"
Then the exit code is 0
And Transaction is following
| Action | Package |
| install | filesystem-0:3.9-2.fc29.x86_64 |
| install-dep | setup-0:2.12.1-1.fc29.noarch |


@dnf5
Scenario: Reposdir option set by --setopt
Given I configure a new repository "testrepo" in "{context.dnf.installroot}/testrepos" with
| key | value |
Expand Down Expand Up @@ -174,6 +154,8 @@ Scenario: Lines that contain only whitespaces do not spoil previous config optio
"""


# dnf5 does not support remote config files
# https://github.com/rpm-software-management/dnf5/issues/1767
@bz1721091
Scenario: Dnf can use config file from remote location
Given I create directory "/remotedir"
Expand Down Expand Up @@ -211,6 +193,7 @@ Scenario: Dnf prints reasonable error when remote config file is not downloadabl
And stderr contains "Configuration file.*not found"


@dnf5
@no_installroot
Scenario: Create dnf.conf file and test if host is using /etc/dnf/dnf.conf
Given I use repository "simple-base"
Expand All @@ -221,17 +204,13 @@ Scenario: Create dnf.conf file and test if host is using /etc/dnf/dnf.conf
"""
When I execute dnf with args "install vagare"
Then the exit code is 1
And stdout is
"""
All matches were filtered out by exclude filtering for argument: vagare
"""
And stderr is
"""
<REPOSYNC>
Error: Unable to find a match: vagare
"""
# rhsm plugin is polluting stderr with messages, we cannot use "stderr is" step
# librhsm-WARNING **: 12:59:28.478: Found 0 entitlement certificates
# librhsm-WARNING **: 12:59:28.478: Found 0 product certificates
And stderr contains "Argument 'vagare' matches only excluded packages."


@dnf5
@no_installroot
Scenario: Create dnf.conf file and test if host is taking option --config /test/dnf.conf file
Given I use repository "simple-base"
Expand All @@ -253,41 +232,57 @@ Scenario: Create dnf.conf file and test if host is taking option --config /test/
| install-dep | labirinto-1.0-1.fc29.x86_64 |
When I execute dnf with args "--config /test/dnf.conf install dedalo-signed"
Then the exit code is 1
And stdout is
"""
All matches were filtered out by exclude filtering for argument: dedalo-signed
"""
And stderr is
"""
<REPOSYNC>
Error: Unable to find a match: dedalo-signed
"""
# rhsm plugin is polluting stderr with messages, we cannot use "stderr is" step
# librhsm-WARNING **: 12:59:28.478: Found 0 entitlement certificates
# librhsm-WARNING **: 12:59:28.478: Found 0 product certificates
And stderr contains "Argument 'dedalo-signed' matches only excluded packages."


@dnf5
@destructive
Scenario: Test without dnf.conf in installroot (dnf.conf is taken from host)
Scenario: dnf.conf is not taken from host even even if the file in installroot does not exist
Given I use repository "simple-base"
# create host config file
And I create file "//etc/dnf/dnf.conf" with
And I create and substitute file "//etc/dnf/dnf.conf" with
"""
[main]
exclude=vagare
reposdir={context.dnf.installroot}/etc/yum.repos.d
"""
# ensure there is no dnf.conf in the installroot
And I delete file "/etc/dnf/dnf.conf"
When I execute dnf with args "install vagare"
Then the exit code is 0
And Transaction is following
| Action | Package |
| install | vagare-1.0-1.fc29.x86_64 |
| install-dep | labirinto-1.0-1.fc29.x86_64 |


@dnf5
@destructive
Scenario: dnf.conf is taken from host if --use-host-config is used
Given I use repository "simple-base"
# create host config file
And I create and substitute file "//etc/dnf/dnf.conf" with
"""
[main]
exclude=vagare
reposdir={context.dnf.installroot}/etc/yum.repos.d
"""
# ensure there is no dnf.conf in the installroot
And I delete file "/etc/dnf/dnf.conf"
When I execute dnf with args "install vagare --use-host-config"
Then the exit code is 1
And stdout is
"""
All matches were filtered out by exclude filtering for argument: vagare
"""
And stderr is
"""
<REPOSYNC>
Error: Unable to find a match: vagare
"""
"""
<REPOSYNC>
Failed to resolve the transaction:
Argument 'vagare' matches only excluded packages.
"""


@dnf5
@no_installroot
Scenario: Reposdir option in dnf.conf file in host
Given I configure dnf with
Expand Down
Loading