From 6aded64869207aa7402e5c301fbe7086ceb8e631 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Fri, 7 Nov 2025 18:29:16 +0100 Subject: [PATCH] gnu: tests: Fix opensmtpd. The test has two issues: - it uses /var/spool/mail instead of /var/mail - the client often takes more than 30 seconds to connect to the smtpd server, because the server tries to perform name resolution on 10.0.2.3 * gnu/tests/mail.scm (%qemu-static-networking-no-nameserver): New variable. (%opensmtpd-os): Use it instead of the dhcpcd-service-type service. (run-opensmtpd-test): Use /var/mail instead of /var/spool/mail. Fixes: guix/guix#3978 Change-Id: I429edbf2460f380f8a617ee1fccd145f34a1f3d6 --- gnu/tests/mail.scm | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/gnu/tests/mail.scm b/gnu/tests/mail.scm index 389bb4b1569bf49a4ceb5fff1b993aabf6aabe4f..ff9c3a690c12c061c13028c61a40e3d650c03344 100644 --- a/gnu/tests/mail.scm +++ b/gnu/tests/mail.scm @@ -44,9 +44,23 @@ %test-getmail %test-rspamd)) +(define %qemu-static-networking-no-nameserver + ;; Networking configuration for QEMU without nameserver. + (static-networking + (addresses (list (network-address + (device "eth0") + (value "10.0.2.15/24")))) + (routes (list (network-route + (destination "default") + (gateway "10.0.2.2")))) + (requirement '()) + (provision '(networking)) + (name-servers '()))) + (define %opensmtpd-os (simple-operating-system - (service dhcpcd-service-type) + (service static-networking-service-type + (list %qemu-static-networking-no-nameserver)) (service opensmtpd-service-type (opensmtpd-configuration (config-file @@ -99,8 +113,8 @@ match from any for local action inbound (test-assert "mbox is empty" (marionette-eval - '(and (file-exists? "/var/spool/mail") - (not (file-exists? "/var/spool/mail/root"))) + '(and (file-exists? "/var/mail") + (not (file-exists? "/var/mail/root"))) marionette)) (test-eq "accept an email" @@ -150,7 +164,7 @@ match from any for local action inbound (let wait ((n 20)) (cond ((queue-empty?) - (file-exists? "/var/spool/mail/root")) + (file-exists? "/var/mail/root")) ((zero? n) (error "root mailbox didn't show up")) (else