~ruther/guix-local

6aded64869207aa7402e5c301fbe7086ceb8e631 — Mathieu Othacehe 5 months ago cdcfa59
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
1 files changed, 18 insertions(+), 4 deletions(-)

M gnu/tests/mail.scm
M gnu/tests/mail.scm => gnu/tests/mail.scm +18 -4
@@ 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