comparison 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
comparison
equal deleted inserted replaced
975:e17ffab3febc 976:a8b8dd6e8ae1
24 select STDERR; $| = 1; 24 select STDERR; $| = 1;
25 select STDOUT; $| = 1; 25 select STDOUT; $| = 1;
26 26
27 local $SIG{PIPE} = 'IGNORE'; 27 local $SIG{PIPE} = 'IGNORE';
28 28
29 my $t = Test::Nginx->new() 29 my $t = Test::Nginx->new()->has(qw/mail pop3 http rewrite/)->plan(8)
30 ->has(qw/mail pop3 http rewrite/)->plan(8) 30 ->write_file_expand('nginx.conf', <<'EOF');
31 ->run_daemon(\&Test::Nginx::POP3::pop3_test_daemon, port(8111))
32 ->write_file_expand('nginx.conf', <<'EOF')->run();
33 31
34 %%TEST_GLOBALS%% 32 %%TEST_GLOBALS%%
35 33
36 daemon off; 34 daemon off;
37 35
76 } 74 }
77 } 75 }
78 76
79 EOF 77 EOF
80 78
79 $t->run_daemon(\&Test::Nginx::POP3::pop3_test_daemon);
80 $t->run()->waitforsocket('127.0.0.1:' . port(8111));
81
81 ############################################################################### 82 ###############################################################################
82 83
83 my $s = Test::Nginx::POP3->new(); 84 my $s = Test::Nginx::POP3->new();
84 $s->ok('greeting'); 85 $s->ok('greeting');
85 86