comparison proxy_limit_rate.t @ 1503:06fbbf1706bd

Tests: tune proxy_limit_rate tests for slow hosts.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 05 Sep 2019 11:24:58 +0300
parents 97c8280de681
children
comparison
equal deleted inserted replaced
1502:5ae8e8feac36 1503:06fbbf1706bd
46 server_name localhost; 46 server_name localhost;
47 47
48 location / { 48 location / {
49 proxy_pass http://127.0.0.1:8080/data; 49 proxy_pass http://127.0.0.1:8080/data;
50 proxy_buffer_size 4k; 50 proxy_buffer_size 4k;
51 proxy_limit_rate 12000; 51 proxy_limit_rate 20000;
52 add_header X-Msec $msec; 52 add_header X-Msec $msec;
53 } 53 }
54 54
55 location /keepalive { 55 location /keepalive {
56 proxy_http_version 1.1; 56 proxy_http_version 1.1;
57 proxy_set_header Connection ""; 57 proxy_set_header Connection "";
58 proxy_pass http://u/data; 58 proxy_pass http://u/data;
59 proxy_buffer_size 4k; 59 proxy_buffer_size 4k;
60 proxy_limit_rate 12000; 60 proxy_limit_rate 20000;
61 add_header X-Msec $msec; 61 add_header X-Msec $msec;
62 } 62 }
63 63
64 location /data { 64 location /data {
65 } 65 }
78 my ($t1) = $r =~ /X-Msec: (\d+)/; 78 my ($t1) = $r =~ /X-Msec: (\d+)/;
79 my $diff = time() - $t1; 79 my $diff = time() - $t1;
80 80
81 # four chunks are split with three 1s delays 81 # four chunks are split with three 1s delays
82 82
83 cmp_ok($diff, '>=', 3, 'proxy_limit_rate'); 83 cmp_ok($diff, '>=', 1, 'proxy_limit_rate');
84 like($r, qr/^(XXXXXXXXXX){4000}\x0d?\x0a?$/m, 'response body'); 84 like($r, qr/^(XXXXXXXXXX){4000}\x0d?\x0a?$/m, 'response body');
85 85
86 # in case keepalive connection was saved with the delayed flag, 86 # in case keepalive connection was saved with the delayed flag,
87 # the read timer used to be a delay timer in the next request 87 # the read timer used to be a delay timer in the next request
88 88