Skip to content

Commit

Permalink
Tests for optional filelists metadata
Browse files Browse the repository at this point in the history
Basic tests for optional filelists metadata functionality taken and reworked from the existing dnf5 tests.
  • Loading branch information
jan-kolarik committed Jan 29, 2024
1 parent b8ef23b commit 681726c
Showing 1 changed file with 89 additions and 0 deletions.
89 changes: 89 additions & 0 deletions dnf-behave-tests/dnf/optional-metadata.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
Feature: Tests for optional metadata loading functionality


Background:
Given I use repository "dnf-ci-fedora"
And I successfully execute dnf with args "makecache --setopt=optional_metadata_types=,"
And I execute "find | sort" in "{context.dnf.installroot}/var/cache/dnf"
Then stdout matches line by line
"""
\.
\./dnf-ci-fedora-[0-9a-f]{16}
\./dnf-ci-fedora-[0-9a-f]{16}/repodata
\./dnf-ci-fedora-[0-9a-f]{16}/repodata/primary\.xml\.*
\./dnf-ci-fedora-[0-9a-f]{16}/repodata/repomd\.xml
\./dnf-ci-fedora\.solv
\./expired_repos\.json
"""


Scenario: Optional metadata are loaded when explicitly requested by the option
Given I successfully execute dnf with args "makecache --setopt=optional_metadata_types=,filelists"
When I execute "find | sort" in "{context.dnf.installroot}/var/cache/dnf"
Then stdout matches line by line
"""
\.
\./dnf-ci-fedora-[0-9a-f]{16}
\./dnf-ci-fedora-[0-9a-f]{16}/repodata
\./dnf-ci-fedora-[0-9a-f]{16}/repodata/filelists\.xml\.zst
\./dnf-ci-fedora-[0-9a-f]{16}/repodata/primary\.xml\.*
\./dnf-ci-fedora-[0-9a-f]{16}/repodata/repomd\.xml
\./dnf-ci-fedora-filenames\.solvx
\./dnf-ci-fedora\.solv
\./expired_repos\.json
"""


Scenario: Invalid metadata type is ignored when processing the option
Given I successfully execute dnf with args "makecache --setopt=optional_metadata_types=,abcdef"
When I execute "find | sort" in "{context.dnf.installroot}/var/cache/dnf"
Then stdout matches line by line
"""
\.
\./dnf-ci-fedora-[0-9a-f]{16}
\./dnf-ci-fedora-[0-9a-f]{16}/repodata
\./dnf-ci-fedora-[0-9a-f]{16}/repodata/primary\.xml\.*
\./dnf-ci-fedora-[0-9a-f]{16}/repodata/repomd\.xml
\./dnf-ci-fedora\.solv
\./expired_repos\.json
"""


Scenario: Optional metadata are loaded when requested by command
Given I successfully execute dnf with args "provides basesystem --setopt=optional_metadata_types=,"
When I execute "find | sort" in "{context.dnf.installroot}/var/cache/dnf"
Then stdout matches line by line
"""
\.
\./dnf-ci-fedora-[0-9a-f]{16}
\./dnf-ci-fedora-[0-9a-f]{16}/repodata
\./dnf-ci-fedora-[0-9a-f]{16}/repodata/filelists\.xml\.zst
\./dnf-ci-fedora-[0-9a-f]{16}/repodata/primary\.xml\.*
\./dnf-ci-fedora-[0-9a-f]{16}/repodata/repomd\.xml
\./dnf-ci-fedora-filenames\.solvx
\./dnf-ci-fedora\.solv
\./expired_repos\.json
"""


Scenario: Operation returns an error when metadata are not present in cacheonly mode
Given I execute dnf with args "provides basesystem --cacheonly --setopt=optional_metadata_types=,"
Then the exit code is 1
And stderr contains "Error: Cache-only enabled but no cache for 'dnf-ci-fedora'"


Scenario: Filelists metadata are loaded when filepath spec is provided
Given I successfully execute dnf with args "repoquery /some/file --setopt=optional_metadata_types=,"
When I execute "find | sort" in "{context.dnf.installroot}/var/cache/dnf"
Then stdout matches line by line
"""
\.
\./dnf-ci-fedora-[0-9a-f]{16}
\./dnf-ci-fedora-[0-9a-f]{16}/repodata
\./dnf-ci-fedora-[0-9a-f]{16}/repodata/filelists\.xml\.zst
\./dnf-ci-fedora-[0-9a-f]{16}/repodata/primary\.xml\.*
\./dnf-ci-fedora-[0-9a-f]{16}/repodata/repomd\.xml
\./dnf-ci-fedora-filenames\.solvx
\./dnf-ci-fedora\.solv
\./expired_repos\.json
"""

0 comments on commit 681726c

Please sign in to comment.