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

Test that dnf-automatic emitters send error messages #1603

Merged
merged 1 commit into from
Dec 9, 2024
Merged
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
30 changes: 29 additions & 1 deletion dnf-behave-tests/dnf/dnf-automatic/error-report.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Given I delete file "/etc/yum.repos.d/*.repo" with globs
"""


# First, install the "test-1.0" package, which should proceed successfully.
# First, install the "test-1.0" package, which should proceed successfully.
# Then, attempt to update to "test-1.1", which contains a broken scriptlet.
# An error should be reported during the installation of the update.
@bz2170093
Expand All @@ -30,3 +30,31 @@ Scenario: dnf-automatic reports an error when package installation failed
Error in PREIN scriptlet in rpm package test
Error: Transaction failed
"""

# https://github.com/rpm-software-management/dnf/issues/1918
# https://issues.redhat.com/browse/RHEL-61882
Scenario: emitters can report errors if configured by send_error_messages = yes
Given I use repository "dnf-ci-automatic-update"
And I create file "/etc/dnf/automatic.conf" with
"""
[commands]
download_updates = yes
apply_updates = yes

[emitters]
send_error_messages = yes
emit_via = command_email

[command_email]
command_format = "echo {body} > /tmp/dnf_error"
"""
And I successfully execute dnf with args "install test-1.0"
And file "/tmp/dnf_error" does not exist
When I execute dnf-automatic with args "--installupdates"
Then the exit code is 1
And Transaction is empty
And file "/tmp/dnf_error" matches line by line
"""
An error has occured on: .*
Error: Transaction failed
"""
Loading