From a4a81dbdc7c933d432bd1c843b3679be27328d44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= Date: Fri, 26 Apr 2024 11:25:13 +0200 Subject: [PATCH] Enable history-undo.feature - dnf5 history list doesn't fill in actions: https://github.com/rpm-software-management/dnf5/issues/1448 - Undoing install of dependecies that are not used by anything else is now described as `remove-unused`. - There is a change in one `Altered` count because dnf4 doesn't count/list `Upgraded` and `Downgraded` actions. dnf5 on the other hand shows the `Replaced` action which is their equivalent. --- dnf-behave-tests/dnf/history-undo.feature | 179 +++++++++++++--------- 1 file changed, 110 insertions(+), 69 deletions(-) diff --git a/dnf-behave-tests/dnf/history-undo.feature b/dnf-behave-tests/dnf/history-undo.feature index cbc4e3046..92c3ab029 100644 --- a/dnf-behave-tests/dnf/history-undo.feature +++ b/dnf-behave-tests/dnf/history-undo.feature @@ -1,3 +1,4 @@ +@dnf5 Feature: Transaction history undo @@ -9,17 +10,17 @@ Scenario: Undoing transactions Given I successfully execute dnf with args "install filesystem" Then History is following | Id | Command | Action | Altered | - | 1 | install filesystem | Install | 2 | + | 1 | install filesystem | | 2 | When I execute dnf with args "history undo last" Then the exit code is 0 And Transaction is following | Action | Package | - | remove-dep | setup-0:2.12.1-1.fc29.noarch | + | remove-unused | setup-0:2.12.1-1.fc29.noarch | | remove | filesystem-0:3.9-2.fc29.x86_64 | And History is following | Id | Command | Action | Altered | - | 2 | | Removed | 2 | - | 1 | | Install | 2 | + | 2 | undo last | | 2 | + | 1 | install filesystem | | 2 | When I execute dnf with args "history undo last" Then the exit code is 0 And Transaction is following @@ -28,21 +29,21 @@ Scenario: Undoing transactions | install | filesystem-0:3.9-2.fc29.x86_64 | And History is following | Id | Command | Action | Altered | - | 3 | | Install | 2 | - | 2 | | Removed | 2 | - | 1 | | Install | 2 | + | 3 | undo last | | 2 | + | 2 | undo last | | 2 | + | 1 | install filesystem | | 2 | When I execute dnf with args "history undo last-2" Then the exit code is 0 And Transaction is following | Action | Package | - | remove-dep | setup-0:2.12.1-1.fc29.noarch | + | remove-unused | setup-0:2.12.1-1.fc29.noarch | | remove | filesystem-0:3.9-2.fc29.x86_64 | And History is following | Id | Command | Action | Altered | - | 4 | | Removed | 2 | - | 3 | | Install | 2 | - | 2 | | Removed | 2 | - | 1 | | Install | 2 | + | 4 | undo last-2 | | 2 | + | 3 | undo last | | 2 | + | 2 | undo last | | 2 | + | 1 | install filesystem | | 2 | @1627111 @@ -62,17 +63,19 @@ Scenario: Handle missing packages required for undoing the transaction | upgrade | flac-0:1.3.3-3.fc29.x86_64 | | upgrade | wget-0:1.19.6-5.fc29.x86_64 | And History is following - | Id | Command | Action | Altered | - | 2 | | Upgrade | 2 | - | 1 | | Install | 2 | + | Id | Command | Action | Altered | + | 2 | update | | 4 | + | 1 | install wget flac | | 2 | Then I execute dnf with args "history undo 2" Then the exit code is 1 And Transaction is empty And stderr is """ - Error: The following problems occurred while running a transaction: - Cannot find rpm nevra "flac-1.3.2-8.fc29.x86_64". - Cannot find rpm nevra "wget-1.19.5-5.fc29.x86_64". + Failed to resolve the transaction: + Cannot perform Install action, no match for: flac-1.3.2-8.fc29.x86_64. + Cannot perform Install action, no match for: wget-1.19.5-5.fc29.x86_64. + You can try to add to command line: + --skip-unavailable to skip unavailable packages """ @@ -96,9 +99,8 @@ Scenario: Missing packages are skipped if --skip-unavailable is specified And Transaction is empty And stderr is """ - Warning, the following problems occurred while running a transaction: - Cannot find rpm nevra "flac-1.3.2-8.fc29.x86_64". - Cannot find rpm nevra "wget-1.19.5-5.fc29.x86_64". + Cannot perform Install action, no match for: flac-1.3.2-8.fc29.x86_64. + Cannot perform Install action, no match for: wget-1.19.5-5.fc29.x86_64. """ @@ -108,8 +110,11 @@ Scenario: Undo a transaction with a package that is no longer available Then the exit code is 1 And stderr is """ - Error: The following problems occurred while running a transaction: - Cannot find rpm nevra "filesystem-3.9-2.fc29.x86_64". + Failed to resolve the transaction: + Cannot perform Remove action because 'filesystem-3.9-2.fc29.x86_64' matches only excluded packages. + Problem: installed package filesystem-3.9-2.fc29.x86_64 requires setup, but none of the providers can be installed + - conflicting requests + - problem with installed package """ @@ -119,31 +124,32 @@ Scenario: Undoing a transaction with Reason Change Given I successfully execute dnf with args "install filesystem" Then History is following | Id | Command | Action | Altered | - | 1 | install filesystem | Install | 2 | + | 1 | install filesystem | | 2 | And package reasons are | Package | Reason | - | filesystem-3.9-2.fc29.x86_64 | user | - | setup-2.12.1-1.fc29.noarch | dependency | - When I execute dnf with args "mark group filesystem" + | filesystem-3.9-2.fc29.x86_64 | User | + | setup-2.12.1-1.fc29.noarch | Dependency | + When I execute dnf with args "mark weak filesystem" + Then the exit code is 0 Then History is following - | Id | Command | Action | Altered | - | 2 | | Reason Change | 1 | - | 1 | install filesystem | Install | 2 | + | Id | Command | Action | Altered | + | 2 | mark weak filesystem | | 1 | + | 1 | install filesystem | | 2 | And package reasons are | Package | Reason | - | filesystem-3.9-2.fc29.x86_64 | group | - | setup-2.12.1-1.fc29.noarch | dependency | + | filesystem-3.9-2.fc29.x86_64 | Weak Dependency | + | setup-2.12.1-1.fc29.noarch | Dependency | When I execute dnf with args "history undo last" Then the exit code is 0 And History is following - | Id | Command | Action | Altered | - | 3 | | Reason Change | 1 | - | 2 | | Reason Change | 1 | - | 1 | | Install | 2 | + | Id | Command | Action | Altered | + | 3 | history undo last | | 1 | + | 2 | mark weak filesystem | | 1 | + | 1 | install filesystem | | 2 | And package reasons are | Package | Reason | - | filesystem-3.9-2.fc29.x86_64 | user | - | setup-2.12.1-1.fc29.noarch | dependency | + | filesystem-3.9-2.fc29.x86_64 | User | + | setup-2.12.1-1.fc29.noarch | Dependency | @bz2010259 @@ -152,68 +158,103 @@ Scenario: Undoing an older transaction with Reason Change Given I successfully execute dnf with args "install filesystem" Then History is following | Id | Command | Action | Altered | - | 1 | install filesystem | Install | 2 | + | 1 | install filesystem | | 2 | And package reasons are | Package | Reason | - | filesystem-3.9-2.fc29.x86_64 | user | - | setup-2.12.1-1.fc29.noarch | dependency | - When I execute dnf with args "mark group filesystem" + | filesystem-3.9-2.fc29.x86_64 | User | + | setup-2.12.1-1.fc29.noarch | Dependency | + When I execute dnf with args "mark weak filesystem" Then History is following | Id | Command | Action | Altered | - | 2 | | Reason Change | 1 | - | 1 | install filesystem | Install | 2 | + | 2 | mark weak filesystem | | 1 | + | 1 | install filesystem | | 2 | And package reasons are | Package | Reason | - | filesystem-3.9-2.fc29.x86_64 | group | - | setup-2.12.1-1.fc29.noarch | dependency | + | filesystem-3.9-2.fc29.x86_64 | Weak Dependency | + | setup-2.12.1-1.fc29.noarch | Dependency | When I execute dnf with args "install wget" Then the exit code is 0 When I execute dnf with args "history undo last-1" Then the exit code is 0 And History is following - | Id | Command | Action | Altered | - | 4 | | Reason Change | 1 | - | 3 | | Install | 1 | - | 2 | | Reason Change | 1 | - | 1 | | Install | 2 | + | Id | Command | Action | Altered | + | 4 | history undo last-1 | | 1 | + | 3 | install wget | | 1 | + | 2 | mark weak filesystem | | 1 | + | 1 | install filesystem | | 2 | And package reasons are | Package | Reason | - | filesystem-3.9-2.fc29.x86_64 | user | - | setup-2.12.1-1.fc29.noarch | dependency | - | wget-1.19.5-5.fc29.x86_64 | user | + | filesystem-3.9-2.fc29.x86_64 | User | + | setup-2.12.1-1.fc29.noarch | Dependency | + | wget-1.19.5-5.fc29.x86_64 | User | +@xfail @bz2010259 @bz2053014 Scenario: Undoing a transaction range with Reason Change Given I successfully execute dnf with args "install filesystem" Then History is following | Id | Command | Action | Altered | - | 1 | install filesystem | Install | 2 | + | 1 | install filesystem | | 2 | And package reasons are | Package | Reason | - | filesystem-3.9-2.fc29.x86_64 | user | - | setup-2.12.1-1.fc29.noarch | dependency | - When I execute dnf with args "mark group filesystem" + | filesystem-3.9-2.fc29.x86_64 | User | + | setup-2.12.1-1.fc29.noarch | Dependency | + When I execute dnf with args "mark weak filesystem" Then History is following | Id | Command | Action | Altered | - | 2 | | Reason Change | 1 | - | 1 | install filesystem | Install | 2 | + | 2 | mark weak filesystem | | 1 | + | 1 | install filesystem | | 2 | And package reasons are | Package | Reason | - | filesystem-3.9-2.fc29.x86_64 | group | - | setup-2.12.1-1.fc29.noarch | dependency | + | filesystem-3.9-2.fc29.x86_64 | Weak Dependency | + | setup-2.12.1-1.fc29.noarch | Dependency | When I execute dnf with args "install wget" Then the exit code is 0 When I execute dnf with args "history rollback 1" Then the exit code is 0 And History is following - | Id | Command | Action | Altered | - | 4 | | C, E | 2 | - | 3 | | Install | 1 | - | 2 | | Reason Change | 1 | - | 1 | | Install | 2 | + | Id | Command | Action | Altered | + | 4 | history rollback 1 | | 2 | + | 3 | install wget | | 1 | + | 2 | mark weak filesystem | | 1 | + | 1 | install filesystem | | 2 | And package reasons are | Package | Reason | - | filesystem-3.9-2.fc29.x86_64 | user | - | setup-2.12.1-1.fc29.noarch | dependency | + | filesystem-3.9-2.fc29.x86_64 | User | + | setup-2.12.1-1.fc29.noarch | Dependency | + + +Scenario: Undo a downgrade transaction + Given I use repository "dnf-ci-fedora-updates" + And I successfully execute dnf with args "install wget" + And I successfully execute dnf with args "downgrade wget" + When I execute dnf with args "history undo last" + Then the exit code is 0 + And Transaction is following + | Action | Package | + | upgrade | wget-0:1.19.6-5.fc29.x86_64 | + And stderr is + """ + Warning: skipped PGP checks for 1 package from repository: dnf-ci-fedora-updates + """ + + +Scenario: Undo an upgrade transaction with --skip-unavailable where the orignal package is not available + Given I successfully execute dnf with args "install wget" + And I use repository "dnf-ci-fedora-updates" + And I successfully execute dnf with args "upgrade wget" + And I drop repository "dnf-ci-fedora" + When I execute dnf with args "history undo last --skip-unavailable" + Then the exit code is 0 + And Transaction is empty + And stdout is + """ + + Nothing to do. + """ + And stderr is + """ + Cannot perform Install action, no match for: wget-1.19.5-5.fc29.x86_64. + """