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

Review tests in microdnf directory #1579

Merged
merged 26 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
13ef617
Merge install-nodocs tests and move them to dnf
kontura Nov 4, 2024
4be6d6d
Move remote install test from microdnf to dnf
kontura Nov 5, 2024
d74a513
Remove duplicate microdnf install tests
kontura Nov 5, 2024
1a10175
Move microdnf reinstall tests to dnf
kontura Nov 5, 2024
866183d
Remove duplicate microdnf reinstall tests
kontura Nov 5, 2024
349d187
Move microdnf vars tests to dnf
kontura Nov 5, 2024
8fc17a2
Move microdnf config-with-repos tests to dnf
kontura Nov 5, 2024
dce2449
Move microdnf zchunk tests to dnf
kontura Nov 5, 2024
1a0b353
Clean up and enable zchunk tests
kontura Nov 5, 2024
95eee05
Remove duplicate microdnf error_messages tests
kontura Nov 5, 2024
02e72d5
Remove duplicate microdnf exclude_from_weak tests
kontura Nov 5, 2024
ab35c4a
Remove duplicate microdnf gpg tests
kontura Nov 5, 2024
1131b4c
Move microdnf install_weak_deps tests to dnf
kontura Nov 5, 2024
dbbc4bb
Remove duplicate microdnf installonlypkgs tests
kontura Nov 5, 2024
d4da7ac
Merge microdnf makecache tests into dnf
kontura Nov 5, 2024
e7612b3
Fix metadata tests: ensure the metadata were refreshed on update
kontura Nov 6, 2024
6e46eb4
Merge and update metadata_cache tests for dnf
kontura Nov 6, 2024
240e1f4
Remove duplicate microdnf module tests
kontura Nov 6, 2024
3aeeab5
Merge microdnf module-reset tests to dnf
kontura Nov 6, 2024
a642112
Remove duplicate microdnf protect* tests
kontura Nov 6, 2024
295fd1f
Convert microdnf remove-pkgspec test to dnf and remove duplicates
kontura Nov 6, 2024
564d4b5
Move microdnf repo-config tests to dnf
kontura Nov 6, 2024
7724f45
Remove duplicate microdnf repoquery tests
kontura Nov 6, 2024
ed8b596
Remove duplicate microdnf upgrade tests
kontura Nov 6, 2024
61bf88f
Remove duplicate midrodnf repolist tests
kontura Nov 6, 2024
e81c967
Remove unused microdnf specific code
kontura Nov 6, 2024
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@dnf5
@no_installroot
# no bug, PR https://github.com/rpm-software-management/libdnf/pull/882
Feature: Repositories configured in main configuration file

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


Scenario: Repositories configured only in the main configuration file
When I execute microdnf with args "repo list --all"
When I execute dnf with args "repo list --all"
Then the exit code is 0
And stdout is
"""
Expand All @@ -39,7 +38,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 "repo list --all"
When I execute dnf with args "repo list --all"
Then the exit code is 0
And stdout is
"""
Expand Down
40 changes: 0 additions & 40 deletions dnf-behave-tests/dnf/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,46 +172,6 @@ def get_dnf4_cmd(self, context):

return result

def get_microdnf_cmd(self, context):
result = ["microdnf"]
result.append(self.assumeyes_option)

# installroot can't be set via context for safety reasons
if self.installroot and self.installroot != "/":
result.append("--installroot={0}".format(self.installroot))

# Microdnf in installroot mode requires the following options to be set.
# The calculation of their default values is not implemented in microdnf.
# New rules for default values are still being discussed.
result.append("--noplugins")
result.append("--config={0}".format(os.path.join(self.installroot, "etc/dnf/dnf.conf")))
result.append("--setopt=reposdir={0}".format(os.path.join(self.installroot, "etc/yum.repos.d")))
result.append("--setopt=varsdir={0}".format(os.path.join(self.installroot, "etc/dnf/vars")))
result.append("--setopt=cachedir={0}".format(os.path.join(self.installroot, "var/cache/yum")))

releasever = self._get("releasever")
if releasever:
result.append("--releasever={0}".format(releasever))

module_platform_id = self._get("module_platform_id")
if module_platform_id:
result.append("--setopt=module_platform_id={0}".format(module_platform_id))

# Plugins support is disabled in installroot mode. We can't disable/enable plugins.
if not self.installroot or self.installroot == "/":
disable_plugins = self._get("disable_plugins")
if disable_plugins:
result.append("--noplugins")
plugins = self._get("plugins") or []
for plugin in plugins:
result.append("--enableplugin='{0}'".format(plugin))

setopts = self._get("setopts") or {}
for key, value in setopts.items():
result.append("--setopt={0}={1}".format(key, value))

return result

def get_dnf5_cmd(self, context):
result = [self.dnf_command]
result.append(self.assumeyes_option)
Expand Down
2 changes: 1 addition & 1 deletion dnf-behave-tests/dnf/error_messages.feature
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Scenario: Repository option 'proxy_username' is set but not 'proxy_password'
Then the exit code is 1
And stderr contains "'proxy_username' is set but not 'proxy_password'"

@dnf5

Scenario: Nested exception is printed when max parallel downloads are exceeded
Given I use repository "dnf-ci-fedora"
And I configure dnf with
Expand Down
1 change: 1 addition & 0 deletions dnf-behave-tests/dnf/exclude_from_weak.feature
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ Scenario: Upgrade ignores unmet recommends of installed package even when anothe
| upgrade | PackageA-2.0-1.x86_64 |
| install | PackageC-2.0-1.x86_64 |


@bz2048394
@bz2033130
Scenario: Upgrade will not ignores unmet recommends of installed package when the rich dependency was satisfied
Expand Down
35 changes: 35 additions & 0 deletions dnf-behave-tests/dnf/install-nodocs.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@dnf5
Feature: install command on packages and their docs


Scenario: Install a documentation package from local repodata
Given I use repository "microdnf-install-nodocs"
When I execute dnf with args "install man-pages"
Then the exit code is 0
And transaction is following
| Action | Package |
| install | man-pages-0:4.16-3.fc29.x86_64 |
And file "/usr/share/doc/man-pages/README" exists


@bz1769831
Scenario: Install package with option from local repodata with local packages
Given I use repository "microdnf-install-nodocs"
When I execute dnf with args "--setopt=tsflags=nodocs install man-pages"
Then the exit code is 0
And transaction is following
| Action | Package |
| install | man-pages-0:4.16-3.fc29.x86_64 |
And file "/usr/share/doc/man-pages/README" does not exist


@bz1771012
Scenario: Install package with --nodocs option from local repodata with local packages
Given I use repository "microdnf-install-nodocs"
And I execute dnf with args "--nodocs install man-pages"
Then the exit code is 0
And transaction is following
| Action | Package |
| install | man-pages-0:4.16-3.fc29.x86_64 |
And file "/usr/share/doc/man-pages/README" does not exist

11 changes: 11 additions & 0 deletions dnf-behave-tests/dnf/install-pkgspec.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ Scenario: Install an RPM by name
| install-dep | setup-0:2.12.1-1.fc29.noarch |


@bz1734350
Scenario: Install packages by name from remote repodata with remote packages
Given I use repository "dnf-ci-fedora" as http
When I execute dnf with args "install lame"
Then the exit code is 0
And transaction is following
| Action | Package |
| install | lame-0:3.100-4.fc29.x86_64 |
| install-dep | lame-libs-0:3.100-4.fc29.x86_64 |


Scenario: Install an RPM by name-version
When I execute dnf with args "install filesystem-3.9"
Then the exit code is 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@dnf5
Feature: Tests --setopt=install_weak_deps=


Expand All @@ -6,19 +7,19 @@ Background: Prepare environment


Scenario: Install "abcde" without weak dependencies
When I execute microdnf with args "install --setopt=install_weak_deps=0 abcde"
When I execute dnf with args "install --setopt=install_weak_deps=0 abcde"
Then the exit code is 0
And microdnf transaction is
And transaction is following
| Action | Package |
| install | abcde-0:2.9.2-1.fc29.noarch |
| install | wget-0:1.19.5-5.fc29.x86_64 |
| install-dep | wget-0:1.19.5-5.fc29.x86_64 |


Scenario: Install "abcde" with weak dependencies
When I execute microdnf with args "install --setopt=install_weak_deps=1 abcde"
When I execute dnf with args "install --setopt=install_weak_deps=1 abcde"
Then the exit code is 0
And microdnf transaction is
And transaction is following
| Action | Package |
| install | abcde-0:2.9.2-1.fc29.noarch |
| install | flac-0:1.3.2-8.fc29.x86_64 |
| install | wget-0:1.19.5-5.fc29.x86_64 |
| install-weak | flac-0:1.3.2-8.fc29.x86_64 |
| install-dep | wget-0:1.19.5-5.fc29.x86_64 |
71 changes: 70 additions & 1 deletion dnf-behave-tests/dnf/makecache.feature
Original file line number Diff line number Diff line change
@@ -1,11 +1,80 @@
@dnf5
Feature: makecache command
Feature: makecache command


Scenario: Create a metadata cache using "makecache" and then test that "repoquery" does not download metadata
Given I use repository "dnf-ci-fedora" as http
When I execute dnf with args "makecache"
Then the exit code is 0
And stderr matches line by line
"""
Updating and loading repositories:
dnf-ci-fedora test repository .*
Repositories loaded.
"""
When I execute dnf with args "repoquery nodejs"
Then the exit code is 0
And stdout is
"""
nodejs-1:5.12.1-1.fc29.src
nodejs-1:5.12.1-1.fc29.x86_64
"""
And stderr is
"""
Updating and loading repositories:
Repositories loaded.
"""


Scenario: Tests that "repoquery" downloads metadata (creates a cache) and then "makecache" does not download metadada
Given I use repository "dnf-ci-fedora" as http
When I execute dnf with args "repoquery nodejs"
Then the exit code is 0
And stderr matches line by line
"""
Updating and loading repositories:
dnf-ci-fedora test repository .*
Repositories loaded.
"""
And stdout is
"""
nodejs-1:5.12.1-1.fc29.src
nodejs-1:5.12.1-1.fc29.x86_64
"""
When I execute dnf with args "makecache"
Then the exit code is 0
And stdout is
"""
Metadata cache created.
"""
And stderr is
"""
Updating and loading repositories:
Repositories loaded.
"""


Scenario: makecache with skip_if_unavailable=0 and non existent repo doesn't succeed
Given I configure a new repository "non-existent" with
| key | value |
| baseurl | https://www.not-available-repo.com/ |
| enabled | 1 |
| skip_if_unavailable | 0 |
When I execute dnf with args "makecache"
Then the exit code is 1
And stdout is empty
And stderr contains "Updating and loading repositories:"
And stderr contains "non-existent test repository"
And stderr contains "Failed to download metadata \(baseurl: \"https://www.not-available-repo.com/\"\) for repository \"non-existent\""


@xfail
# Missing --timer option, reported as https://github.com/rpm-software-management/dnf5/issues/812
@bz1745170
Scenario: disabled makecache --timer does not invalidate cached metadata
Given I use repository "dnf-ci-fedora" as http
And I successfully execute dnf with args "makecache"
When I execute dnf with args "makecache --timer --setopt=metadata_timer_sync=0"
Then the exit code is 0
And I execute dnf with args "install setup"
Then stderr does not contain "dnf-ci-fedora test repository"
41 changes: 40 additions & 1 deletion dnf-behave-tests/dnf/metadata.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,50 @@ Given I copy directory "{context.scenario.repos_location}/dnf-ci-fedora" to "/te
And I execute "sleep 2s"
Then I execute dnf with args "upgrade"
Then the exit code is 0
Then I execute dnf with args "list"
Then I execute dnf with args "--cacheonly list"
Then the exit code is 0
And stdout contains "\s+wget.src\s+1.19.5-5.fc29\s+testrepo"


@bz1771147
Scenario: dnf respects metadata_expire (with default of 48 hours)
Given I use repository "simple-base" as http
When I execute dnf with args "repoquery labirinto"
Then the exit code is 0
And stdout is
"""
labirinto-0:1.0-1.fc29.src
labirinto-0:1.0-1.fc29.x86_64
"""
# since libdnf measures the metadata file age in whole seconds, wait till it changes
When I sleep for "1" seconds
And I execute dnf with args "repoquery labirinto"
Then the exit code is 0
And stderr is
"""
Updating and loading repositories:
Repositories loaded.
"""
And stdout is
"""
labirinto-0:1.0-1.fc29.src
labirinto-0:1.0-1.fc29.x86_64
"""
When I execute dnf with args "--refresh repoquery labirinto"
Then the exit code is 0
And stdout is
"""
labirinto-0:1.0-1.fc29.src
labirinto-0:1.0-1.fc29.x86_64
"""
And stderr matches line by line
"""
Updating and loading repositories:
simple-base test repository .*
Repositories loaded.
"""


@bz1866505
Scenario: I cannot create/overwrite a file in /etc from local repository
# This directory structure is needed at the repo source so that it can be matched on the system running dnf
Expand Down
50 changes: 0 additions & 50 deletions dnf-behave-tests/dnf/microdnf/config.feature

This file was deleted.

24 changes: 0 additions & 24 deletions dnf-behave-tests/dnf/microdnf/error_messages.feature

This file was deleted.

Loading
Loading