Mercurial > hg > nginx-tests
comparison ssl_proxy_upgrade.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 | 6bb1f2ccd386 |
children | 882267679006 |
comparison
equal
deleted
inserted
replaced
951:9361c7eddfc1 | 952:e9064d691790 |
---|---|
49 | 49 |
50 log_format test "$bytes_sent $body_bytes_sent"; | 50 log_format test "$bytes_sent $body_bytes_sent"; |
51 access_log %%TESTDIR%%/cc.log test; | 51 access_log %%TESTDIR%%/cc.log test; |
52 | 52 |
53 server { | 53 server { |
54 listen 127.0.0.1:8080 ssl; | 54 listen 127.0.0.1:%%PORT_0%% ssl; |
55 server_name localhost; | 55 server_name localhost; |
56 | 56 |
57 ssl_certificate_key localhost.key; | 57 ssl_certificate_key localhost.key; |
58 ssl_certificate localhost.crt; | 58 ssl_certificate localhost.crt; |
59 | 59 |
60 location / { | 60 location / { |
61 proxy_pass http://127.0.0.1:8081; | 61 proxy_pass http://127.0.0.1:%%PORT_1%%; |
62 proxy_http_version 1.1; | 62 proxy_http_version 1.1; |
63 proxy_set_header Upgrade $http_upgrade; | 63 proxy_set_header Upgrade $http_upgrade; |
64 proxy_set_header Connection "Upgrade"; | 64 proxy_set_header Connection "Upgrade"; |
65 proxy_read_timeout 2s; | 65 proxy_read_timeout 2s; |
66 send_timeout 2s; | 66 send_timeout 2s; |
89 } | 89 } |
90 | 90 |
91 $t->run_daemon(\&upgrade_fake_daemon); | 91 $t->run_daemon(\&upgrade_fake_daemon); |
92 $t->run(); | 92 $t->run(); |
93 | 93 |
94 $t->waitforsocket('127.0.0.1:8081') | 94 $t->waitforsocket('127.0.0.1:' . port(1)) |
95 or die "Can't start test backend"; | 95 or die "Can't start test backend"; |
96 | 96 |
97 ############################################################################### | 97 ############################################################################### |
98 | 98 |
99 # establish connection | 99 # establish connection |
171 sub upgrade_connect { | 171 sub upgrade_connect { |
172 my (%opts) = @_; | 172 my (%opts) = @_; |
173 | 173 |
174 my $s = IO::Socket::SSL->new( | 174 my $s = IO::Socket::SSL->new( |
175 Proto => 'tcp', | 175 Proto => 'tcp', |
176 PeerAddr => '127.0.0.1:8080', | 176 PeerAddr => '127.0.0.1:' . port(0), |
177 SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE(), | 177 SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE(), |
178 ) | 178 ) |
179 or die "Can't connect to nginx: $!\n"; | 179 or die "Can't connect to nginx: $!\n"; |
180 | 180 |
181 # send request, $h->to_string | 181 # send request, $h->to_string |
281 ############################################################################### | 281 ############################################################################### |
282 | 282 |
283 sub upgrade_fake_daemon { | 283 sub upgrade_fake_daemon { |
284 my $server = IO::Socket::INET->new( | 284 my $server = IO::Socket::INET->new( |
285 Proto => 'tcp', | 285 Proto => 'tcp', |
286 LocalAddr => '127.0.0.1:8081', | 286 LocalAddr => '127.0.0.1:' . port(1), |
287 Listen => 5, | 287 Listen => 5, |
288 Reuse => 1 | 288 Reuse => 1 |
289 ) | 289 ) |
290 or die "Can't create listening socket: $!\n"; | 290 or die "Can't create listening socket: $!\n"; |
291 | 291 |