Mercurial > hg > nginx-tests
diff h2_proxy_cache.t @ 986:99f93be57416
Tests: various HTTP/2 tests with canceled stream.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 20 Jul 2016 11:07:22 +0300 |
parents | de513b115e68 |
children | ec9b99d3e22e |
line wrap: on
line diff
--- a/h2_proxy_cache.t Wed Jul 20 11:07:20 2016 +0300 +++ b/h2_proxy_cache.t Wed Jul 20 11:07:22 2016 +0300 @@ -23,7 +23,7 @@ select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http http_v2 proxy cache/)->plan(11) +my $t = Test::Nginx->new()->has(qw/http http_v2 proxy cache/)->plan(12) ->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% @@ -38,6 +38,10 @@ proxy_cache_path %%TESTDIR%%/cache keys_zone=NAME:1m; + # quit unfixed nginx timely on different linuces + http2_idle_timeout 2s; + http2_recv_timeout 2s; + server { listen 127.0.0.1:8080 http2; listen 127.0.0.1:8081; @@ -145,4 +149,33 @@ ok(!grep ({ $_->{type} eq "DATA" } @$frames), 'proxy cache HEAD buffering off - no body'); +# client cancels stream with a cacheable request that was sent to upstream +# HEADERS should not be produced for the canceled stream + +$s = Test::Nginx::HTTP2->new(); +$sid = $s->new_stream({ path => '/cache/t.html?3' }); + +$s->h2_rst($sid, 8); + +$frames = $s->read(all => [{ sid => $sid, fin => 0x4 }], wait => 0.2); + +TODO: { +local $TODO = 'not yet'; + +ok(!(grep { $_->{type} eq "HEADERS" } @$frames), 'no headers'); + +} + +# client closes connection after sending a cacheable request producing alert + +$t->todo_alerts(); + +$s = Test::Nginx::HTTP2->new(); +$sid = $s->new_stream({ path => '/cache/t.html?4' }); + +undef $s; +select undef, undef, undef, 0.2; + +$t->stop(); + ###############################################################################