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:
parent
318c9296fa
commit
f70dc57ad3
@ -102,11 +102,17 @@ import ./make-test.nix {
|
|||||||
testScript = ''
|
testScript = ''
|
||||||
startAll;
|
startAll;
|
||||||
|
|
||||||
$client->waitForUnit("network.target");
|
$client->waitForUnit("network-online.target");
|
||||||
$smtp1->waitForUnit('opensmtpd');
|
$smtp1->waitForUnit('opensmtpd');
|
||||||
$smtp2->waitForUnit('opensmtpd');
|
$smtp2->waitForUnit('opensmtpd');
|
||||||
$smtp2->waitForUnit('dovecot2');
|
$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');
|
$client->succeed('send-a-test-mail');
|
||||||
$smtp1->waitUntilFails('smtpctl show queue | egrep .');
|
$smtp1->waitUntilFails('smtpctl show queue | egrep .');
|
||||||
$smtp2->waitUntilFails('smtpctl show queue | egrep .');
|
$smtp2->waitUntilFails('smtpctl show queue | egrep .');
|
||||||
|
Loading…
Reference in New Issue
Block a user