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

Review s* features #1623

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
122 changes: 45 additions & 77 deletions dnf-behave-tests/dnf/scriptlets.feature
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
@dnf5
Feature: Test for successful and failing rpm scriptlets


Background: Enable repository
Given I use repository "scriptlets"
# Some of the rpm scriptlet outputs can be quite long and since they are
# truncated: https://github.com/rpm-software-management/dnf5/issues/1829
# we need to force the width to see it in full.
And I set environment variable "FORCE_COLUMNS" to "400"


@dnf5
Scenario Outline: Install a pkg with a successful scriptlet
When I execute dnf with args "install <package>"
Then the exit code is 0
Expand All @@ -22,37 +26,34 @@ Examples:
| Package-posttrans-ok | posttrans scriptlet successfully done |


# @dnf5
# TODO(nsella) different exit code
Scenario Outline: Install a pkg with a failing %pre[IN|TRANS] scriptlet
When I execute dnf with args "install <package>"
Then the exit code is 1
And stderr contains "Error in <scriptlet> scriptlet in rpm package <package>"
And stderr contains "Error: Transaction failed"

And stderr contains ">>> Running <scriptlet> scriptlet: <package>"
And stderr contains ">>> Error in <scriptlet> scriptlet: <package>"
And stderr contains "Transaction failed: Rpm transaction failed."

Examples:
| package | scriptlet |
| Package-pre-fail | PREIN |
| Package-pretrans-fail | PRETRANS |
| package | scriptlet |
| Package-pre-fail-0:1.0-1.x86_64 | pre-install |
| Package-pretrans-fail-0:1.0-1.x86_64 | pre-transaction |


# @dnf5
# TODO(nsella) different stderr
Scenario Outline: Install a pkg with a failing %post[in|trans] scriptlet
When I execute dnf with args "install <package>"
Then the exit code is 0
And Transaction is following
| Action | Package |
| install | <package>-0:1.0-1.x86_64 |
And stderr contains "Error in <scriptlet> scriptlet in rpm package <package>"

| Action | Package |
| install | <package> |
And stderr contains ">>> Running <scriptlet> scriptlet: <package>"
And stderr contains ">>> Non-critical error in <scriptlet> scriptlet: <package>"

Examples:
| package | scriptlet |
| Package-post-fail | POSTIN |
| Package-posttrans-fail | POSTTRANS |
| package | scriptlet |
| Package-post-fail-0:1.0-1.x86_64 | post-install |
| Package-posttrans-fail-0:1.0-1.x86_64 | post-transaction |


@dnf5
Scenario Outline: Remove a pkg with a successful %[pre|post]un scriptlet
When I execute dnf with args "install <package>"
Then the exit code is 0
Expand All @@ -62,15 +63,13 @@ Scenario Outline: Remove a pkg with a successful %[pre|post]un scriptlet
When I execute dnf with args "remove <package>"
Then the exit code is 0
And stdout contains "<output>"

Examples:
| package | output |
| Package-preun-ok | preun scriptlet successfully done |
| Package-postun-ok | postun scriptlet successfully done |


# @dnf5
# TODO(nsella) different exit code
Scenario: Remove a pkg with a failing %preun scriptlet
When I execute dnf with args "install Package-preun-fail"
Then the exit code is 0
Expand All @@ -79,17 +78,16 @@ Scenario: Remove a pkg with a failing %preun scriptlet
| install | Package-preun-fail-0:1.0-1.x86_64 |
When I execute dnf with args "remove Package-preun-fail"
Then the exit code is 1
And stderr contains "Error in PREUN scriptlet in rpm package Package-preun-fail"
And stderr contains "Error: Transaction failed"
And stderr contains ">>> Running pre-uninstall scriptlet: Package-preun-fail-0:1.0-1.x86_64"
And stderr contains ">>> Error in pre-uninstall scriptlet: Package-preun-fail-0:1.0-1.x86_64"
And stderr contains "Transaction failed: Rpm transaction failed."
When I execute dnf with args "--setopt=tsflags=noscripts remove Package-preun-fail"
Then the exit code is 0
And Transaction is following
| Action | Package |
| remove | Package-preun-fail-0:1.0-1.x86_64 |


# @dnf5
# TODO(nsella) different stderr
Scenario: Remove a pkg with a failing %postun scriptlet
When I execute dnf with args "install Package-postun-fail"
Then the exit code is 0
Expand All @@ -98,15 +96,14 @@ Scenario: Remove a pkg with a failing %postun scriptlet
| install | Package-postun-fail-0:1.0-1.x86_64 |
When I execute dnf with args "remove Package-postun-fail"
Then the exit code is 0
And stderr contains "Error in POSTUN scriptlet in rpm package Package-postun-fail"
And stderr contains ">>> Running post-uninstall scriptlet: Package-postun-fail-0:1.0-1.x86_64"
And stderr contains ">>> Non-critical error in post-uninstall scriptlet: Package-postun-fail-0:1.0-1.x86_64"
And stderr contains "Complete!"
And Transaction is following
| Action | Package |
| remove | Package-postun-fail-0:1.0-1.x86_64 |


# The patch for printing correct pacakges whose the running scriptlet is had to be reverted because it broke DNF API.
# The fix is delayed to DNF5 because is will use C rpm API instead of the Python one
@xfail
@bz1724779
Scenario: Output for triggered successful scriptlet of a package not present in transaction has temporarily just pkg name
Given I successfully execute dnf with args "install Package-triggerin-ok"
Expand All @@ -117,54 +114,35 @@ Scenario: Output for triggered successful scriptlet of a package not present in
| install | Package-install-file-0:1.0-1.x86_64 |
And stdout contains "triggerin scriptlet \(Package-triggerin-ok\) for Package-install-file install/update successfully done"
And stdout does not contain "Running scriptlet\s*:\s*Package-install-file"
And stdout contains "Running scriptlet\s*:\s*Package-triggerin-ok-1.0-1.x86_64"


@xfail
@bz1724779
Scenario: Correct output for triggered failed scriptlet of package not present in transaction
Given I successfully execute dnf with args "install Package-triggerin-fail"
When I execute dnf with args "install Package-install-file"
Then the exit code is 0
And stdout contains "failing on triggerin scriptlet"
And stdout contains "Running scriptlet\s*:\s*Package-triggerin-fail-1.0-1.x86_64"
And stdout does not contain "Running scriptlet\s*:\s*Package-install-file"
# There is an RPM problem, where it doesn't export internal tag for %triggerin, therefore DNF prints <unknown> instead
# And stderr is
# """
# Error in %triggerin scriptlet in rpm package Package-triggerin-fail triggered by rpm package Package-install-file-1.0-1.x86_64
# """
And stderr is
"""
Error in <unknown> scriptlet in rpm package Package-triggerin-fail triggered by rpm package Package-install-file-1.0-1.x86_64
"""


@xfail
And stderr contains "failing on triggerin scriptlet"
And stderr contains ">>> Running trigger-install scriptlet: Package-triggerin-fail-0:1.0-1.x86_64"
And stderr contains ">>> Non-critical error in trigger-install scriptlet: Package-triggerin-fail-0:1.0-1.x86_64"
And stderr does not contain "scriptlet: Package-install-file"


@bz1724779
Scenario: Correct output for triggered failing transfiletriggerpostun scriptlet of package not present in transaction
Given I successfully execute dnf with args "install Package-transfiletriggerpostun-fail"
And I successfully execute dnf with args "install Package-install-file"
When I execute dnf with args "remove Package-install-file"
Then the exit code is 0
And Transaction is following
| Action | Package |
| Action | Package |
| remove | Package-install-file-0:1.0-1.x86_64 |
And stdout contains "transfiletriggerpostun scriptlet \(Package-transfiletriggerpostun-fail\) for uninstall transaction of Package-install-file is failing"
And stdout contains "Running scriptlet\s*:\s*Package-transfiletriggerpostun-fail-1.0-1.x86_64"
And stdout does not contain "Running scriptlet\s*:\s*Package-install-file"
#"""
#Error in %filetriggerin scriptlet in rpm package Package-transfiletriggerpostun-fail triggered by rpm package Package-install-file-1.0-1.x86_64
#"""
And stderr is
"""
Error in <unknown> scriptlet in rpm package Package-transfiletriggerpostun-fail triggered by rpm package Package-install-file-1.0-1.x86_64
"""
And stderr contains "transfiletriggerpostun scriptlet \(Package-transfiletriggerpostun-fail\) for uninstall transaction of Package-install-file is failing"
And stderr contains ">>> Running trigger-post-uninstall scriptlet: Package-transfiletriggerpostun-fail-0:1.0-1.x86_64"
And stderr contains ">>> Non-critical error in trigger-post-uninstall scriptlet: Package-transfiletriggerpostun-fail-0:1.0-1.x86_64"
And stderr does not contain "scriptlet: Package-install-file"


@bz1724779
# Another RPM problem where it provides wrong pkg in the callback for FILETRIGGERIN, should be fixed by https://github.com/rpm-software-management/rpm/pull/892
@xfail
Scenario: Correct output for triggered successful file scriptlet of package not present in transaction
Given I successfully execute dnf with args "install Package-filetriggerin-ok"
When I execute dnf with args "install Package-install-file"
Expand All @@ -173,38 +151,28 @@ Scenario: Correct output for triggered successful file scriptlet of package not
| Action | Package |
| install | Package-install-file-0:1.0-1.x86_64 |
And stdout contains "filetriggerin scriptlet \(Package-filetriggerin-ok\) for Package-install-file install/update successfully done"
And stdout contains "Running scriptlet\s*:\s*Package-filetriggerin-ok-1.0-1.x86_64"
And stdout does not contain "Running scriptlet\s*:\s*Package-install-file"
And stdout does not contain "scriptlet: Package-install-file"


@bz1724779
@xfail
Scenario: Correct output for triggered failing file scriptlet of package not present in transaction
Given I successfully execute dnf with args "install Package-filetriggerin-fail"
When I execute dnf with args "install Package-install-file"
Then the exit code is 0
And stdout contains "filetriggerin scriptlet \(Package-filetriggerin-fail\) for Package-install-file install/update is failing"
And stdout contains "Running scriptlet\s*:\s*Package-filetriggerin-fail-1.0-1.x86_64"
And stdout does not contain "Running scriptlet\s*:\s*Package-install-file"
#"""
#Error in %filetriggerin scriptlet in rpm package Package-transfiletriggerpostun-fail triggered by rpm package Package-install-file-1.0-1.x86_64
#"""
And stderr is
"""
Error in <unknown> scriptlet in rpm package Package-filetriggerin-fail triggered by rpm package Package-install-file-1.0-1.x86_64
"""
And stderr contains "filetriggerin scriptlet \(Package-filetriggerin-fail\) for Package-install-file install/update is failing"
And stderr contains ">>> Running trigger-install scriptlet: Package-filetriggerin-fail-0:1.0-1.x86_64"
And stderr contains ">>> Non-critical error in trigger-install scriptlet: Package-filetriggerin-fail-0:1.0-1.x86_64"
And stderr does not contain "scriptlet: Package-install-file"


@xfail
@bz1724779
Scenario: Correct output for triggered successful transfiletriggerpostun scriptlet of package not present in transaction
Given I successfully execute dnf with args "install Package-transfiletriggerpostun-ok"
And I successfully execute dnf with args "install Package-install-file"
When I execute dnf with args "remove Package-install-file"
Then the exit code is 0
And Transaction is following
| Action | Package |
| Action | Package |
| remove | Package-install-file-0:1.0-1.x86_64 |
And stdout contains "transfiletriggerpostun scriptlet \(Package-transfiletriggerpostun-ok\) for Package-install-file transaction uninstall successfully done"
And stdout contains "Running scriptlet\s*:\s*Package-transfiletriggerpostun-ok-1.0-1.x86_64"
And stdout does not contain "Running scriptlet\s*:\s*Package-install-file"
And stderr does not contain "scriptlet: Package-install-file"
10 changes: 2 additions & 8 deletions dnf-behave-tests/dnf/shell-distro-sync.feature
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# missing shell command: https://github.com/rpm-software-management/dnf5/issues/153
@xfail
Feature: Shell distro-sync


Expand All @@ -17,8 +19,6 @@ Background: Install glibc, flac, and CQRlib
| install-dep | glibc-all-langpacks-0:2.28-9.fc29.x86_64 |


# @dnf5
# TODO(nsella) Unknown argument "shell" for command "microdnf"
Scenario: Using dnf shell, make distro-sync for an RPM
Given I use repository "dnf-ci-fedora-updates"
When I open dnf shell session
Expand All @@ -33,8 +33,6 @@ Scenario: Using dnf shell, make distro-sync for an RPM
Then stdout contains "Leaving Shell"


# @dnf5
# TODO(nsella) Unknown argument "shell" for command "microdnf"
Scenario: Using dnf shell, make distro-sync for mutiple RPMs
Given I use repository "dnf-ci-fedora-updates"
When I open dnf shell session
Expand All @@ -48,8 +46,6 @@ Scenario: Using dnf shell, make distro-sync for mutiple RPMs
Then stdout contains "Leaving Shell"


# @dnf5
# TODO(nsella) Unknown argument "shell" for command "microdnf"
Scenario: Using dnf shell, fail to make distro-sync when no upgrade is available
Given I use repository "dnf-ci-fedora-updates"
And I use repository "dnf-ci-fedora-updates-testing"
Expand All @@ -62,8 +58,6 @@ Scenario: Using dnf shell, fail to make distro-sync when no upgrade is available
Then stdout contains "Leaving Shell"


# @dnf5
# TODO(nsella) Unknown argument "shell" for command "microdnf"
Scenario: Using dnf shell, fail to make distro-sync for non-existent RPM
Given I use repository "dnf-ci-fedora-updates-testing"
When I open dnf shell session
Expand Down
10 changes: 2 additions & 8 deletions dnf-behave-tests/dnf/shell-downgrade.feature
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# missing shell command: https://github.com/rpm-software-management/dnf5/issues/153
@xfail
Feature: Shell downgrade


Expand All @@ -17,8 +19,6 @@ Background: Install glibc and flac
| install-dep | glibc-all-langpacks-0:2.28-26.fc29.x86_64 |


# @dnf5
# TODO(nsella) Unknown argument "shell" for command "microdnf"
Scenario: Using dnf shell, downgrade an RPM
When I open dnf shell session
And I execute in dnf shell "downgrade glibc"
Expand All @@ -32,8 +32,6 @@ Scenario: Using dnf shell, downgrade an RPM
Then stdout contains "Leaving Shell"


# @dnf5
# TODO(nsella) Unknown argument "shell" for command "microdnf"
Scenario: Downgrade multiple RPMs
When I open dnf shell session
And I execute in dnf shell "downgrade glibc flac"
Expand All @@ -48,8 +46,6 @@ Scenario: Downgrade multiple RPMs
Then stdout contains "Leaving Shell"


# @dnf5
# TODO(nsella) Unknown argument "shell" for command "microdnf"
Scenario: Using dnf shell, fail to downgrade an RPM of the lowest version
When I open dnf shell session
And I execute in dnf shell "downgrade setup"
Expand All @@ -62,8 +58,6 @@ Scenario: Using dnf shell, fail to downgrade an RPM of the lowest version
Then stdout contains "Leaving Shell"


# @dnf5
# TODO(nsella) Unknown argument "shell" for command "microdnf"
Scenario: Using dnf shell, fail to downgrade non-existent RPM
When I open dnf shell session
And I execute in dnf shell "downgrade non-existent"
Expand Down
6 changes: 2 additions & 4 deletions dnf-behave-tests/dnf/shell-from-file.feature
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# missing shell command: https://github.com/rpm-software-management/dnf5/issues/153
@xfail
Feature: Execute dnf shell commands from file


Expand All @@ -10,8 +12,6 @@ Background:
| key | value |
| enabled | 0 |

# @dnf5
# TODO(nsella) Unknown argument "shell" for command "microdnf"
Scenario: Execute dnf shell with file as argument
When I execute dnf with args "shell {context.dnf.fixturesdir}/scripts/shell-commands"
Then the exit code is 0
Expand All @@ -20,8 +20,6 @@ Scenario: Execute dnf shell with file as argument
| install | flac-0:1.3.2-8.fc29.x86_64 |


# @dnf5
# TODO(nsella) Unknown argument "shell" for command "microdnf"
Scenario: Execute dnf shell with file on input
When I execute dnf with args "shell < {context.dnf.fixturesdir}/scripts/shell-commands"
Then the exit code is 0
Expand Down
10 changes: 2 additions & 8 deletions dnf-behave-tests/dnf/shell-group.feature
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# missing shell command: https://github.com/rpm-software-management/dnf5/issues/153
@xfail
Feature: Shell group


Expand All @@ -15,8 +17,6 @@ Feature: Shell group
# conditional: wget, requires filesystem-content


# @dnf5
# TODO(nsella) Unknown argument "shell" for command "microdnf"
Scenario: Using dnf shell, install a package group
Given I use repository "dnf-ci-fedora"
And I use repository "dnf-ci-thirdparty"
Expand All @@ -34,8 +34,6 @@ Scenario: Using dnf shell, install a package group
Then stdout contains "Leaving Shell"


# @dnf5
# TODO(nsella) Unknown argument "shell" for command "microdnf"
Scenario Outline: Using dnf shell, upgrade a package group using alias <upgrade alias>
Given I use repository "dnf-ci-fedora"
And I use repository "dnf-ci-thirdparty"
Expand Down Expand Up @@ -105,8 +103,6 @@ Scenario: Using dnf shell, remove a package group
Then stdout contains "Leaving Shell"


# @dnf5
# TODO(nsella) Unknown argument "shell" for command "microdnf"
Scenario: Using dnf shell, fail to install a non-existent package group
Given I use repository "dnf-ci-fedora"
When I open dnf shell session
Expand All @@ -118,8 +114,6 @@ Scenario: Using dnf shell, fail to install a non-existent package group
Then stdout contains "Leaving Shell"


# @dnf5
# TODO(nsella) Unknown argument "shell" for command "microdnf"
Scenario: Using dnf shell, fail to remove a non-existent package group
Given I use repository "dnf-ci-fedora"
When I open dnf shell session
Expand Down
2 changes: 2 additions & 0 deletions dnf-behave-tests/dnf/shell-help.feature
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# missing shell command: https://github.com/rpm-software-management/dnf5/issues/153
@xfail
Feature: Shell help


Expand Down
Loading
Loading