comparison stream_proxy_ssl_certificate.t @ 974:882267679006

Tests: simplified parallel modifications in tests. Mail tests were simplified in c227348453db.
author Andrey Zelenkov <zelenkov@nginx.com>
date Tue, 12 Jul 2016 17:39:03 +0300
parents e9064d691790
children 90a0d85436c1
comparison
equal deleted inserted replaced
973:7d7aef8b9f3a 974:882267679006
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 server { 42 server {
43 listen 127.0.0.1:%%PORT_2%%; 43 listen 127.0.0.1:8082;
44 proxy_pass 127.0.0.1:%%PORT_0%%; 44 proxy_pass 127.0.0.1:8080;
45 45
46 proxy_ssl_certificate 1.example.com.crt; 46 proxy_ssl_certificate 1.example.com.crt;
47 proxy_ssl_certificate_key 1.example.com.key; 47 proxy_ssl_certificate_key 1.example.com.key;
48 } 48 }
49 49
50 server { 50 server {
51 listen 127.0.0.1:%%PORT_3%%; 51 listen 127.0.0.1:8083;
52 proxy_pass 127.0.0.1:%%PORT_0%%; 52 proxy_pass 127.0.0.1:8080;
53 53
54 proxy_ssl_certificate 2.example.com.crt; 54 proxy_ssl_certificate 2.example.com.crt;
55 proxy_ssl_certificate_key 2.example.com.key; 55 proxy_ssl_certificate_key 2.example.com.key;
56 } 56 }
57 57
58 server { 58 server {
59 listen 127.0.0.1:%%PORT_4%%; 59 listen 127.0.0.1:8084;
60 proxy_pass 127.0.0.1:%%PORT_1%%; 60 proxy_pass 127.0.0.1:8081;
61 61
62 proxy_ssl_certificate 3.example.com.crt; 62 proxy_ssl_certificate 3.example.com.crt;
63 proxy_ssl_certificate_key 3.example.com.key; 63 proxy_ssl_certificate_key 3.example.com.key;
64 proxy_ssl_password_file password; 64 proxy_ssl_password_file password;
65 } 65 }
67 67
68 http { 68 http {
69 %%TEST_GLOBALS_HTTP%% 69 %%TEST_GLOBALS_HTTP%%
70 70
71 server { 71 server {
72 listen 127.0.0.1:%%PORT_0%% ssl; 72 listen 127.0.0.1:8080 ssl;
73 server_name localhost; 73 server_name localhost;
74 74
75 ssl_certificate 2.example.com.crt; 75 ssl_certificate 2.example.com.crt;
76 ssl_certificate_key 2.example.com.key; 76 ssl_certificate_key 2.example.com.key;
77 77
83 add_header X-Name $ssl_client_s_dn; 83 add_header X-Name $ssl_client_s_dn;
84 } 84 }
85 } 85 }
86 86
87 server { 87 server {
88 listen 127.0.0.1:%%PORT_1%% ssl; 88 listen 127.0.0.1:8081 ssl;
89 server_name localhost; 89 server_name localhost;
90 90
91 ssl_certificate 1.example.com.crt; 91 ssl_certificate 1.example.com.crt;
92 ssl_certificate_key 1.example.com.key; 92 ssl_certificate_key 1.example.com.key;
93 93
137 137
138 $t->run(); 138 $t->run();
139 139
140 ############################################################################### 140 ###############################################################################
141 141
142 like(http_get('/', socket => getconn('127.0.0.1:' . port(2))), 142 like(http_get('/', socket => getconn('127.0.0.1:' . port(8082))),
143 qr/X-Verify: SUCCESS/ms, 'verify certificate'); 143 qr/X-Verify: SUCCESS/ms, 'verify certificate');
144 like(http_get('/', socket => getconn('127.0.0.1:' . port(3))), 144 like(http_get('/', socket => getconn('127.0.0.1:' . port(8083))),
145 qr/X-Verify: FAILED/ms, 'fail certificate'); 145 qr/X-Verify: FAILED/ms, 'fail certificate');
146 like(http_get('/', socket => getconn('127.0.0.1:' . port(4))), 146 like(http_get('/', socket => getconn('127.0.0.1:' . port(8084))),
147 qr/X-Verify: SUCCESS/ms, 'with encrypted key'); 147 qr/X-Verify: SUCCESS/ms, 'with encrypted key');
148 148
149 like(http_get('/', socket => getconn('127.0.0.1:' . port(2))), 149 like(http_get('/', socket => getconn('127.0.0.1:' . port(8082))),
150 qr!X-Name: /CN=1.example!, 'valid certificate'); 150 qr!X-Name: /CN=1.example!, 'valid certificate');
151 unlike(http_get('/', socket => getconn('127.0.0.1:' . port(3))), 151 unlike(http_get('/', socket => getconn('127.0.0.1:' . port(8083))),
152 qr!X-Name: /CN=1.example!, 'invalid certificate'); 152 qr!X-Name: /CN=1.example!, 'invalid certificate');
153 153
154 ############################################################################### 154 ###############################################################################
155 155
156 sub getconn { 156 sub getconn {