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 undo tests #1497

Merged
merged 6 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dnf-behave-tests/dnf/downgrade.feature
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ Scenario: Downgrade a package that was installed via rpm
| Action | Package |
| downgrade | flac-0:1.3.3-2.fc29.x86_64 |
Then package reasons are
| Package | Reason |
| flac-1.3.3-2.fc29.x86_64 | unknown |
| Package | Reason |
| flac-1.3.3-2.fc29.x86_64 | External User |
And package state is
| package | reason | from_repo |
| flac-1.3.3-2.fc29.x86_64 | External User | dnf-ci-fedora-updates |
Expand Down
38 changes: 26 additions & 12 deletions dnf-behave-tests/dnf/history-undo-comps.feature
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
@dnf5
Feature: Transaction history undo - comps


Background:
Given I use repository "dnf-ci-fedora"
And I use repository "dnf-ci-thirdparty"
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 |
Expand All @@ -14,7 +15,7 @@ Background:
| install-dep | lame-libs-0:3.100-4.fc29.x86_64 |
And History is following
| Id | Command | Action | Altered |
| 1 | group install DNF-CI-Testgroup | Install | 5 |
| 1 | group install dnf-ci-testgroup | | 5 |


@bz1809639
Expand All @@ -26,16 +27,16 @@ Scenario: Undo 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-dep | setup-2.12.1-1.fc29.noarch |
| remove-unused | lame-libs-0:3.100-4.fc29.x86_64 |
| remove-unused | setup-2.12.1-1.fc29.noarch |
And History is following
| Id | Command | Action | Altered |
| 2 | history undo last | Removed | 5 |
| 1 | group install DNF-CI-Testgroup | Install | 5 |
| 2 | history undo last | | 5 |
| 1 | group install dnf-ci-testgroup | | 5 |


Scenario: Undo 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 undo last"
Then the exit code is 0
And Transaction is following
Expand All @@ -47,17 +48,30 @@ Scenario: Undo a transaction that removed a group
| install-dep | setup-2.12.1-1.fc29.noarch |
And History is following
| Id | Command | Action | Altered |
| 3 | history undo last | Install | 5 |
| 2 | group remove DNF-CI-Testgroup | Removed | 5 |
| 1 | group install DNF-CI-Testgroup | Install | 5 |
| 3 | history undo last | | 5 |
| 2 | group remove dnf-ci-testgroup | | 5 |
| 1 | group install dnf-ci-testgroup | | 5 |


Scenario: Undo a transaction with a missing group
Given I drop repository "dnf-ci-thirdparty"
# The group is stored in system state (it can always be removed)
When I execute dnf with args "history undo 1"
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 |
| remove-unused | setup-2.12.1-1.fc29.noarch |
# Undo the last undo (this should install the group again but it is missing)
When I execute dnf with args "history undo last"
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.
Failed to resolve the transaction:
No match for argument: dnf-ci-testgroup
You can try to add to command line:
--skip-unavailable to skip unavailable packages
"""
25 changes: 16 additions & 9 deletions dnf-behave-tests/dnf/history-undo-dependant.feature
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
@dnf5
Feature: Transaction history undo

@bz1700529
Scenario: Undo module install with dependent userinstalled package
Given I use repository "dnf-ci-fedora"
And I use repository "dnf-ci-fedora-modular"
# install module that contains postgresql-server
When I execute dnf with args "module install postgresql/server"
Then the exit code is 0
And Transaction contains
| Action | Package |
| install-group | postgresql-server-0:9.6.8-1.module_1710+b535a823.x86_64 |
And I successfully execute dnf with args "module enable postgresql/server"
And I successfully execute dnf with args "install postgresql-server-0:9.6.8-1.module_1710+b535a823.x86_64"
# install package, that requires postgresql-server
When I execute dnf with args "install postgresql-test"
Then the exit code is 0
And I successfully execute dnf with args "install postgresql-test"
# try to undo module install transaction
When I execute dnf with args "history undo last-1"
# the transaction is not supposed to reinstall required packages, but to fail
Then the exit code is 1
And stdout does not contain "Reinstalling\s+: postgresql-server-9\.6\.8-1\.module_1710\+b535a823"
And stderr contains "package postgresql-test-9\.6\.8-1\.module_1710\+b535a823\.x86_64 requires postgresql-server\(x86-64\) = 9\.6\.8-1\.module_1710\+b535a823, but none of the providers can be installed"
And stdout is
"""
<REPOSYNC>
"""
And stderr is
"""
Failed to resolve the transaction:
Extra package 'postgresql-test-9.6.8-1.module_1710+b535a823.x86_64' (with action 'Remove') which is not present in the stored transaction was pulled into the transaction.

You can try to add to command line:
--ignore-extras to allow extra packages in the transaction
"""
9 changes: 5 additions & 4 deletions dnf-behave-tests/dnf/history-undo-obsoletes.feature
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@dnf5
Feature: Transaction history undo with obsoletes

# Package glibc-all-langpacks requires glibc
Expand Down Expand Up @@ -30,10 +31,10 @@ Scenario: Undo with obsoletes
And Transaction is following
| Action | Package |
| remove | glibc-all-langpacks-0:2.28-9.fc29.x86_64 |
| remove-dep | setup-0:2.12.1-1.fc29.noarch |
| remove-unused | setup-0:2.12.1-1.fc29.noarch |
| remove | glibc-0:2.28-9.fc29.x86_64 |
| remove-dep | glibc-common-0:2.28-9.fc29.x86_64 |
| remove-dep | filesystem-0:3.9-2.fc29.x86_64 |
| remove-dep | basesystem-0:11-6.fc29.noarch |
| remove-unused | glibc-common-0:2.28-9.fc29.x86_64 |
| remove-unused | filesystem-0:3.9-2.fc29.x86_64 |
| remove-unused | basesystem-0:11-6.fc29.noarch |
| install | glibc-profile-0:2.3.1-10.x86_64 |

Loading
Loading