comparison mail_resolver.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 196d33c2bb45
comparison
equal deleted inserted replaced
975:e17ffab3febc 976:a8b8dd6e8ae1
23 select STDERR; $| = 1; 23 select STDERR; $| = 1;
24 select STDOUT; $| = 1; 24 select STDOUT; $| = 1;
25 25
26 local $SIG{PIPE} = 'IGNORE'; 26 local $SIG{PIPE} = 'IGNORE';
27 27
28 my $t = Test::Nginx->new()->has(qw/mail smtp http rewrite/) 28 my $t = Test::Nginx->new()->has(qw/mail smtp http rewrite/)->plan(8)
29 ->run_daemon(\&Test::Nginx::SMTP::smtp_test_daemon, port(8026)); 29 ->write_file_expand('nginx.conf', <<'EOF');
30
31 $t->write_file_expand('nginx.conf', <<'EOF');
32 30
33 %%TEST_GLOBALS%% 31 %%TEST_GLOBALS%%
34 32
35 daemon off; 33 daemon off;
36 34
114 } 112 }
115 } 113 }
116 114
117 EOF 115 EOF
118 116
119 for (8081 .. 8087) { 117 $t->run_daemon(\&Test::Nginx::SMTP::smtp_test_daemon);
120 $t->run_daemon(\&dns_daemon, port($_), $t); 118 $t->run_daemon(\&dns_daemon, port($_), $t) foreach (8081 .. 8087);
121 } 119
122 $t->run(); 120 $t->run();
123 121
124 for (8081 .. 8087) { 122 $t->waitforsocket('127.0.0.1:' . port(8026));
125 $t->waitforfile($t->testdir . '/' . port($_)); 123 $t->waitforfile($t->testdir . '/' . port($_)) foreach (8081 .. 8087);
126 }
127
128 $t->plan(8);
129 124
130 ############################################################################### 125 ###############################################################################
131 126
132 # PTR 127 # PTR
133 128