Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable history rollback tests #1515

Merged
merged 8 commits into from
Jul 2, 2024
52 changes: 30 additions & 22 deletions dnf-behave-tests/dnf/history-rollback-comps.feature
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
@dnf5
Feature: Transaction history rollback - comps


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 |
| install-group | filesystem-0:3.9-2.fc29.x86_64 |
| 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
Expand All @@ -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
Expand All @@ -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
80 changes: 44 additions & 36 deletions dnf-behave-tests/dnf/history-rollback-env-upgrade.feature
Original file line number Diff line number Diff line change
@@ -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 |
Expand All @@ -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
"""
<REPOSYNC>
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 |
Expand All @@ -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
Expand All @@ -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
"""
<REPOSYNC>
Installed Environment Groups:
DNF-CI-RollbackTestEnv
ID Name Installed
dnf-ci-group-rollback-testenv DNF-CI-RollbackTestEnv yes
"""


Expand All @@ -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
"""
<REPOSYNC>
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"
Expand All @@ -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
Loading
Loading