-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
automatic: Test errors reporting and emitting
- Loading branch information
1 parent
85ff62c
commit 67655a9
Showing
3 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
@dnf5 | ||
Feature: dnf-automatic reports an error when transaction failed | ||
|
||
|
||
Background: | ||
Given I use repository "dnf-ci-automatic-update" | ||
|
||
|
||
# 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 | ||
Scenario: dnf-automatic reports an error when package installation failed | ||
Given I successfully execute dnf with args "install test-1.0" | ||
When I execute dnf with args "automatic --installupdates" | ||
Then the exit code is 1 | ||
And RPMDB Transaction is empty | ||
And stdout contains "Failed to install upgrades." | ||
And stdout contains "Error in pre-install scriptlet" | ||
And stdout contains "Transaction failed: Rpm transaction failed." | ||
|
||
# https://github.com/rpm-software-management/dnf/issues/1918 | ||
# https://issues.redhat.com/browse/RHEL-61882 | ||
Scenario: emitters report errors by default | ||
Given I create and substitute file "/etc/dnf/automatic.conf" with | ||
""" | ||
[commands] | ||
download_updates = yes | ||
apply_updates = yes | ||
[emitters] | ||
emit_via = command_email | ||
[command_email] | ||
command_format = "echo {{body}} > {context.dnf.tempdir}/dnf_error" | ||
""" | ||
And I successfully execute dnf with args "install test-1.0" | ||
And file "/{context.dnf.tempdir}/dnf_error" does not exist | ||
When I execute dnf with args "automatic --installupdates" | ||
Then the exit code is 1 | ||
And RPMDB Transaction is empty | ||
And file "/{context.dnf.tempdir}/dnf_error" contains lines | ||
""" | ||
Transaction failed: Rpm transaction failed. | ||
""" |
16 changes: 16 additions & 0 deletions
16
dnf-behave-tests/fixtures/specs/dnf-ci-automatic-update/test-1.0-1.spec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Name: test | ||
Epoch: 0 | ||
Version: 1.0 | ||
Release: 1 | ||
|
||
License: Public Domain | ||
URL: None | ||
|
||
Summary: The made up package for dnf-automatic updates testing. | ||
|
||
%description | ||
Installs correctly. | ||
|
||
%files | ||
|
||
%changelog |
19 changes: 19 additions & 0 deletions
19
dnf-behave-tests/fixtures/specs/dnf-ci-automatic-update/test-1.1-1.spec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Name: test | ||
Epoch: 0 | ||
Version: 1.1 | ||
Release: 1 | ||
|
||
License: Public Domain | ||
URL: None | ||
|
||
Summary: The made up package for dnf-automatic updates testing. | ||
|
||
%description | ||
Fails on pre scriptlet. | ||
|
||
%pre -p <lua> | ||
error("failing on pre scriptlet", 1) | ||
|
||
%files | ||
|
||
%changelog |