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 tests fot history store and add tests for --store option #1527

Merged
merged 5 commits into from
Jul 17, 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
291 changes: 291 additions & 0 deletions dnf-behave-tests/dnf/transaction-sr/store-option.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,291 @@
@dnf5
Feature: Transaction --store tests

Background:
Given I set working directory to "{context.dnf.tempdir}"
And I use repository "transaction-sr"


Scenario: Store an install transaction
When I execute dnf with args "install top-a-1.0 --store ./transaction"
Then the exit code is 0
And stderr is empty
And file "/{context.dnf.tempdir}/transaction/transaction.json" contents is
"""
{
"rpms":[
{
"nevra":"top-a-1:1.0-1.x86_64",
"action":"Install",
"reason":"User",
"repo_id":"transaction-sr",
"package_path":".\/packages\/top-a-1.0-1.x86_64.rpm"
},
{
"nevra":"mid-a1-1.0-1.x86_64",
"action":"Install",
"reason":"Dependency",
"repo_id":"transaction-sr",
"package_path":".\/packages\/mid-a1-1.0-1.x86_64.rpm"
},
{
"nevra":"bottom-a2-1.0-1.x86_64",
"action":"Install",
"reason":"Dependency",
"repo_id":"transaction-sr",
"package_path":".\/packages\/bottom-a2-1.0-1.x86_64.rpm"
},
{
"nevra":"mid-a2-1.0-1.x86_64",
"action":"Install",
"reason":"Weak Dependency",
"repo_id":"transaction-sr",
"package_path":".\/packages\/mid-a2-1.0-1.x86_64.rpm"
},
{
"nevra":"bottom-a3-1.0-1.x86_64",
"action":"Install",
"reason":"Dependency",
"repo_id":"transaction-sr",
"package_path":".\/packages\/bottom-a3-1.0-1.x86_64.rpm"
}
],
"version":"1.0"
}
"""
When I execute "ls {context.dnf.tempdir}/transaction/"
Then stdout is
"""
packages
transaction.json
"""
When I execute "ls {context.dnf.tempdir}/transaction/packages"
Then stdout is
"""
bottom-a2-1.0-1.x86_64.rpm
bottom-a3-1.0-1.x86_64.rpm
mid-a1-1.0-1.x86_64.rpm
mid-a2-1.0-1.x86_64.rpm
top-a-1.0-1.x86_64.rpm
"""


Scenario: Store a remove transaction
Given I successfully execute dnf with args "install top-a-1.0"
When I execute dnf with args "remove top-a --store ./transaction"
Then the exit code is 0
And file "/{context.dnf.tempdir}/transaction/transaction.json" contents is
"""
{
"rpms":[
{
"nevra":"bottom-a2-1.0-1.x86_64",
"action":"Remove",
"reason":"Clean",
"repo_id":"@System"
},
{
"nevra":"bottom-a3-1.0-1.x86_64",
"action":"Remove",
"reason":"Clean",
"repo_id":"@System"
},
{
"nevra":"mid-a1-1.0-1.x86_64",
"action":"Remove",
"reason":"Clean",
"repo_id":"@System"
},
{
"nevra":"mid-a2-1.0-1.x86_64",
"action":"Remove",
"reason":"Clean",
"repo_id":"@System"
},
{
"nevra":"top-a-1:1.0-1.x86_64",
"action":"Remove",
"reason":"User",
"repo_id":"@System"
}
],
"version":"1.0"
}
"""
When I execute "ls {context.dnf.tempdir}/transaction/"
Then stdout is
"""
transaction.json
"""


Scenario: Store a group install transaction
When I execute dnf with args "install @test-group --store ./transaction"
Then the exit code is 0
And file "/{context.dnf.tempdir}/transaction/transaction.json" contents is
"""
{
"rpms":[
{
"nevra":"top-b-1.0-1.x86_64",
"action":"Install",
"reason":"Group",
"repo_id":"transaction-sr",
"package_path":".\/packages\/top-b-1.0-1.x86_64.rpm"
},
{
"nevra":"top-a-1:2.0-1.x86_64",
"action":"Install",
"reason":"Group",
"repo_id":"transaction-sr",
"package_path":".\/packages\/top-a-2.0-1.x86_64.rpm"
},
{
"nevra":"mid-a1-1.0-1.x86_64",
"action":"Install",
"reason":"Dependency",
"repo_id":"transaction-sr",
"package_path":".\/packages\/mid-a1-1.0-1.x86_64.rpm"
},
{
"nevra":"bottom-a1-2.0-1.noarch",
"action":"Install",
"reason":"Dependency",
"repo_id":"transaction-sr",
"package_path":".\/packages\/bottom-a1-2.0-1.noarch.rpm"
},
{
"nevra":"bottom-a2-1.0-1.x86_64",
"action":"Install",
"reason":"Dependency",
"repo_id":"transaction-sr",
"package_path":".\/packages\/bottom-a2-1.0-1.x86_64.rpm"
},
{
"nevra":"mid-a2-2.0-1.x86_64",
"action":"Install",
"reason":"Weak Dependency",
"repo_id":"transaction-sr",
"package_path":".\/packages\/mid-a2-2.0-1.x86_64.rpm"
},
{
"nevra":"bottom-a3-1.0-1.x86_64",
"action":"Install",
"reason":"Dependency",
"repo_id":"transaction-sr",
"package_path":".\/packages\/bottom-a3-1.0-1.x86_64.rpm"
}
],
"groups":[
{
"id":"test-group",
"action":"Install",
"reason":"User",
"group_path":".\/comps\/test-group.xml",
"repo_id":"transaction-sr",
"package_types":"mandatory, default, conditional"
}
],
"version":"1.0"
}
"""
When I execute "ls {context.dnf.tempdir}/transaction/"
Then stdout is
"""
comps
packages
transaction.json
"""
When I execute "ls {context.dnf.tempdir}/transaction/packages"
Then stdout is
"""
bottom-a1-2.0-1.noarch.rpm
bottom-a2-1.0-1.x86_64.rpm
bottom-a3-1.0-1.x86_64.rpm
mid-a1-1.0-1.x86_64.rpm
mid-a2-2.0-1.x86_64.rpm
top-a-2.0-1.x86_64.rpm
top-b-1.0-1.x86_64.rpm
"""
When I execute "ls {context.dnf.tempdir}/transaction/comps"
Then stdout is
"""
test-group.xml
"""


Scenario: Store a group remove transaction
Given I execute dnf with args "install @test-group"
When I execute dnf with args "remove @test-group --store ./transaction"
Then the exit code is 0
And file "/{context.dnf.tempdir}/transaction/transaction.json" contents is
"""
{
"rpms":[
{
"nevra":"bottom-a1-2.0-1.noarch",
"action":"Remove",
"reason":"Clean",
"repo_id":"@System"
},
{
"nevra":"bottom-a2-1.0-1.x86_64",
"action":"Remove",
"reason":"Clean",
"repo_id":"@System"
},
{
"nevra":"bottom-a3-1.0-1.x86_64",
"action":"Remove",
"reason":"Clean",
"repo_id":"@System"
},
{
"nevra":"mid-a1-1.0-1.x86_64",
"action":"Remove",
"reason":"Clean",
"repo_id":"@System"
},
{
"nevra":"mid-a2-2.0-1.x86_64",
"action":"Remove",
"reason":"Clean",
"repo_id":"@System"
},
{
"nevra":"top-a-1:2.0-1.x86_64",
"action":"Remove",
"reason":"Group",
"repo_id":"@System"
},
{
"nevra":"top-b-1.0-1.x86_64",
"action":"Remove",
"reason":"Group",
"repo_id":"@System"
}
],
"groups":[
{
"id":"test-group",
"action":"Remove",
"reason":"User",
"group_path":".\/comps\/test-group.xml",
"repo_id":"@System",
"package_types":""
}
],
"version":"1.0"
}
"""
When I execute "ls {context.dnf.tempdir}/transaction/"
Then stdout is
"""
comps
transaction.json
"""
When I execute "ls {context.dnf.tempdir}/transaction/comps"
Then stdout is
"""
test-group.xml
"""
Loading
Loading