diff mail_imap_ssl.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 1b11a12be179
line wrap: on
line diff
--- a/mail_imap_ssl.t
+++ b/mail_imap_ssl.t
@@ -33,12 +33,9 @@ plan(skip_all => 'IO::Socket::SSL too ol
 
 local $SIG{PIPE} = 'IGNORE';
 
-my $t = Test::Nginx->new()
-	->has(qw/mail mail_ssl imap http rewrite/)->has_daemon('openssl')
-	->run_daemon(\&Test::Nginx::IMAP::imap_test_daemon, port(8144))
-	->plan(12);
-
-$t->write_file_expand('nginx.conf', <<'EOF');
+my $t = Test::Nginx->new()->has(qw/mail mail_ssl imap http rewrite/)
+	->has_daemon('openssl')->plan(12)
+	->write_file_expand('nginx.conf', <<'EOF');
 
 %%TEST_GLOBALS%%
 
@@ -138,7 +135,8 @@ foreach my $name ('1.example.com', '2.ex
 		or die "Can't create certificate for $name: $!\n";
 }
 
-$t->run();
+$t->run_daemon(\&Test::Nginx::IMAP::imap_test_daemon);
+$t->run()->waitforsocket('127.0.0.1:' . port(8144));
 
 ###############################################################################