Mercurial > hg > nginx-tests
changeset 1255:b113eeca94ad
Tests: added proxy_limit_rate tests with upstream keepalive.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 05 Dec 2017 13:52:50 +0300 |
parents | 6fff42643fd7 |
children | fc43a3555095 |
files | proxy_limit_rate.t |
diffstat | 1 files changed, 27 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/proxy_limit_rate.t Tue Nov 28 15:26:08 2017 +0300 +++ b/proxy_limit_rate.t Tue Dec 05 13:52:50 2017 +0300 @@ -22,7 +22,7 @@ select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http proxy/)->plan(2); +my $t = Test::Nginx->new()->has(qw/http proxy upstream_keepalive/)->plan(4); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -36,6 +36,11 @@ http { %%TEST_GLOBALS_HTTP%% + upstream u { + server 127.0.0.1:8080; + keepalive 1; + } + server { listen 127.0.0.1:8080; server_name localhost; @@ -47,6 +52,15 @@ add_header X-Msec $msec; } + location /keepalive { + proxy_http_version 1.1; + proxy_set_header Connection ""; + proxy_pass http://u/data; + proxy_buffer_size 4k; + proxy_limit_rate 12000; + add_header X-Msec $msec; + } + location /data { } } @@ -69,4 +83,16 @@ cmp_ok($diff, '>=', 3, 'proxy_limit_rate'); like($r, qr/^(XXXXXXXXXX){4000}\x0d?\x0a?$/m, 'response body'); +# in case keepalive connection was saved with the delayed flag, +# the read timer used to be a delay timer in the next request + +like(http_get('/keepalive'), qr/200 OK/, 'keepalive'); + +TODO: { +local $TODO = 'not yet' unless $t->has_version('1.13.8'); + +like(http_get('/keepalive'), qr/200 OK/, 'keepalive 2'); + +} + ###############################################################################