From 0313633f98bb945349151ad2ff1cf1ecd799c820 Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Tue, 19 May 2026 11:11:03 +0200 Subject: [PATCH] Installed smtp-sink in the valgrind check container cf-execd's MailResult connects to localhost:25 whenever a cf-agent run produces output. Without an SMTP listener it logs "error: Mail report: couldn't connect to host 'localhost'" which check_daemon_output then catches as a test failure (flaky depending on whether cf-agent completes a run within the test window). Install postfix in the container for smtp-sink and run it on 127.0.0.1:25 before the daemons start. cf-execd's mail code path now gets exercised under valgrind instead of silently aborted. Ticket: ENT-13720 Signed-off-by: Lars Erik Wik --- tests/valgrind-check/Containerfile | 2 +- tests/valgrind-check/valgrind.sh | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/valgrind-check/Containerfile b/tests/valgrind-check/Containerfile index 72cac93e16..131811ae1e 100644 --- a/tests/valgrind-check/Containerfile +++ b/tests/valgrind-check/Containerfile @@ -1,6 +1,6 @@ FROM ubuntu:24.04 AS build RUN DEBIAN_FRONTEND=noninteractive apt-get update -y --fix-missing && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y libssl-dev libxml2-dev libpam0g-dev liblmdb-dev libacl1-dev libpcre2-dev librsync-dev python3 git flex bison byacc automake make autoconf libtool valgrind curl + DEBIAN_FRONTEND=noninteractive apt-get install -y libssl-dev libxml2-dev libpam0g-dev liblmdb-dev libacl1-dev libpcre2-dev librsync-dev python3 git flex bison byacc automake make autoconf libtool valgrind curl postfix COPY masterfiles masterfiles COPY core core WORKDIR core diff --git a/tests/valgrind-check/valgrind.sh b/tests/valgrind-check/valgrind.sh index d39b2a4d74..ceaf18a5a3 100644 --- a/tests/valgrind-check/valgrind.sh +++ b/tests/valgrind-check/valgrind.sh @@ -85,6 +85,13 @@ set -x auto_destruct_pid=$! trap "kill $auto_destruct_pid" EXIT +# cf-execd's MailResult connects to localhost:25 whenever a cf-agent run +# produces output. Run smtp-sink (from the postfix package) so the connect +# succeeds and cf-execd's mail code path is exercised under valgrind without +# leaving an "error: Mail report: couldn't connect" line in execd_output.txt. +echo "Starting smtp-sink to absorb cf-execd mail reports" +/usr/sbin/smtp-sink 127.0.0.1:25 1000 & + # Assume we are in core directory if [ -f ./configure ] ; then ./configure -C --enable-debug