Mercurial > hg > nginx-tests
comparison stream_proxy_ssl_name.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 | f02dac68d584 |
children | 882267679006 |
comparison
equal
deleted
inserted
replaced
951:9361c7eddfc1 | 952:e9064d691790 |
---|---|
38 stream { | 38 stream { |
39 proxy_ssl on; | 39 proxy_ssl on; |
40 proxy_ssl_session_reuse off; | 40 proxy_ssl_session_reuse off; |
41 | 41 |
42 upstream u { | 42 upstream u { |
43 server 127.0.0.1:8086; | 43 server 127.0.0.1:%%PORT_5%%; |
44 } | 44 } |
45 | 45 |
46 server { | 46 server { |
47 listen 127.0.0.1:8080; | 47 listen 127.0.0.1:%%PORT_0%%; |
48 proxy_pass u; | 48 proxy_pass u; |
49 | 49 |
50 proxy_ssl_server_name off; | 50 proxy_ssl_server_name off; |
51 } | 51 } |
52 | 52 |
53 server { | 53 server { |
54 listen 127.0.0.1:8081; | 54 listen 127.0.0.1:%%PORT_1%%; |
55 proxy_pass u; | 55 proxy_pass u; |
56 | 56 |
57 proxy_ssl_server_name on; | 57 proxy_ssl_server_name on; |
58 } | 58 } |
59 | 59 |
60 server { | 60 server { |
61 listen 127.0.0.1:8082; | 61 listen 127.0.0.1:%%PORT_2%%; |
62 proxy_pass 127.0.0.1:8086; | 62 proxy_pass 127.0.0.1:%%PORT_5%%; |
63 | 63 |
64 proxy_ssl_server_name on; | 64 proxy_ssl_server_name on; |
65 proxy_ssl_name example.com; | 65 proxy_ssl_name example.com; |
66 } | 66 } |
67 | 67 |
68 server { | 68 server { |
69 listen 127.0.0.1:8083; | 69 listen 127.0.0.1:%%PORT_3%%; |
70 proxy_pass 127.0.0.1:8086; | 70 proxy_pass 127.0.0.1:%%PORT_5%%; |
71 | 71 |
72 proxy_ssl_server_name on; | 72 proxy_ssl_server_name on; |
73 } | 73 } |
74 | 74 |
75 server { | 75 server { |
76 listen 127.0.0.1:8084; | 76 listen 127.0.0.1:%%PORT_4%%; |
77 proxy_pass 127.0.0.1:8086; | 77 proxy_pass 127.0.0.1:%%PORT_5%%; |
78 | 78 |
79 proxy_ssl_server_name on; | 79 proxy_ssl_server_name on; |
80 proxy_ssl_name example.com:123; | 80 proxy_ssl_name example.com:123; |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 http { | 84 http { |
85 %%TEST_GLOBALS_HTTP%% | 85 %%TEST_GLOBALS_HTTP%% |
86 | 86 |
87 server { | 87 server { |
88 listen 127.0.0.1:8086 ssl; | 88 listen 127.0.0.1:%%PORT_5%% ssl; |
89 server_name localhost; | 89 server_name localhost; |
90 | 90 |
91 ssl_certificate_key localhost.key; | 91 ssl_certificate_key localhost.key; |
92 ssl_certificate localhost.crt; | 92 ssl_certificate localhost.crt; |
93 | 93 |
121 | 121 |
122 $t->run(); | 122 $t->run(); |
123 | 123 |
124 ############################################################################### | 124 ############################################################################### |
125 | 125 |
126 like(http_get('/', socket => getconn('127.0.0.1:8080')), | 126 like(http_get('/'), qr/200 OK.*X-Name: ,/s, 'no name'); |
127 qr/200 OK.*X-Name: ,/s, 'no name'); | 127 like(http_get('/', socket => getconn('127.0.0.1:' . port(1))), |
128 like(http_get('/', socket => getconn('127.0.0.1:8081')), | |
129 qr/200 OK.*X-Name: u,/s, 'name default'); | 128 qr/200 OK.*X-Name: u,/s, 'name default'); |
130 like(http_get('/', socket => getconn('127.0.0.1:8082')), | 129 like(http_get('/', socket => getconn('127.0.0.1:' . port(2))), |
131 qr/200 OK.*X-Name: example.com,/s, 'name override'); | 130 qr/200 OK.*X-Name: example.com,/s, 'name override'); |
132 like(http_get('/', socket => getconn('127.0.0.1:8083')), | 131 like(http_get('/', socket => getconn('127.0.0.1:' . port(3))), |
133 qr/200 OK.*X-Name: ,/s, 'no ip'); | 132 qr/200 OK.*X-Name: ,/s, 'no ip'); |
134 like(http_get('/', socket => getconn('127.0.0.1:8084')), | 133 like(http_get('/', socket => getconn('127.0.0.1:' . port(4))), |
135 qr/200 OK.*X-Name: example.com,/s, 'no port in name'); | 134 qr/200 OK.*X-Name: example.com,/s, 'no port in name'); |
136 | 135 |
137 ############################################################################### | 136 ############################################################################### |
138 | 137 |
139 sub getconn { | 138 sub getconn { |
140 my $peer = shift; | 139 my $peer = shift; |
141 my $s = IO::Socket::INET->new( | 140 my $s = IO::Socket::INET->new( |
142 Proto => 'tcp', | 141 Proto => 'tcp', |
143 PeerAddr => $peer || '127.0.0.1:8080' | 142 PeerAddr => $peer |
144 ) | 143 ) |
145 or die "Can't connect to nginx: $!\n"; | 144 or die "Can't connect to nginx: $!\n"; |
146 | 145 |
147 return $s; | 146 return $s; |
148 } | 147 } |