Mercurial > hg > nginx-tests
comparison mail_error_log.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 |
---|---|
25 select STDERR; $| = 1; | 25 select STDERR; $| = 1; |
26 select STDOUT; $| = 1; | 26 select STDOUT; $| = 1; |
27 | 27 |
28 plan(skip_all => 'win32') if $^O eq 'MSWin32'; | 28 plan(skip_all => 'win32') if $^O eq 'MSWin32'; |
29 | 29 |
30 my $t = Test::Nginx->new()->has(qw/mail imap http rewrite/) | 30 my $t = Test::Nginx->new()->has(qw/mail imap http rewrite/); |
31 ->run_daemon(\&Test::Nginx::IMAP::imap_test_daemon, port(8144)); | |
32 | 31 |
33 plan(skip_all => 'no error_log') unless $t->has_version('1.9.0'); | 32 plan(skip_all => 'no error_log') unless $t->has_version('1.9.0'); |
34 | 33 |
35 $t->plan(30)->write_file_expand('nginx.conf', <<'EOF'); | 34 $t->plan(30)->write_file_expand('nginx.conf', <<'EOF'); |
36 | 35 |
88 open OLDERR, ">&", \*STDERR; | 87 open OLDERR, ">&", \*STDERR; |
89 open STDERR, '>', $t->testdir() . '/stderr' or die "Can't reopen STDERR: $!"; | 88 open STDERR, '>', $t->testdir() . '/stderr' or die "Can't reopen STDERR: $!"; |
90 open my $stderr, '<', $t->testdir() . '/stderr' | 89 open my $stderr, '<', $t->testdir() . '/stderr' |
91 or die "Can't open stderr file: $!"; | 90 or die "Can't open stderr file: $!"; |
92 | 91 |
92 $t->run_daemon(\&Test::Nginx::IMAP::imap_test_daemon); | |
93 $t->run_daemon(\&syslog_daemon, port(8081), $t, 's_glob.log'); | 93 $t->run_daemon(\&syslog_daemon, port(8081), $t, 's_glob.log'); |
94 $t->run_daemon(\&syslog_daemon, port(8082), $t, 's_info.log'); | 94 $t->run_daemon(\&syslog_daemon, port(8082), $t, 's_info.log'); |
95 | 95 |
96 $t->waitforsocket('127.0.0.1:' . port(8144)); | |
96 $t->waitforfile($t->testdir . '/s_glob.log'); | 97 $t->waitforfile($t->testdir . '/s_glob.log'); |
97 $t->waitforfile($t->testdir . '/s_info.log'); | 98 $t->waitforfile($t->testdir . '/s_info.log'); |
98 | 99 |
99 $t->run(); | 100 $t->run(); |
100 | 101 |