# HG changeset patch # User Sergey Kandaurov # Date 1512471170 -10800 # Node ID b113eeca94ad29e84896d76118a3f4c5eaba6db4 # Parent 6fff42643fd73a6404ec7dce525550a91698a503 Tests: added proxy_limit_rate tests with upstream keepalive. diff --git a/proxy_limit_rate.t b/proxy_limit_rate.t --- a/proxy_limit_rate.t +++ b/proxy_limit_rate.t @@ -22,7 +22,7 @@ use Test::Nginx; 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 @@ events { 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 @@ http { 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 @@ my $diff = time() - $t1; 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'); + +} + ###############################################################################