Mercurial > hg > nginx-tests
comparison proxy_variables.t @ 1291:3bc5df417f62
Tests: adjusted proxy variables time checks.
Strict ">= 1" check may fail if timekeeping is not precise, and sleep(1)
results in something like 0.999 time in headers. In particular, this
happens when using clock_gettime(CLOCK_MONOTONIC_COARSE) for ngx_current_msec
on Ubuntu 16.04. To fix this, sleep(1) replaced with select(1.1).
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 26 Feb 2018 18:09:32 +0300 |
parents | 196d33c2bb45 |
children | 2b461d4af65f |
comparison
equal
deleted
inserted
replaced
1290:5ac4aae1a740 | 1291:3bc5df417f62 |
---|---|
168 $uri = $1 if $headers =~ /^\S+\s+([^ ]+)\s+HTTP/i; | 168 $uri = $1 if $headers =~ /^\S+\s+([^ ]+)\s+HTTP/i; |
169 next unless defined $uri; | 169 next unless defined $uri; |
170 | 170 |
171 if ($uri =~ 'bad' && $once) { | 171 if ($uri =~ 'bad' && $once) { |
172 $once = 0; | 172 $once = 0; |
173 sleep 1; | 173 select undef, undef, undef, 1.1; |
174 next; | 174 next; |
175 } | 175 } |
176 | 176 |
177 if ($uri =~ 'header') { | 177 if ($uri =~ 'header') { |
178 sleep 1; | 178 select undef, undef, undef, 1.1; |
179 } | 179 } |
180 | 180 |
181 print $client <<EOF; | 181 print $client <<EOF; |
182 HTTP/1.1 200 OK | 182 HTTP/1.1 200 OK |
183 Connection: close | 183 Connection: close |
184 | 184 |
185 SEE-THIS- | 185 SEE-THIS- |
186 EOF | 186 EOF |
187 | 187 |
188 if ($uri =~ 'body') { | 188 if ($uri =~ 'body') { |
189 sleep 1; | 189 select undef, undef, undef, 1.1; |
190 } | 190 } |
191 | 191 |
192 print $client 'AND-THIS'; | 192 print $client 'AND-THIS'; |
193 } | 193 } |
194 } | 194 } |