diff mail_pop3.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_pop3.t
+++ b/mail_pop3.t
@@ -26,10 +26,8 @@ select STDOUT; $| = 1;
 
 local $SIG{PIPE} = 'IGNORE';
 
-my $t = Test::Nginx->new()
-	->has(qw/mail pop3 http rewrite/)->plan(8)
-	->run_daemon(\&Test::Nginx::POP3::pop3_test_daemon, port(8111))
-	->write_file_expand('nginx.conf', <<'EOF')->run();
+my $t = Test::Nginx->new()->has(qw/mail pop3 http rewrite/)->plan(8)
+	->write_file_expand('nginx.conf', <<'EOF');
 
 %%TEST_GLOBALS%%
 
@@ -78,6 +76,9 @@ http {
 
 EOF
 
+$t->run_daemon(\&Test::Nginx::POP3::pop3_test_daemon);
+$t->run()->waitforsocket('127.0.0.1:' . port(8111));
+
 ###############################################################################
 
 my $s = Test::Nginx::POP3->new();