From 6135fdfcc5e729173df92046d7504d641d5e2c05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= Date: Mon, 24 Jun 2024 13:54:12 +0200 Subject: [PATCH 1/8] Enable `history-rollback.feature` - Undoing install of dependecies that are not used by anything else is now described as `remove-unused`. --- dnf-behave-tests/dnf/history-rollback.feature | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/dnf-behave-tests/dnf/history-rollback.feature b/dnf-behave-tests/dnf/history-rollback.feature index 70c1388cc..8d503d5df 100644 --- a/dnf-behave-tests/dnf/history-rollback.feature +++ b/dnf-behave-tests/dnf/history-rollback.feature @@ -1,3 +1,4 @@ +@dnf5 Feature: Transaction history rollback @@ -16,8 +17,8 @@ Scenario: Rollback And Transaction is following | Action | Package | | remove | glibc-2.28-26.fc29.x86_64 | - | remove-dep | glibc-all-langpacks-2.28-26.fc29.x86_64 | - | remove-dep | glibc-common-2.28-26.fc29.x86_64 | + | remove-unused | glibc-all-langpacks-2.28-26.fc29.x86_64 | + | remove-unused | glibc-common-2.28-26.fc29.x86_64 | Scenario: Multiple rollbacks @@ -26,8 +27,8 @@ Scenario: Multiple rollbacks And Transaction is following | Action | Package | | remove | glibc-2.28-26.fc29.x86_64 | - | remove-dep | glibc-all-langpacks-2.28-26.fc29.x86_64 | - | remove-dep | glibc-common-2.28-26.fc29.x86_64 | + | remove-unused | glibc-all-langpacks-2.28-26.fc29.x86_64 | + | remove-unused | glibc-common-2.28-26.fc29.x86_64 | When I execute dnf with args "history rollback 2" Then the exit code is 0 And Transaction is following @@ -42,6 +43,9 @@ Scenario: Rollback 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 "glibc-2.28-26.fc29.x86_64". + Failed to resolve the transaction: + Cannot perform Remove action because 'glibc-2.28-26.fc29.x86_64' matches only excluded packages. + Problem: installed package glibc-2.28-26.fc29.x86_64 requires glibc-common = 2.28-26.fc29, but none of the providers can be installed + - conflicting requests + - problem with installed package """ From 98d164da4b6319df392b994f2824dc476e78bf16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= Date: Mon, 24 Jun 2024 13:55:47 +0200 Subject: [PATCH 2/8] Enable `history-rollback-comps.feature` - Undoing install of dependecies that are not used by anything else is now described as `remove-unused`. - dnf5 history list doesn't fill in actions: https://github.com/rpm-software-management/dnf5/issues/1448 - The last test was changed because we store definitions of installed groups in system state --- .../dnf/history-rollback-comps.feature | 52 +++++++++++-------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/dnf-behave-tests/dnf/history-rollback-comps.feature b/dnf-behave-tests/dnf/history-rollback-comps.feature index 60529d6bd..1ad375fa3 100644 --- a/dnf-behave-tests/dnf/history-rollback-comps.feature +++ b/dnf-behave-tests/dnf/history-rollback-comps.feature @@ -1,3 +1,4 @@ +@dnf5 Feature: Transaction history rollback - comps @@ -5,7 +6,7 @@ Background: Given I use repository "dnf-ci-fedora" And I use repository "dnf-ci-thirdparty" And I successfully execute dnf with args "install setup" - And I successfully execute dnf with args "group install DNF-CI-Testgroup" + And I successfully execute dnf with args "group install dnf-ci-testgroup" Then Transaction is following | Action | Package | | group-install | DNF-CI-Testgroup | @@ -13,9 +14,9 @@ Background: | install-group | lame-0:3.100-4.fc29.x86_64 | | install-dep | lame-libs-0:3.100-4.fc29.x86_64 | And History is following - | Id | Command | Action | Altered | - | 2 | group install DNF-CI-Testgroup | Install | 4 | - | 1 | install setup | Install | 1 | + | Id | Command | Action | Altered | + | 2 | group install dnf-ci-testgroup | | 4 | + | 1 | install setup | | 1 | Scenario: Rollback a transaction that installed a group @@ -26,16 +27,16 @@ Scenario: Rollback a transaction that installed a group | group-remove | DNF-CI-Testgroup | | remove | filesystem-3.9-2.fc29.x86_64 | | remove | lame-0:3.100-4.fc29.x86_64 | - | remove-dep | lame-libs-0:3.100-4.fc29.x86_64 | + | remove-unused | lame-libs-0:3.100-4.fc29.x86_64 | And History is following - | Id | Command | Action | Altered | - | 3 | history rollback 1 | Removed | 4 | - | 2 | group install DNF-CI-Testgroup | Install | 4 | - | 1 | install setup | Install | 1 | + | Id | Command | Action | Altered | + | 3 | history rollback 1 | | 4 | + | 2 | group install dnf-ci-testgroup | | 4 | + | 1 | install setup | | 1 | Scenario: Rollback a transaction that removed a group - Given I successfully execute dnf with args "group remove DNF-CI-Testgroup" + Given I successfully execute dnf with args "group remove dnf-ci-testgroup" When I execute dnf with args "history rollback last-1" Then the exit code is 0 And Transaction is following @@ -45,19 +46,26 @@ Scenario: Rollback a transaction that removed a group | install-group | lame-0:3.100-4.fc29.x86_64 | | install-dep | lame-libs-0:3.100-4.fc29.x86_64 | And History is following - | Id | Command | Action | Altered | - | 4 | history rollback last-1 | Install | 4 | - | 3 | group remove DNF-CI-Testgroup | Removed | 4 | - | 2 | group install DNF-CI-Testgroup | Install | 4 | - | 1 | install setup | Install | 1 | + | Id | Command | Action | Altered | + | 4 | history rollback last-1 | | 4 | + | 3 | group remove dnf-ci-testgroup | | 4 | + | 2 | group install dnf-ci-testgroup | | 4 | + | 1 | install setup | | 1 | -Scenario: Rollback a transaction with a missing group +Scenario: Rollback a transaction with a group missing in repositories, definition from system state is used Given I drop repository "dnf-ci-thirdparty" When I execute dnf with args "history rollback 1" - Then the exit code is 1 - And stderr is - """ - Error: The following problems occurred while running a transaction: - Group id 'dnf-ci-testgroup' is not available. - """ + Then the exit code is 0 + And Transaction is following + | Action | Package | + | group-remove | DNF-CI-Testgroup | + | remove | filesystem-3.9-2.fc29.x86_64 | + | remove | lame-0:3.100-4.fc29.x86_64 | + | remove-unused | lame-libs-0:3.100-4.fc29.x86_64 | + And History is following + | Id | Command | Action | Altered | + | 3 | history rollback 1 | | 4 | + | 2 | group install dnf-ci-testgroup | | 4 | + | 1 | install setup | | 1 | + And stderr is empty From d695a6240b87affc5eee0f0d564ea2cefaa6c959 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= Date: Mon, 24 Jun 2024 14:09:31 +0200 Subject: [PATCH 3/8] Enable `history-rollback-group-upgrade.feature` - dnf5 history list doesn't fill in actions: https://github.com/rpm-software-management/dnf5/issues/1448 - group commands now accept group id instead of a name - There is a change in `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. - There is a change in one test where group upgrade action cannot be reverted now, instead the transaction prints a warning to stderr. --- .../history-rollback-group-upgrade.feature | 150 +++++++++--------- 1 file changed, 79 insertions(+), 71 deletions(-) diff --git a/dnf-behave-tests/dnf/history-rollback-group-upgrade.feature b/dnf-behave-tests/dnf/history-rollback-group-upgrade.feature index 53971df6d..aa822f77d 100644 --- a/dnf-behave-tests/dnf/history-rollback-group-upgrade.feature +++ b/dnf-behave-tests/dnf/history-rollback-group-upgrade.feature @@ -1,36 +1,37 @@ +@dnf5 Feature: Transaction history rollback of group upgrades Background: Given I use repository "dnf-ci-group-rollback-1" - And I successfully execute dnf with args "group install DNF-CI-RollbackTestGroup1" + And I successfully execute dnf with args "group install dnf-ci-group-rollback-testgroup1" Then Transaction is following | Action | Package | | group-install | DNF-CI-RollbackTestGroup1 | | install-group | TestGroup1PackageA-0:1.0-1.x86_64 | | install-group | TestGroup1PackageB-0:1.0-1.x86_64 | And History is following - | Id | Command | Action | Altered | - | 1 | group install DNF-CI-RollbackTestGroup1 | Install | 3 | - When I execute dnf with args "group list --installed DNF-CI-RollbackTestGroup1" + | Id | Command | Action | Altered | + | 1 | group install dnf-ci-group-rollback-testgroup1 | | 3 | + When I execute dnf with args "group list --installed dnf-ci-group-rollback-testgroup1" Then the exit code is 0 And stdout is """ - Installed Groups: - DNF-CI-RollbackTestGroup1 + ID Name Installed + dnf-ci-group-rollback-testgroup1 DNF-CI-RollbackTestGroup1 yes """ Given I use repository "dnf-ci-group-rollback-2" - And I successfully execute dnf with args "group upgrade DNF-CI-RollbackTestGroup1" + And I successfully execute dnf with args "group upgrade dnf-ci-group-rollback-testgroup1" Then Transaction is following | Action | Package | | group-upgrade | DNF-CI-RollbackTestGroup1 | | upgrade | TestGroup1PackageA-0:1.1-1.x86_64 | | upgrade | TestGroup1PackageB-0:1.1-1.x86_64 | And History is following - | Id | Command | Action | Altered | - | 2 | group upgrade DNF-CI-RollbackTestGroup1 | Upgrade | 3 | - | 1 | group install DNF-CI-RollbackTestGroup1 | Install | 3 | + | Id | Command | Action | Altered | + | 2 | group upgrade dnf-ci-group-rollback-testgroup1 | | 5 | + | 1 | group install dnf-ci-group-rollback-testgroup1 | | 3 | @bz2016070 @@ -42,17 +43,17 @@ Scenario: Rollback a group upgrade transaction | downgrade | TestGroup1PackageA-0:1.0-1.x86_64 | | downgrade | TestGroup1PackageB-0:1.0-1.x86_64 | And History is following - | Id | Command | Action | Altered | - | 3 | history rollback 1 | Downgrade | 3 | - | 2 | group upgrade DNF-CI-RollbackTestGroup1 | Upgrade | 3 | - | 1 | group install DNF-CI-RollbackTestGroup1 | Install | 3 | - When I execute dnf with args "group list --installed DNF-CI-RollbackTestGroup1" + | Id | Command | Action | Altered | + | 3 | history rollback 1 | | 4 | + | 2 | group upgrade dnf-ci-group-rollback-testgroup1 | | 5 | + | 1 | group install dnf-ci-group-rollback-testgroup1 | | 3 | + When I execute dnf with args "group list --installed dnf-ci-group-rollback-testgroup1" Then the exit code is 0 And stdout is """ - Installed Groups: - DNF-CI-RollbackTestGroup1 + ID Name Installed + dnf-ci-group-rollback-testgroup1 DNF-CI-RollbackTestGroup1 yes """ @@ -64,34 +65,41 @@ Scenario: Rollback a rollbacked group upgrade transaction | Action | Package | | downgrade | TestGroup1PackageA-0:1.0-1.x86_64 | | downgrade | TestGroup1PackageB-0:1.0-1.x86_64 | + And stderr is + """ + Group upgrade cannot be reverted, however associated package actions will be. (Group id: 'dnf-ci-group-rollback-testgroup1') . + + Warning: skipped PGP checks for 2 packages from repository: dnf-ci-group-rollback-1 + """ And History is following - | Id | Command | Action | Altered | - | 3 | history rollback 1 | Downgrade | 3 | - | 2 | group upgrade DNF-CI-RollbackTestGroup1 | Upgrade | 3 | - | 1 | group install DNF-CI-RollbackTestGroup1 | Install | 3 | + | Id | Command | Action | Altered | + | 3 | history rollback 1 | | 4 | + | 2 | group upgrade dnf-ci-group-rollback-testgroup1 | | 5 | + | 1 | group install dnf-ci-group-rollback-testgroup1 | | 3 | When I execute dnf with args "history rollback 2" Then the exit code is 0 And Transaction is following | Action | Package | - | group-upgrade | DNF-CI-RollbackTestGroup1 | | upgrade | TestGroup1PackageA-0:1.1-1.x86_64 | | upgrade | TestGroup1PackageB-0:1.1-1.x86_64 | And History is following - | Id | Command | Action | Altered | - | 4 | history rollback 2 | Upgrade | 3 | - | 3 | history rollback 1 | Downgrade | 3 | - | 2 | group upgrade DNF-CI-RollbackTestGroup1 | Upgrade | 3 | - | 1 | group install DNF-CI-RollbackTestGroup1 | Install | 3 | - When I execute dnf with args "group list --installed DNF-CI-RollbackTestGroup1" + | Id | Command | Action | Altered | + | 4 | history rollback 2 | | 4 | + | 3 | history rollback 1 | | 4 | + | 2 | group upgrade dnf-ci-group-rollback-testgroup1 | | 5 | + | 1 | group install dnf-ci-group-rollback-testgroup1 | | 3 | + When I execute dnf with args "group list --installed dnf-ci-group-rollback-testgroup1" Then the exit code is 0 And stdout is """ - Installed Groups: - DNF-CI-RollbackTestGroup1 + ID Name Installed + dnf-ci-group-rollback-testgroup1 DNF-CI-RollbackTestGroup1 yes """ +# missing redo command +@xfail @bz2016070 Scenario: Redo an undo-ed group upgrade transaction Given I execute dnf with args "history undo last" @@ -112,7 +120,7 @@ Scenario: Redo an undo-ed group upgrade transaction @bz2016070 Scenario: Rollback multiple group upgrade transactions Given I use repository "dnf-ci-group-rollback-3" - And I successfully execute dnf with args "group upgrade DNF-CI-RollbackTestGroup1" + And I successfully execute dnf with args "group upgrade dnf-ci-group-rollback-testgroup1" Then Transaction is following | Action | Package | | group-upgrade | DNF-CI-RollbackTestGroup1 | @@ -120,10 +128,10 @@ Scenario: Rollback multiple group upgrade transactions | upgrade | TestGroup1PackageB-0:1.2-1.x86_64 | | install-group | TestGroup1PackageC-0:1.0-1.x86_64 | And History is following - | Id | Command | Action | Altered | - | 3 | group upgrade DNF-CI-RollbackTestGroup1 | I, U | 4 | - | 2 | group upgrade DNF-CI-RollbackTestGroup1 | Upgrade | 3 | - | 1 | group install DNF-CI-RollbackTestGroup1 | Install | 3 | + | Id | Command | Action | Altered | + | 3 | group upgrade dnf-ci-group-rollback-testgroup1 | | 6 | + | 2 | group upgrade dnf-ci-group-rollback-testgroup1 | | 5 | + | 1 | group install dnf-ci-group-rollback-testgroup1 | | 3 | Given I execute dnf with args "history rollback 1" Then the exit code is 0 And Transaction is following @@ -132,35 +140,35 @@ Scenario: Rollback multiple group upgrade transactions | downgrade | TestGroup1PackageB-0:1.0-1.x86_64 | | remove | TestGroup1PackageC-0:1.0-1.x86_64 | And History is following - | Id | Command | Action | Altered | - | 4 | history rollback 1 | D, E | 4 | - | 3 | group upgrade DNF-CI-RollbackTestGroup1 | I, U | 4 | - | 2 | group upgrade DNF-CI-RollbackTestGroup1 | Upgrade | 3 | - | 1 | group install DNF-CI-RollbackTestGroup1 | Install | 3 | - When I execute dnf with args "group list --installed DNF-CI-RollbackTestGroup1" + | Id | Command | Action | Altered | + | 4 | history rollback 1 | | 5 | + | 3 | group upgrade dnf-ci-group-rollback-testgroup1 | | 6 | + | 2 | group upgrade dnf-ci-group-rollback-testgroup1 | | 5 | + | 1 | group install dnf-ci-group-rollback-testgroup1 | | 3 | + When I execute dnf with args "group list --installed dnf-ci-group-rollback-testgroup1" Then the exit code is 0 And stdout is """ - Installed Groups: - DNF-CI-RollbackTestGroup1 + ID Name Installed + dnf-ci-group-rollback-testgroup1 DNF-CI-RollbackTestGroup1 yes """ @bz2016070 Scenario: Excluded package is remembered until next group install when rolling back a group upgrade transaction Given I use repository "dnf-ci-group-rollback-3" - And I successfully execute dnf with args "group upgrade DNF-CI-RollbackTestGroup1 -x TestGroup1PackageC" + And I successfully execute dnf with args "group upgrade dnf-ci-group-rollback-testgroup1 -x TestGroup1PackageC" Then Transaction is following | Action | Package | | group-upgrade | DNF-CI-RollbackTestGroup1 | | upgrade | TestGroup1PackageA-0:1.2-1.x86_64 | | upgrade | TestGroup1PackageB-0:1.2-1.x86_64 | And History is following - | Id | Command | Action | Altered | - | 3 | group upgrade DNF-CI-RollbackTestGroup1 | Upgrade | 3 | - | 2 | group upgrade DNF-CI-RollbackTestGroup1 | Upgrade | 3 | - | 1 | group install DNF-CI-RollbackTestGroup1 | Install | 3 | + | Id | Command | Action | Altered | + | 3 | group upgrade dnf-ci-group-rollback-testgroup1 | | 5 | + | 2 | group upgrade dnf-ci-group-rollback-testgroup1 | | 5 | + | 1 | group install dnf-ci-group-rollback-testgroup1 | | 3 | Given I execute dnf with args "history rollback 2" Then the exit code is 0 And Transaction is following @@ -168,12 +176,12 @@ Scenario: Excluded package is remembered until next group install when rolling b | downgrade | TestGroup1PackageA-0:1.1-1.x86_64 | | downgrade | TestGroup1PackageB-0:1.1-1.x86_64 | And History is following - | Id | Command | Action | Altered | - | 4 | history rollback 2 | Downgrade | 3 | - | 3 | group upgrade DNF-CI-RollbackTestGroup1 | Upgrade | 3 | - | 2 | group upgrade DNF-CI-RollbackTestGroup1 | Upgrade | 3 | - | 1 | group install DNF-CI-RollbackTestGroup1 | Install | 3 | - Given I successfully execute dnf with args "group upgrade DNF-CI-RollbackTestGroup1" + | Id | Command | Action | Altered | + | 4 | history rollback 2 | | 4 | + | 3 | group upgrade dnf-ci-group-rollback-testgroup1 | | 5 | + | 2 | group upgrade dnf-ci-group-rollback-testgroup1 | | 5 | + | 1 | group install dnf-ci-group-rollback-testgroup1 | | 3 | + Given I successfully execute dnf with args "group upgrade dnf-ci-group-rollback-testgroup1" Then the exit code is 0 And Transaction is following | Action | Package | @@ -181,31 +189,31 @@ Scenario: Excluded package is remembered until next group install when rolling b | upgrade | TestGroup1PackageA-0:1.2-1.x86_64 | | upgrade | TestGroup1PackageB-0:1.2-1.x86_64 | And History is following - | Id | Command | Action | Altered | - | 5 | group upgrade DNF-CI-RollbackTestGroup1 | Upgrade | 3 | - | 4 | history rollback 2 | Downgrade | 3 | - | 3 | group upgrade DNF-CI-RollbackTestGroup1 | Upgrade | 3 | - | 2 | group upgrade DNF-CI-RollbackTestGroup1 | Upgrade | 3 | - | 1 | group install DNF-CI-RollbackTestGroup1 | Install | 3 | - Given I successfully execute dnf with args "group install DNF-CI-RollbackTestGroup1" + | Id | Command | Action | Altered | + | 5 | group upgrade dnf-ci-group-rollback-testgroup1 | | 5 | + | 4 | history rollback 2 | | 4 | + | 3 | group upgrade dnf-ci-group-rollback-testgroup1 | | 5 | + | 2 | group upgrade dnf-ci-group-rollback-testgroup1 | | 5 | + | 1 | group install dnf-ci-group-rollback-testgroup1 | | 3 | + Given I successfully execute dnf with args "group install dnf-ci-group-rollback-testgroup1" Then the exit code is 0 And Transaction is following | Action | Package | | group-install | DNF-CI-RollbackTestGroup1 | | install-group | TestGroup1PackageC-0:1.0-1.x86_64 | And History is following - | Id | Command | Action | Altered | - | 6 | group install DNF-CI-RollbackTestGroup1 | Install | 2 | - | 5 | group upgrade DNF-CI-RollbackTestGroup1 | Upgrade | 3 | - | 4 | history rollback 2 | Downgrade | 3 | - | 3 | group upgrade DNF-CI-RollbackTestGroup1 | Upgrade | 3 | - | 2 | group upgrade DNF-CI-RollbackTestGroup1 | Upgrade | 3 | - | 1 | group install DNF-CI-RollbackTestGroup1 | Install | 3 | - When I execute dnf with args "group list --installed DNF-CI-RollbackTestGroup1" + | Id | Command | Action | Altered | + | 6 | group install dnf-ci-group-rollback-testgroup1 | | 2 | + | 5 | group upgrade dnf-ci-group-rollback-testgroup1 | | 5 | + | 4 | history rollback 2 | | 4 | + | 3 | group upgrade dnf-ci-group-rollback-testgroup1 | | 5 | + | 2 | group upgrade dnf-ci-group-rollback-testgroup1 | | 5 | + | 1 | group install dnf-ci-group-rollback-testgroup1 | | 3 | + When I execute dnf with args "group list --installed dnf-ci-group-rollback-testgroup1" Then the exit code is 0 And stdout is """ - Installed Groups: - DNF-CI-RollbackTestGroup1 + ID Name Installed + dnf-ci-group-rollback-testgroup1 DNF-CI-RollbackTestGroup1 yes """ From 832125300bfa52bab139e2cc3f74b1bbf6fcf97e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= Date: Mon, 24 Jun 2024 14:15:43 +0200 Subject: [PATCH 4/8] Enable `history-rollback-env-upgrade.feature` - dnf5 history list doesn't fill in actions: https://github.com/rpm-software-management/dnf5/issues/1448 - comps commands now accept ids instead of a names - There is a change in `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. - There is a change in one test where group/env upgrade action cannot be reverted now, instead the transaction prints a warning to stderr. --- .../dnf/history-rollback-env-upgrade.feature | 80 ++++++++++--------- 1 file changed, 44 insertions(+), 36 deletions(-) diff --git a/dnf-behave-tests/dnf/history-rollback-env-upgrade.feature b/dnf-behave-tests/dnf/history-rollback-env-upgrade.feature index 495ac28ed..428931123 100644 --- a/dnf-behave-tests/dnf/history-rollback-env-upgrade.feature +++ b/dnf-behave-tests/dnf/history-rollback-env-upgrade.feature @@ -1,9 +1,10 @@ +@dnf5 Feature: Transaction history rollback of environment upgrades Background: Given I use repository "dnf-ci-group-rollback-1" - And I successfully execute dnf with args "group install DNF-CI-RollbackTestEnv" + And I successfully execute dnf with args "group install dnf-ci-group-rollback-testenv" Then Transaction is following | Action | Package | | env-install | DNF-CI-RollbackTestEnv | @@ -14,18 +15,18 @@ Background: | install-group | TestGroup2PackageA-0:1.0-1.x86_64 | | install-group | TestGroup2PackageB-0:1.0-1.x86_64 | And History is following - | Id | Command | Action | Altered | - | 1 | group install DNF-CI-RollbackTestEnv | Install | 7 | - When I execute dnf with args "group list --installed DNF-CI-RollbackTestEnv" + | Id | Command | Action | Altered | + | 1 | group install dnf-ci-group-rollback-testenv | | 7 | + When I execute dnf with args "environment list --installed dnf-ci-group-rollback-testenv" Then the exit code is 0 And stdout is """ - Installed Environment Groups: - DNF-CI-RollbackTestEnv + ID Name Installed + dnf-ci-group-rollback-testenv DNF-CI-RollbackTestEnv yes """ Given I use repository "dnf-ci-group-rollback-2" - And I successfully execute dnf with args "group upgrade DNF-CI-RollbackTestEnv" + And I successfully execute dnf with args "group upgrade dnf-ci-group-rollback-testenv" Then Transaction is following | Action | Package | | env-upgrade | DNF-CI-RollbackTestEnv | @@ -36,9 +37,9 @@ Background: | upgrade | TestGroup2PackageA-0:1.1-1.x86_64 | | upgrade | TestGroup2PackageB-0:1.1-1.x86_64 | And History is following - | Id | Command | Action | Altered | - | 2 | group upgrade DNF-CI-RollbackTestEnv | Upgrade | 7 | - | 1 | group install DNF-CI-RollbackTestEnv | Install | 7 | + | Id | Command | Action | Altered | + | 2 | group upgrade dnf-ci-group-rollback-testenv | | 11 | + | 1 | group install dnf-ci-group-rollback-testenv | | 7 | @bz2016070 @@ -52,17 +53,17 @@ Scenario: Rollback an environment upgrade transaction | downgrade | TestGroup2PackageA-0:1.0-1.x86_64 | | downgrade | TestGroup2PackageB-0:1.0-1.x86_64 | And History is following - | Id | Command | Action | Altered | - | 3 | history rollback 1 | Downgrade | 7 | - | 2 | group upgrade DNF-CI-RollbackTestEnv | Upgrade | 7 | - | 1 | group install DNF-CI-RollbackTestEnv | Install | 7 | - When I execute dnf with args "group list --installed DNF-CI-RollbackTestEnv" + | Id | Command | Action | Altered | + | 3 | history rollback 1 | | 8 | + | 2 | group upgrade dnf-ci-group-rollback-testenv | | 11 | + | 1 | group install dnf-ci-group-rollback-testenv | | 7 | + When I execute dnf with args "environment list --installed dnf-ci-group-rollback-testenv" Then the exit code is 0 And stdout is """ - Installed Environment Groups: - DNF-CI-RollbackTestEnv + ID Name Installed + dnf-ci-group-rollback-testenv DNF-CI-RollbackTestEnv yes """ @@ -76,38 +77,45 @@ Scenario: Rollback a rollbacked environment upgrade transaction | downgrade | TestGroup1PackageB-0:1.0-1.x86_64 | | downgrade | TestGroup2PackageA-0:1.0-1.x86_64 | | downgrade | TestGroup2PackageB-0:1.0-1.x86_64 | + And stderr is + """ + Group upgrade cannot be reverted, however associated package actions will be. (Group id: 'dnf-ci-group-rollback-testgroup1') . + Group upgrade cannot be reverted, however associated package actions will be. (Group id: 'dnf-ci-group-rollback-testgroup2') . + Environment upgrade cannot be reverted, however associated package actions will be. (Environment id: 'dnf-ci-group-rollback-testenv') . + + Warning: skipped PGP checks for 4 packages from repository: dnf-ci-group-rollback-1 + """ And History is following - | Id | Command | Action | Altered | - | 3 | history rollback 1 | Downgrade | 7 | - | 2 | group upgrade DNF-CI-RollbackTestEnv | Upgrade | 7 | - | 1 | group install DNF-CI-RollbackTestEnv | Install | 7 | + | Id | Command | Action | Altered | + | 3 | history rollback 1 | | 8 | + | 2 | group upgrade dnf-ci-group-rollback-testenv | | 11 | + | 1 | group install dnf-ci-group-rollback-testenv | | 7 | When I execute dnf with args "history rollback 2" Then the exit code is 0 And Transaction is following | Action | Package | - | env-upgrade | DNF-CI-RollbackTestEnv | - | group-upgrade | DNF-CI-RollbackTestGroup1 | - | group-upgrade | DNF-CI-RollbackTestGroup2 | | upgrade | TestGroup1PackageA-0:1.1-1.x86_64 | | upgrade | TestGroup1PackageB-0:1.1-1.x86_64 | | upgrade | TestGroup2PackageA-0:1.1-1.x86_64 | | upgrade | TestGroup2PackageB-0:1.1-1.x86_64 | And History is following - | Id | Command | Action | Altered | - | 4 | history rollback 2 | Upgrade | 7 | - | 3 | history rollback 1 | Downgrade | 7 | - | 2 | group upgrade DNF-CI-RollbackTestEnv | Upgrade | 7 | - | 1 | group install DNF-CI-RollbackTestEnv | Install | 7 | - When I execute dnf with args "group list --installed DNF-CI-RollbackTestEnv" + | Id | Command | Action | Altered | + | 4 | history rollback 2 | | 8 | + | 3 | history rollback 1 | | 8 | + | 2 | group upgrade dnf-ci-group-rollback-testenv | | 11 | + | 1 | group install dnf-ci-group-rollback-testenv | | 7 | + When I execute dnf with args "environment list --installed DNF-CI-RollbackTestEnv" Then the exit code is 0 And stdout is """ - Installed Environment Groups: - DNF-CI-RollbackTestEnv + ID Name Installed + dnf-ci-group-rollback-testenv DNF-CI-RollbackTestEnv yes """ +# missing redo command +@xfail @bz2016070 Scenario: Redo an undo-ed environment upgrade transaction Given I execute dnf with args "history undo last" @@ -119,9 +127,9 @@ Scenario: Redo an undo-ed environment upgrade transaction | downgrade | TestGroup2PackageA-0:1.0-1.x86_64 | | downgrade | TestGroup2PackageB-0:1.0-1.x86_64 | And History is following - | Id | Command | Action | Altered | - | 3 | history undo last | Downgrade | 7 | - | 2 | group upgrade DNF-CI-RollbackTestEnv | Upgrade | 7 | - | 1 | group install DNF-CI-RollbackTestEnv | Install | 7 | + | Id | Command | Action | Altered | + | 3 | history undo last | | 7 | + | 2 | group upgrade DNF-CI-RollbackTestEnv | | 7 | + | 1 | group install DNF-CI-RollbackTestEnv | | 7 | When I execute dnf with args "history redo last" Then the exit code is 0 From e1299847f7cd583f696c94f489808dc9d2e40301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= Date: Mon, 24 Jun 2024 14:20:04 +0200 Subject: [PATCH 5/8] Enable rollback scenario in `history-undo.feature` --- dnf-behave-tests/dnf/history-undo.feature | 1 - 1 file changed, 1 deletion(-) diff --git a/dnf-behave-tests/dnf/history-undo.feature b/dnf-behave-tests/dnf/history-undo.feature index 92c3ab029..d764d18dd 100644 --- a/dnf-behave-tests/dnf/history-undo.feature +++ b/dnf-behave-tests/dnf/history-undo.feature @@ -189,7 +189,6 @@ Scenario: Undoing an older transaction with Reason Change | wget-1.19.5-5.fc29.x86_64 | User | -@xfail @bz2010259 @bz2053014 Scenario: Undoing a transaction range with Reason Change From cdc8f84a17e981085dce7854a62e59c0fe9b68ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= Date: Mon, 24 Jun 2024 14:22:06 +0200 Subject: [PATCH 6/8] Enable `history-update.feature` - dnf5 history list doesn't fill in actions: https://github.com/rpm-software-management/dnf5/issues/1448 - There is a change in `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. - Reverting install of dependecies that are not used by anything else is now described as `remove-unused`. --- dnf-behave-tests/dnf/history-update.feature | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/dnf-behave-tests/dnf/history-update.feature b/dnf-behave-tests/dnf/history-update.feature index a12f7e733..969f3866e 100644 --- a/dnf-behave-tests/dnf/history-update.feature +++ b/dnf-behave-tests/dnf/history-update.feature @@ -1,3 +1,4 @@ +@dnf5 Feature: History of update Background: @@ -29,10 +30,10 @@ Scenario: History of update packages | upgrade | wget-0:1.19.6-5.fc29.x86_64 | | upgrade | abcde-0:2.9.3-1.fc29.noarch | And History is following - | Id | Command | Action | Altered | - | 3 | update | Upgrade | 3 | - | 2 | | Install | 3 | - | 1 | | Install | 1 | + | Id | Command | Action | Altered | + | 3 | update | | 6 | + | 2 | | | 3 | + | 1 | | | 1 | @bz1612885 @@ -55,5 +56,5 @@ Scenario: Rollback update And Transaction is following | Action | Package | | remove | abcde-0:2.9.2-1.fc29.noarch | - | remove | flac-0:1.3.2-8.fc29.x86_64 | - | remove-dep | wget-0:1.19.5-5.fc29.x86_64 | + | remove-unused | flac-0:1.3.2-8.fc29.x86_64 | + | remove-unused | wget-0:1.19.5-5.fc29.x86_64 | From 39fb6a6fb33effbc037c8a8f8c16bc7f4a1e6052 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= Date: Tue, 25 Jun 2024 05:45:41 +0200 Subject: [PATCH 7/8] Goal reverting now proceses packages in different order, update tests --- dnf-behave-tests/dnf/history-undo.feature | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dnf-behave-tests/dnf/history-undo.feature b/dnf-behave-tests/dnf/history-undo.feature index d764d18dd..5f0217e4f 100644 --- a/dnf-behave-tests/dnf/history-undo.feature +++ b/dnf-behave-tests/dnf/history-undo.feature @@ -72,8 +72,8 @@ Scenario: Handle missing packages required for undoing the transaction And stderr is """ 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. + Cannot perform Install action, no match for: flac-1.3.2-8.fc29.x86_64. You can try to add to command line: --skip-unavailable to skip unavailable packages """ @@ -99,8 +99,8 @@ Scenario: Missing packages are skipped if --skip-unavailable is specified And Transaction is empty And stderr is """ - 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. + Cannot perform Install action, no match for: flac-1.3.2-8.fc29.x86_64. """ From b7c09e6a7e667014db3bedadf21264b42738e635 Mon Sep 17 00:00:00 2001 From: Jan Kolarik Date: Tue, 27 Feb 2024 09:56:36 +0000 Subject: [PATCH 8/8] Add tests for history rollback between states with the same version of a package installed - dnf5 history list doesn't fill in actions: https://github.com/rpm-software-management/dnf5/iss - 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/history-rollback-same-package.feature | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 dnf-behave-tests/dnf/history-rollback-same-package.feature diff --git a/dnf-behave-tests/dnf/history-rollback-same-package.feature b/dnf-behave-tests/dnf/history-rollback-same-package.feature new file mode 100644 index 000000000..df5934340 --- /dev/null +++ b/dnf-behave-tests/dnf/history-rollback-same-package.feature @@ -0,0 +1,40 @@ +@dnf5 +Feature: Transaction history rollback between states with the same version of a package installed + + +Background: + Given I use repository "dnf-ci-fedora" + And I successfully execute dnf with args "install flac" + + +# https://github.com/rpm-software-management/dnf/issues/2031 +@GH-2031 +Scenario: Rollback removal and installation of the same package + Given I successfully execute dnf with args "remove flac" + And I successfully execute dnf with args "install flac" + And I successfully execute dnf with args "history list" + Then stdout is history list + | Id | Command | Action | Altered | + | 3 | | | 1 | + | 2 | | | 1 | + | 1 | | | 1 | + Given I successfully execute dnf with args "history rollback 1" + Then Transaction is empty + + +# https://issues.redhat.com/browse/RHEL-17494 +@RHEL-17494 +Scenario: Two rollbacks of the package upgrade + Given I use repository "dnf-ci-fedora-updates" + And I successfully execute dnf with args "upgrade flac" + And I successfully execute dnf with args "history list" + Then stdout is history list + | Id | Command | Action | Altered | + | 2 | | | 2 | + | 1 | | | 1 | + Given I successfully execute dnf with args "history rollback 1" + Then Transaction is following + | Action | Package | + | downgrade | flac-1.3.2-8.fc29.x86_64 | + Given I successfully execute dnf with args "history rollback 1" + Then Transaction is empty