# HG changeset patch # User Sergey Kandaurov # Date 1535998890 -10800 # Node ID 23e407a72fe932b62ccfc569a6b9948de9342e81 # Parent a37d8526e691f57c4e9a35bf50eca4ebe0fe9d30 Tests: upstream keepalive with grpc pending frames. This is a specific test for the bug fixed in 1.15.4. Note that a similar test in grpc_ssl.t manifests the bug as a side effect and with certain event methods. diff --git a/grpc.t b/grpc.t --- a/grpc.t +++ b/grpc.t @@ -91,7 +91,7 @@ http { EOF -$t->try_run('no grpc')->plan(100); +$t->try_run('no grpc')->plan(105); ############################################################################### @@ -173,6 +173,45 @@ cmp_ok($frame->{sid}, '>', $sid, 'keepal ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; is($frame->{headers}{'x-connection'}, $c, 'keepalive - connection reuse'); +# upstream keepalive +# pending control frame ack after the response + +undef $f; +$f = grpc(); + +$frames = $f->{http_start}('/KeepAlive'); +($frame) = grep { $_->{type} eq "HEADERS" } @$frames; +is($frame->{sid}, $sid, 'keepalive 2 - HEADERS sid'); +$f->{data}('Hello'); +$f->{settings}(0, 1 => 4096); +$frames = $f->{http_end}(); +($frame) = grep { $_->{type} eq "HEADERS" } @$frames; +ok($c = $frame->{headers}{'x-connection'}, 'keepalive 2 - connection'); + +$frames = $f->{http_start}('/KeepAlive', reuse => 1); +($frame) = grep { $_->{type} eq "HEADERS" } @$frames; + +TODO: { +local $TODO = 'not yet' unless $t->has_version('1.15.4'); + +ok($frame, 'upstream keepalive reused'); + +} + +TODO: { +todo_skip 'upstream connection failed', 2 unless $frame; + +cmp_ok($frame->{sid}, '>', $sid, 'keepalive 2 - HEADERS sid next'); +$f->{data}('Hello'); +$frames = $f->{http_end}(); +($frame) = grep { $_->{type} eq "HEADERS" } @$frames; +is($frame->{headers}{'x-connection'}, $c, 'keepalive 2 - connection reuse'); + +} + +undef $f; +$f = grpc(); + # various header compression formats $f->{http_start}('/SayHello'); @@ -514,6 +553,9 @@ sub grpc { $f->{update_sid} = sub { $c->h2_window(shift, $sid); }; + $f->{settings} = sub { + $c->h2_settings(@_); + }; $f->{http_end} = sub { my (%extra) = @_; $c->new_stream({ body_more => 1, %extra, headers => [