summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorxeji <36407913+xeji@users.noreply.github.com>2018-09-05 22:36:17 +0200
committerGitHub <noreply@github.com>2018-09-05 22:36:17 +0200
commitf70dc57ad3b63211cdc348bb3346139519aefced (patch)
tree0912231a99cda0073e7f55b7c81d6364604fbc72 /nixos/tests
parent318c9296faff4ed6eec0ec508c696c4dc9a6598c (diff)
downloadnixlib-f70dc57ad3b63211cdc348bb3346139519aefced.tar
nixlib-f70dc57ad3b63211cdc348bb3346139519aefced.tar.gz
nixlib-f70dc57ad3b63211cdc348bb3346139519aefced.tar.bz2
nixlib-f70dc57ad3b63211cdc348bb3346139519aefced.tar.lz
nixlib-f70dc57ad3b63211cdc348bb3346139519aefced.tar.xz
nixlib-f70dc57ad3b63211cdc348bb3346139519aefced.tar.zst
nixlib-f70dc57ad3b63211cdc348bb3346139519aefced.zip
nixos/tests/opensmtpd: prevent non-deterministic failure (#46071)
A sporadic failure occured on Hydra because a request was sent
to smtpd after the systemd unit was started, but before the daemon
was actually listening. Fix by checking for open ports first.
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/opensmtpd.nix8
1 files changed, 7 insertions, 1 deletions
diff --git a/nixos/tests/opensmtpd.nix b/nixos/tests/opensmtpd.nix
index 5079779f35b4..4c0cbca21010 100644
--- a/nixos/tests/opensmtpd.nix
+++ b/nixos/tests/opensmtpd.nix
@@ -102,11 +102,17 @@ import ./make-test.nix {
   testScript = ''
     startAll;
 
-    $client->waitForUnit("network.target");
+    $client->waitForUnit("network-online.target");
     $smtp1->waitForUnit('opensmtpd');
     $smtp2->waitForUnit('opensmtpd');
     $smtp2->waitForUnit('dovecot2');
 
+    # To prevent sporadic failures during daemon startup, make sure
+    # services are listening on their ports before sending requests
+    $smtp1->waitForOpenPort(25);
+    $smtp2->waitForOpenPort(25);
+    $smtp2->waitForOpenPort(143);
+
     $client->succeed('send-a-test-mail');
     $smtp1->waitUntilFails('smtpctl show queue | egrep .');
     $smtp2->waitUntilFails('smtpctl show queue | egrep .');