Mercurial > hg > nginx-tests
comparison proxy_next_upstream_tries.t @ 608:ef1c363dd648
Tests: adjusted proxy_next_upstream_tries.t test timeouts.
As a result, timeout tests are now skipped by default as too long to execute.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 16 Jun 2015 20:39:22 +0300 |
parents | 907e89fba9c3 |
children | a6764c2a9f12 |
comparison
equal
deleted
inserted
replaced
607:97e88eff1433 | 608:ef1c363dd648 |
---|---|
79 proxy_pass http://u; | 79 proxy_pass http://u; |
80 proxy_next_upstream_tries 0; | 80 proxy_next_upstream_tries 0; |
81 } | 81 } |
82 | 82 |
83 location /timeout { | 83 location /timeout { |
84 proxy_pass http://u/w; | 84 proxy_pass http://u/w2; |
85 proxy_next_upstream_timeout 1900ms; | 85 proxy_next_upstream_timeout 3800ms; |
86 } | 86 } |
87 | 87 |
88 location /timeout/backup { | 88 location /timeout/backup { |
89 proxy_pass http://u2/w; | 89 proxy_pass http://u2/w2; |
90 proxy_next_upstream_timeout 1900ms; | 90 proxy_next_upstream_timeout 3800ms; |
91 } | 91 } |
92 | 92 |
93 location /timeout/resolver { | 93 location /timeout/resolver { |
94 resolver 127.0.0.1:8083; | 94 resolver 127.0.0.1:8083; |
95 resolver_timeout 1s; | 95 resolver_timeout 1s; |
96 | 96 |
97 proxy_pass http://$host:8081/w; | 97 proxy_pass http://$host:8081/w2; |
98 proxy_next_upstream_timeout 1900ms; | 98 proxy_next_upstream_timeout 3800ms; |
99 } | 99 } |
100 | 100 |
101 location /timeout/zero { | 101 location /timeout/zero { |
102 proxy_pass http://u/w; | 102 proxy_pass http://u/w; |
103 proxy_next_upstream_timeout 0; | 103 proxy_next_upstream_timeout 0; |
125 like(http_get('/tries/resolver'), qr/x404, 404x/, 'tries resolved'); | 125 like(http_get('/tries/resolver'), qr/x404, 404x/, 'tries resolved'); |
126 like(http_get('/tries/zero'), qr/x404, 404, 404x/, 'tries zero'); | 126 like(http_get('/tries/zero'), qr/x404, 404, 404x/, 'tries zero'); |
127 | 127 |
128 # two tries fit into 1.9s | 128 # two tries fit into 1.9s |
129 | 129 |
130 SKIP: { | |
131 skip 'long tests', 4 unless $ENV{TEST_NGINX_UNSAFE}; | |
132 | |
130 like(http_get('/timeout'), qr/x404, 404x/, 'timeout'); | 133 like(http_get('/timeout'), qr/x404, 404x/, 'timeout'); |
131 like(http_get('/timeout/backup'), qr/x404, 404x/, 'timeout backup'); | 134 like(http_get('/timeout/backup'), qr/x404, 404x/, 'timeout backup'); |
132 like(http_get('/timeout/resolver'), qr/x404, 404x/, 'timeout resolved'); | 135 like(http_get('/timeout/resolver'), qr/x404, 404x/, 'timeout resolved'); |
133 like(http_get('/timeout/zero'), qr/x404, 404, 404x/, 'timeout zero'); | 136 like(http_get('/timeout/zero'), qr/x404, 404, 404x/, 'timeout zero'); |
137 | |
138 } | |
134 | 139 |
135 ############################################################################### | 140 ############################################################################### |
136 | 141 |
137 sub http_daemon { | 142 sub http_daemon { |
138 my ($port) = @_; | 143 my ($port) = @_; |
166 if ($uri eq '/w') { | 171 if ($uri eq '/w') { |
167 Test::Nginx::log_core('||', "$port: sleep(1)"); | 172 Test::Nginx::log_core('||', "$port: sleep(1)"); |
168 select undef, undef, undef, 1; | 173 select undef, undef, undef, 1; |
169 } | 174 } |
170 | 175 |
176 if ($uri eq '/w2') { | |
177 Test::Nginx::log_core('||', "$port: sleep(2)"); | |
178 select undef, undef, undef, 2; | |
179 } | |
180 | |
171 Test::Nginx::log_core('||', "$port: response, 404"); | 181 Test::Nginx::log_core('||', "$port: response, 404"); |
172 print $client <<EOF; | 182 print $client <<EOF; |
173 HTTP/1.1 404 Not Found | 183 HTTP/1.1 404 Not Found |
174 Connection: close | 184 Connection: close |
175 | 185 |