Mercurial > hg > nginx-tests
diff 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 | 97660514e518 |
children | 882267679006 |
line wrap: on
line diff
--- a/ssl.t Tue Jun 21 16:37:58 2016 +0300 +++ b/ssl.t Tue Jun 21 16:39:13 2016 +0300 @@ -48,8 +48,8 @@ ssl_session_tickets off; server { - listen 127.0.0.1:8443 ssl; - listen 127.0.0.1:8080; + listen 127.0.0.1:%%PORT_5%% ssl; + listen 127.0.0.1:%%PORT_0%%; server_name localhost; ssl_certificate_key inner.key; @@ -74,7 +74,7 @@ } server { - listen 127.0.0.1:8081; + listen 127.0.0.1:%%PORT_1%%; server_name localhost; # Special case for enabled "ssl" directive. @@ -89,7 +89,7 @@ } server { - listen 127.0.0.1:8082 ssl; + listen 127.0.0.1:%%PORT_2%% ssl; server_name localhost; ssl_session_cache builtin:1000; @@ -100,7 +100,7 @@ } server { - listen 127.0.0.1:8083 ssl; + listen 127.0.0.1:%%PORT_3%% ssl; server_name localhost; ssl_session_cache none; @@ -111,7 +111,7 @@ } server { - listen 127.0.0.1:8084 ssl; + listen 127.0.0.1:%%PORT_4%% ssl; server_name localhost; ssl_session_cache off; @@ -150,39 +150,39 @@ ############################################################################### -like(http_get('/reuse', socket => get_ssl_socket($ctx)), qr/^body \.$/m, - 'shared initial session'); -like(http_get('/reuse', socket => get_ssl_socket($ctx)), qr/^body r$/m, - 'shared session reused'); +like(http_get('/reuse', socket => get_ssl_socket($ctx, port(5))), + qr/^body \.$/m, 'shared initial session'); +like(http_get('/reuse', socket => get_ssl_socket($ctx, port(5))), + qr/^body r$/m, 'shared session reused'); -like(http_get('/', socket => get_ssl_socket($ctx, 8081)), qr/^body \.$/m, +like(http_get('/', socket => get_ssl_socket($ctx, port(1))), qr/^body \.$/m, 'builtin initial session'); -like(http_get('/', socket => get_ssl_socket($ctx, 8081)), qr/^body r$/m, +like(http_get('/', socket => get_ssl_socket($ctx, port(1))), qr/^body r$/m, 'builtin session reused'); -like(http_get('/', socket => get_ssl_socket($ctx, 8082)), qr/^body \.$/m, +like(http_get('/', socket => get_ssl_socket($ctx, port(2))), qr/^body \.$/m, 'builtin size initial session'); -like(http_get('/', socket => get_ssl_socket($ctx, 8082)), qr/^body r$/m, +like(http_get('/', socket => get_ssl_socket($ctx, port(2))), qr/^body r$/m, 'builtin size session reused'); -like(http_get('/', socket => get_ssl_socket($ctx, 8083)), qr/^body \.$/m, +like(http_get('/', socket => get_ssl_socket($ctx, port(3))), qr/^body \.$/m, 'reused none initial session'); -like(http_get('/', socket => get_ssl_socket($ctx, 8083)), qr/^body \.$/m, +like(http_get('/', socket => get_ssl_socket($ctx, port(3))), qr/^body \.$/m, 'session not reused 1'); -like(http_get('/', socket => get_ssl_socket($ctx, 8084)), qr/^body \.$/m, +like(http_get('/', socket => get_ssl_socket($ctx, port(4))), qr/^body \.$/m, 'reused off initial session'); -like(http_get('/', socket => get_ssl_socket($ctx, 8084)), qr/^body \.$/m, +like(http_get('/', socket => get_ssl_socket($ctx, port(4))), qr/^body \.$/m, 'session not reused 2'); # ssl certificate inheritance -my $s = get_ssl_socket($ctx, 8081); +my $s = get_ssl_socket($ctx, port(1)); like($s->dump_peer_certificate(), qr/CN=localhost/, 'CN'); $s->close(); -$s = get_ssl_socket($ctx); +$s = get_ssl_socket($ctx, port(5)); like($s->dump_peer_certificate(), qr/CN=inner/, 'CN inner'); $s->close(); @@ -191,23 +191,24 @@ select undef, undef, undef, 2.1; -like(http_get('/', socket => get_ssl_socket($ctx, 8081)), qr/^body \.$/m, +like(http_get('/', socket => get_ssl_socket($ctx, port(1))), qr/^body \.$/m, 'session timeout'); # embedded variables -my ($sid) = http_get('/id', socket => get_ssl_socket($ctx)) =~ /^body (\w+)$/m; +my ($sid) = http_get('/id', + socket => get_ssl_socket($ctx, port(5))) =~ /^body (\w+)$/m; is(length $sid, 64, 'session id'); unlike(http_get('/id'), qr/body \w/, 'session id no ssl'); -like(http_get('/cipher', socket => get_ssl_socket($ctx)), +like(http_get('/cipher', socket => get_ssl_socket($ctx, port(5))), qr/^body [\w-]+$/m, 'cipher'); -like(http_get('/client_verify', socket => get_ssl_socket($ctx)), +like(http_get('/client_verify', socket => get_ssl_socket($ctx, port(5))), qr/^body NONE$/m, 'client verify'); -like(http_get('/protocol', socket => get_ssl_socket($ctx)), +like(http_get('/protocol', socket => get_ssl_socket($ctx, port(5))), qr/^body (TLS|SSL)v(\d|\.)+$/m, 'protocol'); ############################################################################### @@ -223,7 +224,7 @@ $s = IO::Socket::SSL->new( Proto => 'tcp', PeerAddr => '127.0.0.1', - PeerPort => $port || '8443', + PeerPort => $port, SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE(), SSL_reuse_ctx => $ctx, SSL_error_trap => sub { die $_[1] }