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

update scenarios for dnf5 #1477

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions dnf-behave-tests/dnf/config-repos-overrides.feature
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Scenario: Test the overrides in "/usr/share/dnf5/repos.override.d"
[dnf-ci-fedora-updates]
enabled=1
"""
When I execute dnf with args "repolist"
When I execute dnf with args "repo list"
Then the exit code is 0
And stdout does not contain "dnf-ci-fedora\s+dnf-ci-fedora"
And stdout does not contain "dnf-ci-thirdparty-updates\s+dnf-ci-thirdparty-updates"
Expand All @@ -43,7 +43,7 @@ Scenario: The conf file in "/etc/dnf/repos.override.d" hides the file of the sam
[dnf-ci-thirdparty]
enabled=1
"""
When I execute dnf with args "repolist"
When I execute dnf with args "repo list"
Then the exit code is 0
And stdout contains "dnf-ci-fedora\s+dnf-ci-fedora"
And stdout contains "dnf-ci-thirdparty-updates\s+dnf-ci-thirdparty-updates"
Expand Down Expand Up @@ -75,7 +75,7 @@ Scenario: The configuration files are applied in alphabetical order by their nam
[dnf-ci-fedora]
enabled=0
"""
When I execute dnf with args "repolist"
When I execute dnf with args "repo list"
Then the exit code is 0
And stdout does not contain "dnf-ci-fedora\s+dnf-ci-fedora"
And stdout does not contain "dnf-ci-thirdparty-updates\s+dnf-ci-thirdparty-updates"
Expand All @@ -92,7 +92,7 @@ Scenario: Test globs in repoid
[d?f-[a-c]i-fed*]
enabled=1
"""
When I execute dnf with args "repolist"
When I execute dnf with args "repo list"
Then the exit code is 0
And stdout contains "dnf-ci-fedora\s+dnf-ci-fedora"
And stdout does not contain "dnf-ci-thirdparty-updates\s+dnf-ci-thirdparty-updates"
Expand All @@ -113,7 +113,7 @@ Scenario: Test vars in repoid
[dnf-ci-${distrib}-updates]
enabled=1
"""
When I execute dnf with args "repolist"
When I execute dnf with args "repo list"
Then the exit code is 0
And stdout does not contain "dnf-ci-fedora\s+dnf-ci-fedora"
And stdout does not contain "dnf-ci-thirdparty-updates\s+dnf-ci-thirdparty-updates"
Expand All @@ -138,7 +138,7 @@ Scenario: Test vars in configuration
[dnf-ci-fedora-updates]
enabled=${enabled}
"""
When I execute dnf with args "repolist"
When I execute dnf with args "repo list"
Then the exit code is 0
And stdout does not contain "dnf-ci-fedora\s+dnf-ci-fedora"
And stdout does not contain "dnf-ci-thirdparty-updates\s+dnf-ci-thirdparty-updates"
Expand Down
56 changes: 25 additions & 31 deletions dnf-behave-tests/dnf/config.feature
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Scenario: Test removal of dependency when clean_requirements_on_remove=false
| remove | filesystem-0:3.9-2.fc29.x86_64 |


@dnf5
Scenario: Test with dnf.conf in installroot (dnf.conf is taken from installroot)
Given I use repository "dnf-ci-fedora"
And I configure dnf with
Expand All @@ -29,14 +30,12 @@ Scenario: Test with dnf.conf in installroot (dnf.conf is taken from installroot)
Then the exit code is 1
And stderr is
"""
Error: Unable to find a match: filesystem
"""
And stdout is
"""
<REPOSYNC>
All matches were filtered out by exclude filtering for argument: filesystem
Failed to resolve the transaction:
Argument 'filesystem' matches only excluded packages.
"""


@dnf5
Scenario: Test with dnf.conf in installroot and --config (dnf.conf is taken from --config)
Given I use repository "dnf-ci-fedora"
And I configure dnf with
Expand All @@ -51,7 +50,11 @@ Scenario: Test with dnf.conf in installroot and --config (dnf.conf is taken from
Then the exit code is 0
When I execute dnf with args "--config {context.dnf.installroot}/test/dnf.conf install dwm"
Then the exit code is 1
And stdout contains "All matches were filtered out by exclude filtering for argument: dwm"
And stderr is
"""
Failed to resolve the transaction:
Argument 'dwm' matches only excluded packages.
"""


Scenario: Reposdir option in dnf.conf file in installroot
Expand Down Expand Up @@ -101,7 +104,8 @@ Scenario: Reposdir option in dnf.conf file with --config option in installroot i
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 "Error: There are no enabled repositories in "
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
Expand Down Expand Up @@ -130,12 +134,13 @@ Scenario: Reposdir option set by --setopt
| install-dep | setup-0:2.12.1-1.fc29.noarch |


@dnf5
@bz1512457
Scenario: Test usage of not existing config file
Given I use repository "dnf-ci-fedora"
When I execute dnf with args "--config {context.dnf.installroot}/non/existing/dnf.conf list"
Then the exit code is 1
And stderr contains "Config file.*does not exist"
And stderr contains "Configuration file.*not found"


@dnf5
Expand Down Expand Up @@ -168,7 +173,7 @@ Scenario: Dnf can use config file from remote location
baseurl=http://some.url/
"""
And I set up a http server for directory "/remotedir"
When I execute dnf with args "-c http://localhost:{context.dnf.ports[/remotedir]}/remote.conf repolist repo-from-remote-config"
When I execute dnf with args "--config http://localhost:{context.dnf.ports[/remotedir]}/remote.conf repo list repo-from-remote-config"
Then the exit code is 0
And stdout is
"""
Expand All @@ -177,34 +182,23 @@ Scenario: Dnf can use config file from remote location
"""


@dnf5
@bz1721091
Scenario: Dnf prints reasonable error when remote config file is not downloadable
Given I create directory "/remotedir"
And I set up a http server for directory "/remotedir"
# 404 not found
When I execute dnf with args "-c http://localhost:{context.dnf.ports[/remotedir]}/does-not-exist.conf repolist repo-from-remote-config"
When I execute dnf with args "--config http://localhost:{context.dnf.ports[/remotedir]}/does-not-exist.conf repo list repo-from-remote-config"
Then the exit code is 1
And stderr matches line by line
"""
Config error: Configuration file URL "http://localhost:[\d]+/does-not-exist\.conf" could not be downloaded:
Status code: 404 for http://localhost:[\d]+/does-not-exist\.conf
"""
And stderr contains "Configuration file.*not found"
# unsupported protocol
When I execute dnf with args "-c xxxx://localhost:{context.dnf.ports[/remotedir]}/does-not-exist.conf repolist repo-from-remote-config"
When I execute dnf with args "--config xxxx://localhost:{context.dnf.ports[/remotedir]}/does-not-exist.conf repo list repo-from-remote-config"
Then the exit code is 1
And stderr matches line by line
"""
Config error: Configuration file URL "xxxx://localhost:[\d]+/does-not-exist\.conf" could not be downloaded:
Curl error \(1\): Unsupported protocol for xxxx://localhost:[\d]+/does-not-exist\.conf \[Protocol "xxxx" not supported or disabled in libcurl\]
"""
And stderr contains "Configuration file.*not found"
# host unknown
When I execute dnf with args "-c http://the_host:{context.dnf.ports[/remotedir]}/does-not-exist.conf repolist repo-from-remote-config"
When I execute dnf with args "--config http://the_host:{context.dnf.ports[/remotedir]}/does-not-exist.conf repo list repo-from-remote-config"
Then the exit code is 1
And stderr matches line by line
"""
Config error: Configuration file URL "http://the_host:[\d]+/does-not-exist\.conf" could not be downloaded:
Curl error \(6\): Couldn't resolve host name for http://the_host:[\d]+/does-not-exist\.conf \[Could not resolve host: the_host\]
"""
And stderr contains "Configuration file.*not found"


@no_installroot
Expand All @@ -229,7 +223,7 @@ Scenario: Create dnf.conf file and test if host is using /etc/dnf/dnf.conf


@no_installroot
Scenario: Create dnf.conf file and test if host is taking option -c /test/dnf.conf file
Scenario: Create dnf.conf file and test if host is taking option --config /test/dnf.conf file
Given I use repository "simple-base"
And I create file "/etc/dnf/dnf.conf" with
"""
Expand All @@ -241,13 +235,13 @@ Scenario: Create dnf.conf file and test if host is taking option -c /test/dnf.co
[main]
exclude=dedalo-signed
"""
When I execute dnf with args "-c /test/dnf.conf install vagare"
When I execute dnf with args "--config /test/dnf.conf 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 |
When I execute dnf with args "-c /test/dnf.conf install dedalo-signed"
When I execute dnf with args "--config /test/dnf.conf install dedalo-signed"
Then the exit code is 1
And stdout is
"""
Expand Down
23 changes: 8 additions & 15 deletions dnf-behave-tests/dnf/encoding.feature
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Feature: Test encoding


# @dnf5
# TODO(nsella) different stdout
@dnf5
Scenario: UTF-8 characters in .repo filename
Given I configure dnf with
| key | value |
Expand All @@ -12,14 +11,14 @@ Scenario: UTF-8 characters in .repo filename
| baseurl | {context.scenario.repos_location}/dnf-ci-fedora |
And I copy file "{context.dnf.installroot}/testrepos/testrepo.repo" to "testrepos/ř.repo"
And I delete file "/testrepos/testrepo.repo"
When I execute dnf with args "repolist"
When I execute dnf with args "repo list"
Then the exit code is 0
And stdout contains "testrepo\s+testrepo test repository"
And stderr is empty


# @dnf5
# TODO(nsella) different stderr
@dnf5
# dnf5 is OK with that in comparison with dnf4
@bz1803038
Scenario: non-UTF-8 characters in .repo filename
Given I configure dnf with
Expand All @@ -30,14 +29,10 @@ Scenario: non-UTF-8 characters in .repo filename
| baseurl | {context.scenario.repos_location}/dnf-ci-fedora |
And I copy file "{context.dnf.installroot}/testrepos/testrepo.repo" to "testrepos/{context.invalid_utf8_char}.repo"
And I delete file "/testrepos/testrepo.repo"
When I execute dnf with args "repolist"
When I execute dnf with args "repo list"
Then the exit code is 0
And stdout is empty
And stderr is
"""
Warning: failed loading '{context.dnf.installroot}/testrepos/\udcfd.repo', skipping.
No repositories available
"""
And stdout contains "testrepo\s+testrepo test repository"
And stderr is empty


# @dnf5
Expand Down Expand Up @@ -93,9 +88,7 @@ Scenario: non-UTF-8 character in an option when using corresponding locale
| install | dummy-1:1.0-1.x86_64 |


# @dnf5
# TODO(nsella) Unknown argument "--list" for command "repoquery"
# Requires: https://github.com/rpm-software-management/libdnf/commit/6c2ac6786a423c00750a44805ade0268dd6d19e5
@dnf5
@not.with_os=rhel__eq__9
@bz1893176
Scenario: non-UTF-8 character in filename in an installed package
Expand Down
3 changes: 2 additions & 1 deletion dnf-behave-tests/dnf/failovermethod.feature
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
@dnf5
Feature: Test behavior of failovermethod repo config option

@bz2039906
Scenario: No error in stderr when failovermethod=priority is present in repo config
Given I configure a new repository "failovermethod" with
| key | value |
| failovermethod | priority |
When I execute dnf with args "repolist"
When I execute dnf with args "repo list"
Then the exit code is 0
And stderr is empty
6 changes: 2 additions & 4 deletions dnf-behave-tests/dnf/gpg-noeol.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ Background: Add repository with gpgcheck=1
Then the exit code is 1


# the scenario is failing with rpm on Fedora 30:
# rpm --import gpgkeys/keys/dnf-ci-gpg-noeol/dnf-ci-gpg-noeol-public
# error: gpgkeys/keys/dnf-ci-gpg-noeol/dnf-ci-gpg-noeol-public: key 1 not an armored public key.
@use.with_os=rhel__ge__8
# used to be disabled for Fedora due to a rpm failure,
# however, it works OK now (F39)
@bz1733971
Scenario: Import the GPG key without any EOL characters at EOF
When I execute rpm with args "--import {context.dnf.fixturesdir}/gpgkeys/keys/dnf-ci-gpg-noeol/dnf-ci-gpg-noeol-public"
Expand Down
19 changes: 11 additions & 8 deletions dnf-behave-tests/dnf/installroot.feature
Original file line number Diff line number Diff line change
Expand Up @@ -69,27 +69,26 @@ Scenario: Remove package from installroot
| remove | water_carbonated-0:1.0-1.x86_64 |


# @dnf5
# TODO(nsella) different stdout
@dnf5
@force_installroot
Scenario: Repolist command in installroot and with a reposdir specified
Given I use repository "dnf-ci-install-remove"
When I execute dnf with args "repolist"
When I execute dnf with args "repo list"
Then the exit code is 0
And stdout is
"""
repo id repo name
dnf-ci-install-remove dnf-ci-install-remove test repository
repo id repo name
dnf-ci-install-remove dnf-ci-install-remove test repository
"""
Given I configure a new repository "testrepo" in "{context.dnf.tempdir}/repos.d" with
| key | value |
| baseurl | {context.scenario.repos_location}/dnf-ci-install-remove |
When I execute dnf with args "--setopt=reposdir={context.dnf.tempdir}/repos.d repolist"
When I execute dnf with args "--setopt=reposdir={context.dnf.tempdir}/repos.d repo list"
Then the exit code is 0
And stdout is
"""
repo id repo name
testrepo testrepo test repository
repo id repo name
testrepo testrepo test repository
"""


Expand All @@ -114,6 +113,10 @@ Scenario: Upgrade package in installroot

# @dnf5
# TODO(nsella) different stderr
# (emrakova) in fact, the requested info is not provided:
# stdout: No repositories were loaded from the installroot. To use the configuration and repositories of the host system, pass --use-host-config.
# stderr: Failed to resolve the transaction: No match for argument: sugar
# issue: https://github.com/rpm-software-management/dnf5/issues/1325
@bz1658579
Scenario: Installroot directory is listed when there are no repos
When I execute dnf with args "install sugar"
Expand Down
7 changes: 4 additions & 3 deletions dnf-behave-tests/dnf/microdnf/config-with-repos.feature
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# no bug, PR https://github.com/rpm-software-management/libdnf/pull/882
@dnf5
@no_installroot
# no bug, PR https://github.com/rpm-software-management/libdnf/pull/882
Feature: Repositories configured in main configuration file


Expand All @@ -22,7 +23,7 @@ Background: Configure repositories in the main configuration file


Scenario: Repositories configured only in the main configuration file
When I execute microdnf with args "repolist --all"
When I execute microdnf with args "repo list --all"
Then the exit code is 0
And stdout is
"""
Expand All @@ -38,7 +39,7 @@ Scenario: Repositories configured in the main configuration file and in *.repo f
And I use repository "dnf-ci-fedora-updates" with configuration
| key | value |
| enabled | 0 |
When I execute microdnf with args "repolist --all"
When I execute microdnf with args "repo list --all"
Then the exit code is 0
And stdout is
"""
Expand Down
10 changes: 5 additions & 5 deletions dnf-behave-tests/dnf/vars.feature
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@dnf5
Feature: Subtitute variables
Feature: Substitute variables


@bz1651092
Expand Down Expand Up @@ -41,7 +41,7 @@ Scenario: Variables arch supports basearch `loongarch64` {}
name=dnf-ci-test-$distrib test repository
enabled=0
"""
When I execute dnf with args "repolist --disabled --setvar=arch=loongarch64"
When I execute dnf with args "repo list --disabled --setvar=arch=loongarch64"
Then the exit code is 0
And stdout matches line by line
"""
Expand All @@ -62,7 +62,7 @@ Scenario: Variables without {} are substituted in repo id
name=dnf-ci-test-$distrib test repository
enabled=0
"""
When I execute dnf with args "repolist --disabled"
When I execute dnf with args "repo list --disabled"
Then the exit code is 0
And stdout matches line by line
"""
Expand All @@ -81,7 +81,7 @@ Scenario: Variables with {} are substituted in repo id
name=dnf-ci-test-${distrib} test repository
enabled=0
"""
When I execute dnf with args "repolist --disabled"
When I execute dnf with args "repo list --disabled"
Then the exit code is 0
And stdout matches line by line
"""
Expand All @@ -93,7 +93,7 @@ Scenario: Variables with {} are substituted in repo id
Scenario: Using dnf with non-files in /etc/dnf/vars
Given I create directory "/{context.dnf.installroot}/etc/dnf/vars/troublemaker"
And I use repository "dnf-ci-fedora"
When I execute dnf with args "repolist"
When I execute dnf with args "repo list"
Then the exit code is 0
And stdout matches line by line
"""
Expand Down
Loading