Skip to content

Commit

Permalink
Add test for replay group install without package_types
Browse files Browse the repository at this point in the history
  • Loading branch information
kontura committed Jul 16, 2024
1 parent 26975be commit f7927b9
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 0 deletions.
58 changes: 58 additions & 0 deletions dnf-behave-tests/dnf/transaction-sr/replay.feature
Original file line number Diff line number Diff line change
Expand Up @@ -1521,3 +1521,61 @@ Given I create file "/{context.dnf.tempdir}/transaction/transaction.json" with
"""
Something like: Cannot install package with reason Group because 'test-group` is not installed.
"""


Scenario: Replay installing a group without package_types specified sets no package types
Given I create file "/{context.dnf.tempdir}/transaction/transaction.json" with
"""
{
"groups": [
{
"action": "Install",
"id": "test-group",
"reason": "User",
}
],
"version": "1.0"
}
"""
When I execute dnf with args "replay ./transaction"
Then the exit code is 0
And Transaction is following
| Action | Package |
| group-install | Test Group |
And dnf5 transaction items for transaction "last" are
| action | package | reason | repository |
| Install | test-group | User | transaction-sr |
And group state is
| id | package_types | packages | userinstalled |
| test-group | | top-a | True |


Scenario: Replay installing a group with package_types which are then used for upgrade
Given I create file "/{context.dnf.tempdir}/transaction/transaction.json" with
"""
{
"groups": [
{
"action": "Install",
"id": "test-group",
"package_types": "mandatory",
"reason": "User",
}
],
"version": "1.0"
}
"""
And I successfully execute dnf with args "replay ./transaction"
And I drop repository "transaction-sr"
And I use repository "transaction-sr-upgrade"
# Only new mandatory packages are installed from test-group from transaction-sr-upgade,
# it doesn't include new "default" package bottom-f.
When I execute dnf with args "group upgrade test-group"
Then the exit code is 0
And Transaction is following
| Action | Package |
| install-group | bottom-e-1.0-1.x86_64 |
| group-upgrade | Test Group |
And group state is
| id | package_types | packages | userinstalled |
| test-group | mandatory | bottom-e, top-a | True |
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Name: bottom-e
Version: 1.0
Release: 1

License: Public Domain
URL: None

Summary: Bottom level package

%description
Dummy.

%files

%changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Name: bottom-f
Version: 1.0
Release: 1

License: Public Domain
URL: None

BuildArch: noarch

Summary: Bottom level package

%description
Dummy.

%files

%changelog
18 changes: 18 additions & 0 deletions dnf-behave-tests/fixtures/specs/transaction-sr-upgrade/comps.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE comps PUBLIC "-//Red Hat, Inc.//DTD Comps info//EN" "comps.dtd">
<comps>
<group>
<id>test-group</id>
<default>false</default>
<uservisible>true</uservisible>
<name>Test Group</name>
<description>This group serves for testing purposes</description>
<packagelist>
<packagereq type="mandatory">top-a</packagereq>
<packagereq type="mandatory">bottom-e</packagereq>
<packagereq type="default">top-b</packagereq>
<packagereq type="default">bottom-f</packagereq>
<packagereq type="optional">top-c</packagereq>
</packagelist>
</group>
</comps>

0 comments on commit f7927b9

Please sign in to comment.