Skip to content

Commit

Permalink
Test configuring repositories through command line options
Browse files Browse the repository at this point in the history
  • Loading branch information
kontura committed Dec 13, 2023
1 parent 1499f79 commit 1a61e1e
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 34 deletions.
91 changes: 91 additions & 0 deletions dnf-behave-tests/dnf/repo-cmdline-config.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
@dnf5
Feature: Configure repos through cmd line options


Scenario: Exit with an error when trying to --enable-repo='*' when there are no repo files
When I execute dnf with args "repo list --enable-repo='*'"
Then the exit code is 2
And stderr is
"""
No matching repositories for "*". Add "--help" for more information about the arguments.
"""


Scenario: Exit with an error when trying to enable missing repo
Given I use repository "simple-base"
When I execute dnf with args "repo list --enable-repo='missing-repo'"
Then the exit code is 2
And stderr is
"""
No matching repositories for "missing-repo". Add "--help" for more information about the arguments.
"""


Scenario: Exit with an error when trying to enable multiple missing repos
Given I use repository "simple-base"
When I execute dnf with args "repo list --enable-repo='missing-repo1' --enable-repo='missing-repo2'"
Then the exit code is 2
And stderr is
"""
No matching repositories for "missing-repo1, missing-repo2". Add "--help" for more information about the arguments.
"""


Scenario: Enabling enabled repo is ok
Given I use repository "simple-base"
When I execute dnf with args "repo list --enable-repo='simple-base'"
Then the exit code is 0
And stdout is
"""
repo id repo name
simple-base simple-base test repository
"""


Scenario: Exit with an error when trying to --disable-repo='*' when there are no repo files
When I execute dnf with args "repo list --disable-repo='*'"
Then the exit code is 2
And stderr is
"""
No matching repositories for "*". Add "--help" for more information about the arguments.
"""


# When there are no repositories the --repo options error report includes "*" because it
# is used internally to disable all repos. This might be confusing to users but the situation
# where there are no repos should be pretty rare.
Scenario: Exit with an error when using --repo but there are no repositories
When I execute dnf with args "repo list --repo='missing-repo'"
Then the exit code is 2
And stderr is
"""
No matching repositories for "*, missing-repo". Add "--help" for more information about the arguments.
"""


Scenario: Exit with an error when --repo specifies invalid repository
Given I use repository "simple-base"
When I execute dnf with args "repo list --repo='missing-repo'"
Then the exit code is 2
And stderr is
"""
No matching repositories for "missing-repo". Add "--help" for more information about the arguments.
"""


Scenario: Exit with an error when --setop specifies invalid repository
When I execute dnf with args "repo list --setopt=missing-repo.best=true"
Then the exit code is 2
And stderr is
"""
No matching repositories for "missing-repo". Add "--help" for more information about the arguments.
"""


Scenario: Exit with an error when trying --setop for all repos but there are none
When I execute dnf with args "repo list --setopt=*.best=true"
Then the exit code is 2
And stderr is
"""
No matching repositories for "*". Add "--help" for more information about the arguments.
"""
34 changes: 0 additions & 34 deletions dnf-behave-tests/dnf/repolist-enablerepo-disablerepo.feature

This file was deleted.

0 comments on commit 1a61e1e

Please sign in to comment.