Skip to content

Commit

Permalink
Add copr chroot tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kontura committed Nov 18, 2024
1 parent 337b4d6 commit 25043d0
Showing 1 changed file with 86 additions and 0 deletions.
86 changes: 86 additions & 0 deletions dnf-behave-tests/dnf/plugins-core/copr-chroot.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
@dnf5
# These tests need to be marked destructive because copr
# doesn't use repositories in installroot, this is tracked as:
# https://github.com/rpm-software-management/dnf5/issues/1497
@destructive
Feature: Test the COPR plugin chroot argument


Background:
Given I create directory "/{context.dnf.tempdir}/copr"
And I start http server "copr" at "{context.dnf.tempdir}/copr"
And I create and substitute file "//etc/dnf/plugins/copr.conf" with
"""
[main]
distribution = Fedora
releasever = 31
[testhub]
hostname = localhost
protocol = http
port = {context.dnf.ports[copr]}
"""
And I create and substitute file "/{context.dnf.tempdir}/copr/api_3/rpmrepo/testuser/testproject/Fedora-31/index.html" with
"""
{{
"dependencies": [],
"directories": {{
"testproject": {{}}
}},
"repos": {{
"Fedora-32": {{
"arch": {{
"x86_64": {{
"opts": {{}}
}}
}}
}},
}},
"results_url": "http://project_base_url/"
}}
"""


Scenario: Test enabling a repo which doesn't have current default chroot available
When I execute dnf with args "copr enable testhub/testuser/testproject"
Then the exit code is 1
And stdout is empty
And stderr is
"""
<REPOSYNC>
Chroot not found in the given Copr project (Fedora-31-x86_64).
You can choose one of the available chroots explicitly:
Fedora-32-x86_64
"""


Scenario: Test enabling repo with specified missing chroot
When I execute dnf with args "copr enable testhub/testuser/testproject Fedora-30-x86_64"
Then the exit code is 1
And stdout is empty
And stderr is
"""
<REPOSYNC>
Chroot not found in the given Copr project (Fedora-30-x86_64).
You can choose one of the available chroots explicitly:
Fedora-32-x86_64
"""


Scenario: Test enabling a repo with manually specified chroot (different to current)
When I execute dnf with args "copr enable testhub/testuser/testproject Fedora-32-x86_64"
Then the exit code is 0
And stdout is empty
And stderr is
"""
<REPOSYNC>
Enabling a Copr repository. Please note that this repository is not part
of the main distribution, and quality may vary.
The Fedora Project does not exercise any power over the contents of
this repository beyond the rules outlined in the Copr FAQ at
<https://docs.pagure.org/copr.copr/user_documentation.html#what-i-can-build-in-copr>,
and packages are not held to any quality or security level.
Please do not file bug reports about these packages in Fedora
Bugzilla. In case of problems, contact the owner of this repository.
"""

0 comments on commit 25043d0

Please sign in to comment.