Mercurial > hg > nginx-tests
diff mail_imap_ssl.t @ 952:e9064d691790
Tests: converted tests to run in parallel.
author | Andrey Zelenkov <zelenkov@nginx.com> |
---|---|
date | Tue, 21 Jun 2016 16:39:13 +0300 |
parents | f4189a38c3a4 |
children | c227348453db |
line wrap: on
line diff
--- a/mail_imap_ssl.t +++ b/mail_imap_ssl.t @@ -35,7 +35,7 @@ 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)->plan(12); + ->run_daemon(\&Test::Nginx::IMAP::imap_test_daemon, port(6))->plan(12); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -48,19 +48,19 @@ events { mail { proxy_pass_error_message on; - auth_http http://127.0.0.1:8080/mail/auth; + auth_http http://127.0.0.1:%%PORT_0%%/mail/auth; auth_http_pass_client_cert on; ssl_certificate_key 1.example.com.key; ssl_certificate 1.example.com.crt; server { - listen 127.0.0.1:8142; + listen 127.0.0.1:%%PORT_1%%; protocol imap; } server { - listen 127.0.0.1:8143 ssl; + listen 127.0.0.1:%%PORT_2%% ssl; protocol imap; ssl_verify_client on; @@ -68,7 +68,7 @@ mail { } server { - listen 127.0.0.1:8145 ssl; + listen 127.0.0.1:%%PORT_3%% ssl; protocol imap; ssl_verify_client optional; @@ -76,7 +76,7 @@ mail { } server { - listen 127.0.0.1:8146 ssl; + listen 127.0.0.1:%%PORT_4%% ssl; protocol imap; ssl_verify_client optional; @@ -85,7 +85,7 @@ mail { } server { - listen 127.0.0.1:8147 ssl; + listen 127.0.0.1:%%PORT_5%% ssl; protocol imap; ssl_verify_client optional_no_ca; @@ -102,7 +102,7 @@ http { '$http_auth_ssl_cert:$http_auth_pass'; server { - listen 127.0.0.1:8080; + listen 127.0.0.1:%%PORT_0%%; server_name localhost; location = /mail/auth { @@ -110,7 +110,7 @@ http { add_header Auth-Status OK; add_header Auth-Server 127.0.0.1; - add_header Auth-Port 8144; + add_header Auth-Port %%PORT_6%%; add_header Auth-Wait 1; return 204; } @@ -150,25 +150,25 @@ my %ssl = ( # no ssl connection -my $s = Test::Nginx::IMAP->new(PeerAddr => '127.0.0.1:8142'); +my $s = Test::Nginx::IMAP->new(PeerAddr => '127.0.0.1:' . port(1)); $s->ok('plain connection'); $s->send('1 AUTHENTICATE PLAIN ' . $cred->("s1")); # no cert -$s = Test::Nginx::IMAP->new(PeerAddr => '127.0.0.1:8143', %ssl); +$s = Test::Nginx::IMAP->new(PeerAddr => '127.0.0.1:' . port(2), %ssl); $s->check(qr/BYE No required SSL certificate/, 'no cert'); # no cert with ssl_verify_client optional -$s = Test::Nginx::IMAP->new(PeerAddr => '127.0.0.1:8145', %ssl); +$s = Test::Nginx::IMAP->new(PeerAddr => '127.0.0.1:' . port(3), %ssl); $s->ok('no optional cert'); $s->send('1 AUTHENTICATE PLAIN ' . $cred->("s2")); # wrong cert with ssl_verify_client optional $s = Test::Nginx::IMAP->new( - PeerAddr => '127.0.0.1:8145', + PeerAddr => '127.0.0.1:' . port(3), SSL_cert_file => "$d/1.example.com.crt", SSL_key_file => "$d/1.example.com.key", %ssl, @@ -178,7 +178,7 @@ my $s = Test::Nginx::IMAP->new(PeerAddr # wrong cert with ssl_verify_client optional_no_ca $s = Test::Nginx::IMAP->new( - PeerAddr => '127.0.0.1:8147', + PeerAddr => '127.0.0.1:' . port(5), SSL_cert_file => "$d/1.example.com.crt", SSL_key_file => "$d/1.example.com.key", %ssl, @@ -189,7 +189,7 @@ my $s = Test::Nginx::IMAP->new(PeerAddr # matching cert with ssl_verify_client optional $s = Test::Nginx::IMAP->new( - PeerAddr => '127.0.0.1:8145', + PeerAddr => '127.0.0.1:' . port(3), SSL_cert_file => "$d/2.example.com.crt", SSL_key_file => "$d/2.example.com.key", %ssl, @@ -200,7 +200,7 @@ my $s = Test::Nginx::IMAP->new(PeerAddr # trusted cert with ssl_verify_client optional $s = Test::Nginx::IMAP->new( - PeerAddr => '127.0.0.1:8146', + PeerAddr => '127.0.0.1:' . port(4), SSL_cert_file => "$d/3.example.com.crt", SSL_key_file => "$d/3.example.com.key", %ssl,