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