From b71da772cb4222f17a21d2332c4511db3a327826 Mon Sep 17 00:00:00 2001 From: Evan Goode Date: Fri, 20 Dec 2024 22:31:23 +0000 Subject: [PATCH] automatic: Test command_format variable expansion Requires https://github.com/rpm-software-management/dnf5/pull/1972. For https://github.com/rpm-software-management/dnf5/issues/1951. --- .../dnf/dnf-automatic/error-report.feature | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/dnf-behave-tests/dnf/dnf-automatic/error-report.feature b/dnf-behave-tests/dnf/dnf-automatic/error-report.feature index 2f038b963..c969093f0 100644 --- a/dnf-behave-tests/dnf/dnf-automatic/error-report.feature +++ b/dnf-behave-tests/dnf/dnf-automatic/error-report.feature @@ -32,14 +32,38 @@ Scenario: emitters report errors by default emit_via = command_email [command_email] - command_format = "echo {{body}} > {context.dnf.tempdir}/dnf_error" + command_format = "echo {{body}} > {context.dnf.tempdir}/dnf_command_email_error" """ And I successfully execute dnf with args "install test-1.0" - And file "/{context.dnf.tempdir}/dnf_error" does not exist + And file "/{context.dnf.tempdir}/dnf_command_email_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 + And file "/{context.dnf.tempdir}/dnf_command_email_error" contains lines + """ + Transaction failed: Rpm transaction failed. + """ + +@gdb +Scenario: {body} substituted in command_format for command emitter + Given I create and substitute file "/etc/dnf/automatic.conf" with + """ + [commands] + download_updates = yes + apply_updates = yes + + [emitters] + emit_via = command + + [command] + command_format = "echo {{body}} > {context.dnf.tempdir}/dnf_command_error" + """ + And I successfully execute dnf with args "install test-1.0" + And file "/{context.dnf.tempdir}/dnf_command_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_command_error" contains lines """ Transaction failed: Rpm transaction failed. """