Skip to content

Commit

Permalink
Enable history-undo.feature
Browse files Browse the repository at this point in the history
- dnf5 history list doesn't fill in actions: rpm-software-management/dnf5#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.
  • Loading branch information
kontura committed Apr 26, 2024
1 parent d02fb04 commit 84e7b5c
Showing 1 changed file with 65 additions and 58 deletions.
123 changes: 65 additions & 58 deletions dnf-behave-tests/dnf/history-undo.feature
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@dnf5
Feature: Transaction history undo


Expand All @@ -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
Expand All @@ -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
Expand All @@ -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:
No match for argument: flac-1.3.2-8.fc29.x86_64
No match for argument: wget-1.19.5-5.fc29.x86_64
You can try to add to command line:
--skip-unavailable to skip unavailable packages
"""


Expand All @@ -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".
No match for argument: flac-1.3.2-8.fc29.x86_64
No match for argument: wget-1.19.5-5.fc29.x86_64
"""


Expand All @@ -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:
Argument 'filesystem-3.9-2.fc29.x86_64' matches only excluded packages.
Problem: package filesystem-3.9-2.fc29.x86_64 requires setup, but none of the providers can be installed
- conflicting requests
- problem with installed package
"""


Expand All @@ -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
Expand All @@ -152,53 +158,54 @@ 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"
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 |
Expand Down

0 comments on commit 84e7b5c

Please sign in to comment.