diff mail_smtp.t @ 976:a8b8dd6e8ae1

Tests: changed startup order in mail tests for consistency. Notably, run_daemon() is postponed until after write_file_expand(). Also added waitforsocket() to avoid startup race.
author Andrey Zelenkov <zelenkov@nginx.com>
date Tue, 12 Jul 2016 20:51:06 +0300
parents c227348453db
children 59d5c8ca7e4d
line wrap: on
line diff
--- a/mail_smtp.t
+++ b/mail_smtp.t
@@ -27,10 +27,8 @@ select STDOUT; $| = 1;
 
 local $SIG{PIPE} = 'IGNORE';
 
-my $t = Test::Nginx->new()
-	->has(qw/mail smtp http rewrite/)->plan(25)
-	->run_daemon(\&Test::Nginx::SMTP::smtp_test_daemon, port(8026))
-	->write_file_expand('nginx.conf', <<'EOF')->run();
+my $t = Test::Nginx->new()->has(qw/mail smtp http rewrite/)->plan(25)
+	->write_file_expand('nginx.conf', <<'EOF');
 
 %%TEST_GLOBALS%%
 
@@ -81,6 +79,9 @@ http {
 
 EOF
 
+$t->run_daemon(\&Test::Nginx::SMTP::smtp_test_daemon);
+$t->run()->waitforsocket('127.0.0.1:' . port(8026));
+
 ###############################################################################
 
 my $s = Test::Nginx::SMTP->new();