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.
This commit is contained in:
xeji 2018-09-05 22:36:17 +02:00 committed by GitHub
parent 318c9296fa
commit f70dc57ad3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 .');