Mercurial > hg > nginx-tests
comparison proxy_next_upstream_tries.t @ 493:d456ed8a18de
Tests: added proxy_next_upstream_tries.t tests with zero value.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Fri, 07 Nov 2014 15:11:18 +0300 |
parents | 799487ee9aee |
children | 623863fcb1d1 |
comparison
equal
deleted
inserted
replaced
492:799487ee9aee | 493:d456ed8a18de |
---|---|
85 | 85 |
86 proxy_pass http://$host:8081/backend; | 86 proxy_pass http://$host:8081/backend; |
87 proxy_next_upstream_tries 2; | 87 proxy_next_upstream_tries 2; |
88 } | 88 } |
89 | 89 |
90 location /tries/zero { | |
91 proxy_pass http://u; | |
92 proxy_next_upstream_tries 0; | |
93 } | |
94 | |
90 location /timeout { | 95 location /timeout { |
91 proxy_pass http://u3; | 96 proxy_pass http://u3; |
92 proxy_next_upstream_timeout 1900ms; | 97 proxy_next_upstream_timeout 1900ms; |
93 } | 98 } |
94 | 99 |
103 | 108 |
104 proxy_pass http://$host:8082/backend; | 109 proxy_pass http://$host:8082/backend; |
105 proxy_next_upstream_timeout 1900ms; | 110 proxy_next_upstream_timeout 1900ms; |
106 } | 111 } |
107 | 112 |
113 location /timeout/zero { | |
114 proxy_pass http://u3; | |
115 proxy_next_upstream_timeout 0; | |
116 } | |
117 | |
108 location /404 { | 118 location /404 { |
109 return 200 x${upstream_status}x; | 119 return 200 x${upstream_status}x; |
110 } | 120 } |
111 } | 121 } |
112 } | 122 } |
114 EOF | 124 EOF |
115 | 125 |
116 $t->run_daemon(\&http_daemon, 8081); | 126 $t->run_daemon(\&http_daemon, 8081); |
117 $t->run_daemon(\&http_daemon, 8082); | 127 $t->run_daemon(\&http_daemon, 8082); |
118 $t->run_daemon(\&dns_daemon, 8083, $t); | 128 $t->run_daemon(\&dns_daemon, 8083, $t); |
119 $t->try_run('no proxy_next_upstream_tries')->plan(6); | 129 $t->try_run('no proxy_next_upstream_tries')->plan(8); |
120 | 130 |
121 $t->waitforsocket('127.0.0.1:8081'); | 131 $t->waitforsocket('127.0.0.1:8081'); |
122 $t->waitforsocket('127.0.0.1:8082'); | 132 $t->waitforsocket('127.0.0.1:8082'); |
123 $t->waitforfile($t->testdir . '/8083'); | 133 $t->waitforfile($t->testdir . '/8083'); |
124 | 134 |
132 | 142 |
133 like(http_get('/tries/resolver'), qr/x404, 404x/, 'tries resolved'); | 143 like(http_get('/tries/resolver'), qr/x404, 404x/, 'tries resolved'); |
134 | 144 |
135 } | 145 } |
136 | 146 |
147 like(http_get('/tries/zero'), qr/x404, 404, 404x/, 'tries zero'); | |
148 | |
137 # two tries fit into 1.9s | 149 # two tries fit into 1.9s |
138 | 150 |
139 like(http_get('/timeout'), qr/x404, 404x/, 'timeout'); | 151 like(http_get('/timeout'), qr/x404, 404x/, 'timeout'); |
140 like(http_get('/timeout/backup'), qr/x404, 404x/, 'timeout backup'); | 152 like(http_get('/timeout/backup'), qr/x404, 404x/, 'timeout backup'); |
141 | 153 |
143 local $TODO = 'not yet' unless $t->has_version('1.7.7'); | 155 local $TODO = 'not yet' unless $t->has_version('1.7.7'); |
144 | 156 |
145 like(http_get('/timeout/resolver'), qr/x404, 404x/, 'timeout resolved'); | 157 like(http_get('/timeout/resolver'), qr/x404, 404x/, 'timeout resolved'); |
146 | 158 |
147 } | 159 } |
160 | |
161 like(http_get('/timeout/zero'), qr/x404, 404, 404x/, 'timeout zero'); | |
148 | 162 |
149 ############################################################################### | 163 ############################################################################### |
150 | 164 |
151 sub http_daemon { | 165 sub http_daemon { |
152 my ($port) = @_; | 166 my ($port) = @_; |