Mercurial > hg > nginx-tests
changeset 1668:0c1bd4c23c95
Tests: $connection_requests and $connection_time tests.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 08 Apr 2021 14:51:04 +0300 |
parents | bdebd63dbab3 |
children | 03cf423ea140 |
files | h2_max_requests.t http_keepalive.t |
diffstat | 2 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/h2_max_requests.t Thu Apr 08 12:59:11 2021 +0300 +++ b/h2_max_requests.t Thu Apr 08 14:51:04 2021 +0300 @@ -63,6 +63,8 @@ keepalive_time 1s; + add_header X-Conn $connection_requests:$connection_time; + location / { } } } @@ -75,7 +77,7 @@ # suppress deprecation warning open OLDERR, ">&", \*STDERR; close STDERR; -$t->try_run('no keepalive_time')->plan(17); +$t->try_run('no keepalive_time')->plan(19); open STDERR, ">&", \*OLDERR; ############################################################################### @@ -158,6 +160,7 @@ ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; is($frame->{headers}->{':status'}, 200, 'keepalive time request'); +like($frame->{headers}->{'x-conn'}, qr/^1:0/, 'keepalive time variables'); $frames = $s->read(all => [{ type => 'GOAWAY' }], wait => 0.5); @@ -171,6 +174,7 @@ ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; is($frame->{headers}->{':status'}, 200, 'keepalive time request 2'); +like($frame->{headers}->{'x-conn'}, qr/^2:[^0]/, 'keepalive time variables 2'); ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; ok($frame, 'keepalive time limit - GOAWAY');
--- a/http_keepalive.t Thu Apr 08 12:59:11 2021 +0300 +++ b/http_keepalive.t Thu Apr 08 14:51:04 2021 +0300 @@ -49,6 +49,8 @@ keepalive_requests 2; keepalive_timeout 1 9; + add_header X-Conn $connection_requests:$connection_time; + location / { } location /r { keepalive_requests 4; @@ -83,7 +85,7 @@ $t->write_file('safari', ''); $t->write_file('none', ''); $t->write_file('zero', ''); -$t->try_run('no keepalive_time')->plan(20); +$t->try_run('no keepalive_time')->plan(21); ############################################################################### @@ -127,6 +129,8 @@ is(() = $r =~ /(200 OK)/g, 2, 'keepalive time limit requests'); like($r, qr/Connection: close/, 'keepalive time limit connection'); +like($r, qr/X-Conn: 1:0.*X-Conn: 2:[^0]/s, 'keepalive time limit variables'); + # cancel keepalive on EOF while discarding body my $s = http(<<EOF, start => 1);