diff --git a/dnf-behave-tests/dnf/help.feature b/dnf-behave-tests/dnf/help.feature index 05606de06..61581fe77 100644 --- a/dnf-behave-tests/dnf/help.feature +++ b/dnf-behave-tests/dnf/help.feature @@ -1,118 +1,43 @@ +@dnf5 Feature: Help command -Scenario: General help (dnf) - Given I set dnf command to "dnf" - When I execute dnf with args "--help" - Then the exit code is 0 - And stdout contains "List of Main Commands" - When I execute dnf with args "--unknown-option" - Then the exit code is 0 - And stdout contains "List of Main Commands" - When I execute dnf with args "help" - Then the exit code is 0 - And stdout contains "List of Main Commands" - When I execute dnf with args "unknown-command" - Then the exit code is 1 - And stderr is - """ - No such command: unknown-command. Please use /usr/bin/dnf --help - It could be a DNF plugin command, try: "dnf install 'dnf-command(unknown-command)'" - """ -Scenario: General help (yum) - Given I set dnf command to "yum" +Scenario: General help When I execute dnf with args "--help" Then the exit code is 0 - And stdout contains "List of Main Commands" + And stdout contains "Software Management Commands" When I execute dnf with args "--unknown-option" - Then the exit code is 0 - And stdout contains "List of Main Commands" + Then the exit code is 2 + And stdout is empty + And stderr is + """ + Unknown argument "--unknown-option" for command "dnf5". Add "--help" for more information about the arguments. + """ When I execute dnf with args "help" - Then the exit code is 0 - And stdout contains "List of Main Commands" + Then the exit code is 2 + And stdout is empty + And stderr is + """ + Unknown argument "help" for command "dnf5". Add "--help" for more information about the arguments. + It could be a command provided by a plugin, try: dnf5 install 'dnf5-command(help)' + """ When I execute dnf with args "unknown-command" - Then the exit code is 1 + Then the exit code is 2 + And stdout is empty And stderr is - """ - No such command: unknown-command. Please use /usr/bin/yum --help - It could be a YUM plugin command, try: "yum install 'dnf-command(unknown-command)'" - """ + """ + Unknown argument "unknown-command" for command "dnf5". Add "--help" for more information about the arguments. + It could be a command provided by a plugin, try: dnf5 install 'dnf5-command(unknown-command)' + """ + Scenario: Command help - When I execute dnf with args "help install" - Then the exit code is 0 - And stdout contains "usage: .+ install" When I execute dnf with args "install --help" Then the exit code is 0 - And stdout contains "usage: .+ install" + And stdout contains "dnf5 \[GLOBAL OPTIONS\] install \[OPTIONS\] \[ARGUMENTS\]" When I execute dnf with args "install --unknown-option" Then the exit code is 2 - And stderr contains ".+ install: err" - -@bz1746474 -@use.with_os=rhel__ge__8 -@use.with_os=centos__ge__8 -@use.with_os=fedora__ge__30 -@use.with_os=fedora__lt__30 -Scenario Outline: Help should refer to yum/dnf depending on what command was used - When I execute " " - Then the exit code is 0 - And stdout contains "usage: " - -Examples: - | command | args | help | - | dnf | help | dnf \[options] COMMAND | - | dnf | --help | dnf \[options] COMMAND | - | dnf-3 | help | dnf \[options] COMMAND | - | dnf-3 | --help | dnf \[options] COMMAND | - | yum | help | yum \[options] COMMAND | - | yum | --help | yum \[options] COMMAND | - | yum-builddep | --help | dnf builddep \[-c \[config file]] \[-q] \[-v] \[--version] | - | yum shell | --help | yum shell \[-c \[config file]] \[-q] \[-v] \[--version] | - -@bz1746474 -@use.with_os=rhel__ge__8 -@use.with_os=centos__ge__8 -@use.with_os=fedora__ge__30 -@use.with_os=fedora__lt__30 -Scenario Outline: Help should refer to yum/dnf depending on what command was used - When I execute " " - Then the exit code is 0 - And stdout contains "" - -Examples: - | command | args | help | - | dnf builddep | --help | General DNF options: | - | yum builddep | --help | General YUM options: | - | yum-builddep | --help | General DNF options: | - | yum shell | --help | run an interactive YUM shell | - | dnf shell | --help | run an interactive DNF shell | - | yum alias | --help | show YUM version and exit | - | dnf alias | --help | show DNF version and exit | - | yum alias | --help | enables yum's obsoletes processing logic for upgrade | - | dnf alias | --help | enables dnf's obsoletes processing logic for upgrade | - | yum deplist | --help | Display only packages that can be removed by "yum | - | dnf deplist | --help | Display only packages that can be removed by "dnf | - | yum repoquery | --help | Display only packages that can be removed by "yum | - | dnf repoquery | --help | Display only packages that can be removed by "dnf | - | yum swap | --help | run an interactive YUM mod for remove and install one spec | - | dnf swap | --help | run an interactive DNF mod for remove and install one spe | - | yum config-manager | --help | manage yum configuration options and repositories | - | dnf config-manager | --help | manage dnf configuration options and repositories | - -@use.with_os=rhel__eq__7 -@use.with_os=centos__eq__7 -@xfail -Scenario Outline: Help should refer to yum4/dnf depending on what command was used - When I execute " " - Then the exit code is 0 - And stdout contains "usage: " - -Examples: - | command | args | - | dnf | help | - | dnf | --help | - | dnf-2 | help | - | dnf-2 | --help | - | yum4 | help | - | yum4 | --help | + And stderr is + """ + Unknown argument "--unknown-option" for command "install". Add "--help" for more information about the arguments. + """ diff --git a/dnf-behave-tests/dnf/history-error.feature b/dnf-behave-tests/dnf/history-error.feature index 8fe376f4e..6454ff52f 100644 --- a/dnf-behave-tests/dnf/history-error.feature +++ b/dnf-behave-tests/dnf/history-error.feature @@ -1,3 +1,4 @@ +@dnf5 Feature: Handling of errors on the history database Background: @@ -5,80 +6,73 @@ Given I use repository "dnf-ci-fedora" Scenario: history list on a broken history database -Given I create file "/var/lib/dnf/history.sqlite" with +Given I create file "/usr/lib/sysimage/libdnf5/transaction_history.sqlite" with """ GARBAGE """ - When I execute dnf with args "history filesystem" + When I execute dnf with args "history list" Then the exit code is 1 And stderr is """ - History database is not writable: SQLite error on "{context.dnf.installroot}/var/lib/dnf/history.sqlite": Executing an SQL statement failed: file is not a database - Error: SQLite error on "{context.dnf.installroot}/var/lib/dnf/history.sqlite": Executing an SQL statement failed: file is not a database + SQL statement execution failed: "PRAGMA locking_mode = NORMAL; PRAGMA journal_mode = WAL; PRAGMA foreign_keys = ON;": (26) - file is not a database """ Scenario: install with a broken history database Given I use repository "dnf-ci-fedora" - And I create file "/var/lib/dnf/history.sqlite" with + And I create file "/usr/lib/sysimage/libdnf5/transaction_history.sqlite" with """ GARBAGE """ When I execute dnf with args "install filesystem" Then the exit code is 1 - And stderr is - """ - History database is not writable: SQLite error on "{context.dnf.installroot}/var/lib/dnf/history.sqlite": Executing an SQL statement failed: file is not a database - History database is not writable: SQLite error on "{context.dnf.installroot}/var/lib/dnf/history.sqlite": Executing an SQL statement failed: file is not a database - Error: SQLite error on "{context.dnf.installroot}/var/lib/dnf/history.sqlite": Executing an SQL statement failed: file is not a database - """ + And stderr contains "SQL statement execution failed: "PRAGMA locking_mode = NORMAL; PRAGMA journal_mode = WAL; PRAGMA foreign_keys = ON;": \(26\) - file is not a database" @bz1634385 @no_installroot Scenario: history database not present under a regular user, who has write permission Given I successfully execute "chmod o+rwx {context.dnf.tempdir}" - When I execute dnf with args "--setopt=persistdir={context.dnf.tempdir} repoquery --userinstalled" as an unprivileged user + When I execute dnf with args "--setopt=system_state_dir={context.dnf.tempdir} history list" as an unprivileged user Then the exit code is 0 And stderr is empty - And file "{context.dnf.tempdir}/history.sqlite" exists + And stdout is empty + And file "{context.dnf.tempdir}/transaction_history.sqlite" exists @bz1634385 @no_installroot Scenario: history database not present under a regular user - When I execute dnf with args "--setopt=persistdir={context.dnf.tempdir} repoquery --userinstalled" as an unprivileged user - Then the exit code is 0 + When I execute dnf with args "--setopt=system_state_dir={context.dnf.tempdir} history list" as an unprivileged user + Then the exit code is 1 And stderr is """ - History database is not readable, using in-memory database instead: Failed to access "{context.dnf.tempdir}/history.sqlite": Permission denied + Failed to open database "{context.dnf.tempdir}/transaction_history.sqlite": (14) - unable to open database file """ @bz1761976 @no_installroot Scenario: read permission error on the history database -Given I successfully execute dnf with args "--setopt=persistdir={context.dnf.tempdir} install abcde" - And I successfully execute "chmod o-r {context.dnf.tempdir}/history.sqlite" - When I execute dnf with args "--setopt=persistdir={context.dnf.tempdir} history abcde" as an unprivileged user - Then the exit code is 0 +Given I successfully execute dnf with args "--setopt=system_state_dir={context.dnf.tempdir} install abcde" + And I successfully execute "chmod o-r {context.dnf.tempdir}/transaction_history.sqlite" + When I execute dnf with args "--setopt=system_state_dir={context.dnf.tempdir} history list" as an unprivileged user + Then the exit code is 1 And stderr is """ - History database is not readable, using in-memory database instead: Failed to access "{context.dnf.tempdir}/history.sqlite": Permission denied - History database is not readable, using in-memory database instead: Failed to access "{context.dnf.tempdir}/history.sqlite": Permission denied + Failed to open database "{context.dnf.tempdir}/transaction_history.sqlite": (14) - unable to open database file """ @bz1761976 @no_installroot Scenario: read permission error on the history database directory -Given I successfully execute dnf with args "--setopt=persistdir={context.dnf.tempdir} install abcde" +Given I successfully execute dnf with args "--setopt=system_state_dir={context.dnf.tempdir} install abcde" # executable permission on directory means its contents can't be read And I successfully execute "chmod o-x {context.dnf.tempdir}" - When I execute dnf with args "--setopt=persistdir={context.dnf.tempdir} history abcde" as an unprivileged user - Then the exit code is 0 + When I execute dnf with args "--setopt=system_state_dir={context.dnf.tempdir} history list" as an unprivileged user + Then the exit code is 1 And stderr is """ - History database is not readable, using in-memory database instead: Failed to access "{context.dnf.tempdir}/history.sqlite": Permission denied - History database is not readable, using in-memory database instead: Failed to access "{context.dnf.tempdir}/history.sqlite": Permission denied + Failed to open database "{context.dnf.tempdir}/transaction_history.sqlite": (14) - unable to open database file """ diff --git a/dnf-behave-tests/dnf/history-list.feature b/dnf-behave-tests/dnf/history-list.feature index be93d211b..4db985f18 100644 --- a/dnf-behave-tests/dnf/history-list.feature +++ b/dnf-behave-tests/dnf/history-list.feature @@ -1,3 +1,4 @@ +@dnf5 Feature: history list Background: @@ -8,7 +9,6 @@ Given I use repository "dnf-ci-fedora" And I successfully execute dnf with args "install nodejs" -@dnf5 Scenario: history list When I execute dnf with args "history list" Then the exit code is 0 @@ -18,7 +18,7 @@ Scenario: history list | 2 | | | 3 | | 1 | | | 6 | -@dnf5 + Scenario: history without sub-command When I execute dnf with args "history" Then the exit code is 2 @@ -29,7 +29,6 @@ Scenario: history without sub-command """ -@dnf5 # single item tests Scenario: history list 2 When I execute dnf with args "history list 2" @@ -38,7 +37,7 @@ Scenario: history list 2 | Id | Command | Action | Altered | | 2 | | | 3 | -@dnf5 + Scenario: history list with mulitple args When I execute dnf with args "history list 1 2 3" Then the exit code is 0 @@ -48,7 +47,7 @@ Scenario: history list with mulitple args | 2 | | | 3 | | 1 | | | 6 | -@dnf5 + Scenario: history list last When I execute dnf with args "history list last" Then the exit code is 0 @@ -56,7 +55,7 @@ Scenario: history list last | Id | Command | Action | Altered | | 3 | | | 5 | -@dnf5 + Scenario: history last without subcommand When I execute dnf with args "history last" Then the exit code is 2 @@ -66,7 +65,7 @@ Scenario: history last without subcommand Unknown argument "last" for command "history". Add "--help" for more information about the arguments. """ -@dnf5 + Scenario: history list last-1 When I execute dnf with args "history list last-1" Then the exit code is 0 @@ -74,7 +73,7 @@ Scenario: history list last-1 | Id | Command | Action | Altered | | 2 | | | 3 | -@dnf5 + # range tests Scenario: history list 1..last-1 When I execute dnf with args "history list 1..last-1" @@ -84,7 +83,7 @@ Scenario: history list 1..last-1 | 2 | | | 3 | | 1 | | | 6 | -@dnf5 + Scenario: history list 1..last-2 When I execute dnf with args "history list 1..last-2" Then the exit code is 0 @@ -92,6 +91,9 @@ Scenario: history list 1..last-2 | Id | Command | Action | Altered | | 1 | | | 6 | + +@xfail +# Reported as https://github.com/rpm-software-management/dnf5/issues/1656 Scenario: history list 1..-1 When I execute dnf with args "history 1..-1" Then the exit code is 0 @@ -100,6 +102,9 @@ Scenario: history list 1..-1 | 2 | | Removed | 3 | | 1 | | Install | 6 | + +@xfail +# Reported as https://github.com/rpm-software-management/dnf5/issues/1656 Scenario: history list 1..-2 When I execute dnf with args "history 1..-2" Then the exit code is 0 @@ -107,7 +112,7 @@ Scenario: history list 1..-2 | Id | Command | Action | Altered | | 1 | | Install | 6 | -@dnf5 + Scenario: history list 2..3 When I execute dnf with args "history list 2..3" Then the exit code is 0 @@ -116,13 +121,13 @@ Scenario: history list 2..3 | 3 | | | 5 | | 2 | | | 3 | -@dnf5 + Scenario: history list 10..11 When I execute dnf with args "history list 10..11" Then the exit code is 0 And stdout is empty -@dnf5 + Scenario: history list last..11 When I execute dnf with args "history list last..11" Then the exit code is 0 @@ -131,7 +136,6 @@ Scenario: history list last..11 | 3 | | | 5 | -@dnf5 # "invalid" range tests Scenario: history list 3..2 When I execute dnf with args "history list 3..2" @@ -141,7 +145,7 @@ Scenario: history list 3..2 | 3 | | | 5 | | 2 | | | 3 | -@dnf5 + Scenario: history list last-1..1 When I execute dnf with args "history list last-1..1" Then the exit code is 0 @@ -150,7 +154,7 @@ Scenario: history list last-1..1 | 2 | | | 3 | | 1 | | | 6 | -@dnf5 + Scenario: history list 11..last-1 When I execute dnf with args "history list 11..last-1" Then the exit code is 0 @@ -159,7 +163,7 @@ Scenario: history list 11..last-1 | 3 | | | 5 | | 2 | | | 3 | -@dnf5 + Scenario: history list last-1..aaa When I execute dnf with args "history list last-1..aaa" Then the exit code is 1 @@ -169,7 +173,7 @@ Scenario: history list last-1..aaa Invalid transaction ID range "last-1..aaa", "ID" or "ID..ID" expected, where ID is "NUMBER", "last" or "last-NUMBER". """ -@dnf5 + Scenario: history list 12a..bc When I execute dnf with args "history list 12a..bc" Then the exit code is 1 @@ -182,28 +186,30 @@ Scenario: history list 12a..bc # package name tests Scenario: history abcde - When I execute dnf with args "history abcde" + When I execute dnf with args "history list --contains-pkgs=abcde" Then the exit code is 0 And stdout is history list | Id | Command | Action | Altered | - | 2 | | Removed | 3 | - | 1 | | Install | 6 | + | 2 | | | 3 | + | 1 | | | 6 | + Scenario: history filesystem - When I execute dnf with args "history filesystem" + When I execute dnf with args "history list --contains-pkgs=filesystem" Then the exit code is 0 And stdout is history list | Id | Command | Action | Altered | - | 1 | | Install | 6 | + | 1 | | | 6 | + Scenario: history lame (no transaction with such package) - When I execute dnf with args "history lame" + When I execute dnf with args "history list --contains-pkgs=lame" Then the exit code is 0 - And stdout is - """ - No transaction which manipulates package 'lame' was found. - """ + And stdout is empty + +@xfail +# Reported as https://github.com/rpm-software-management/dnf5/issues/2025 @bz1786335 @bz1786316 @bz1852577 @@ -217,6 +223,9 @@ Scenario: history longer than 80 charactersi gets cut when there is no terminal 80 """ + +@xfail +# Reported as https://github.com/rpm-software-management/dnf5/issues/2025 @bz1786335 @bz1786316 Scenario: history length is 80 chars when missing rows are queried @@ -227,7 +236,7 @@ Scenario: history length is 80 chars when missing rows are queried 80 """ -@dnf5 + @bz1846692 Scenario: history list --reverse When I execute dnf with args "history list --reverse" @@ -239,7 +248,6 @@ Scenario: history list --reverse | 3 | | | 5 | -@dnf5 @bz1846692 Scenario: history 2..3 --reverse When I execute dnf with args "history list 2..3 --reverse" diff --git a/dnf-behave-tests/dnf/history-rpmdb.feature b/dnf-behave-tests/dnf/history-rpmdb.feature index 71b5781a7..ec1705670 100644 --- a/dnf-behave-tests/dnf/history-rpmdb.feature +++ b/dnf-behave-tests/dnf/history-rpmdb.feature @@ -1,3 +1,4 @@ +@dnf5 Feature: DNF/Behave test rpmdb version diff --git a/dnf-behave-tests/dnf/history-view.feature b/dnf-behave-tests/dnf/history-view.feature index cba41ec59..a646d210b 100644 --- a/dnf-behave-tests/dnf/history-view.feature +++ b/dnf-behave-tests/dnf/history-view.feature @@ -1,10 +1,10 @@ +@dnf5 Feature: Transaction history userinstalled, list and info Background: Given I use repository "dnf-ci-fedora" -@dnf5 Scenario: List userinstalled packages When I execute dnf with args "install abcde basesystem" Then the exit code is 0 @@ -26,7 +26,6 @@ Scenario: List userinstalled packages | wget-1.19.5-5.fc29.x86_64 | Dependency | -@dnf5 Scenario: History info Given I successfully execute dnf with args "install abcde" When I execute dnf with args "install setup" @@ -42,7 +41,6 @@ Scenario: History info | Remove | wget-0:1.19.5-5.fc29.x86_64 | Clean | @System | -@dnf5 Scenario: History info in range - transaction merging Given I successfully execute dnf with args "install abcde" Given I successfully execute dnf with args "remove abcde" @@ -93,7 +91,6 @@ Scenario: History info in range - transaction merging | Remove | wget-0:1.19.5-5.fc29.x86_64 | Clean | @System | -@dnf5 Scenario: History info of package Given I successfully execute dnf with args "install abcde" Given I successfully execute dnf with args "remove abcde" @@ -109,26 +106,29 @@ Scenario: History info of package | Remove | wget-0:1.19.5-5.fc29.x86_64 | Clean | @System | -# @dnf5 -# This is a test for listing transactions by package, this is not yet implemented in dnf5. -# Transaction commands need a --contains-pkgs option Scenario: history info aaa (nonexistent package) - When I execute dnf with args "history info aaa" - Then the exit code is 1 - And stderr is + When I execute dnf with args "history info --contains-pkgs=aaa" + Then the exit code is 0 + And stderr is empty + And stdout is """ - Invalid transaction ID range "aaa", "ID" or "ID..ID" expected, where ID is "NUMBER", "last" or "last-NUMBER". + No match found, history info defaults to considering only the last transaction, specify "1..last" range to search all transactions. """ -# @dnf5 -# This is a test for listing transactions by package, this is not yet implemented in dnf5. -# Transaction commands need a --contains-pkgs option -Scenario: history info aaa (nonexistent package) +Scenario: history info aaa (nonexistent package) when other package is present Given I successfully execute dnf with args "install abcde" - When I execute dnf with args "history info aaa" - Then the exit code is 1 - And stderr is + When I execute dnf with args "history info --contains-pkgs=aaa" + Then the exit code is 0 + And stderr is empty + And stdout is """ - Invalid transaction ID range "aaa", "ID" or "ID..ID" expected, where ID is "NUMBER", "last" or "last-NUMBER". + No match found, history info defaults to considering only the last transaction, specify "1..last" range to search all transactions. """ + + +Scenario: history info aaa (nonexistent package) when full range specified + When I execute dnf with args "history info 0..last --contains-pkgs=aaa" + Then the exit code is 0 + And stderr is empty + And stdout is empty