Mercurial > hg > nginx-tests
comparison mail_smtp.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 |
---|---|
25 select STDERR; $| = 1; | 25 select STDERR; $| = 1; |
26 select STDOUT; $| = 1; | 26 select STDOUT; $| = 1; |
27 | 27 |
28 local $SIG{PIPE} = 'IGNORE'; | 28 local $SIG{PIPE} = 'IGNORE'; |
29 | 29 |
30 my $t = Test::Nginx->new() | 30 my $t = Test::Nginx->new()->has(qw/mail smtp http rewrite/)->plan(25) |
31 ->has(qw/mail smtp http rewrite/)->plan(25) | 31 ->write_file_expand('nginx.conf', <<'EOF'); |
32 ->run_daemon(\&Test::Nginx::SMTP::smtp_test_daemon, port(8026)) | |
33 ->write_file_expand('nginx.conf', <<'EOF')->run(); | |
34 | 32 |
35 %%TEST_GLOBALS%% | 33 %%TEST_GLOBALS%% |
36 | 34 |
37 daemon off; | 35 daemon off; |
38 | 36 |
79 } | 77 } |
80 } | 78 } |
81 | 79 |
82 EOF | 80 EOF |
83 | 81 |
82 $t->run_daemon(\&Test::Nginx::SMTP::smtp_test_daemon); | |
83 $t->run()->waitforsocket('127.0.0.1:' . port(8026)); | |
84 | |
84 ############################################################################### | 85 ############################################################################### |
85 | 86 |
86 my $s = Test::Nginx::SMTP->new(); | 87 my $s = Test::Nginx::SMTP->new(); |
87 $s->check(qr/^220 /, "greeting"); | 88 $s->check(qr/^220 /, "greeting"); |
88 | 89 |