Mercurial > hg > nginx-tests
comparison grpc.t @ 1319:3b30e97acdcb
Tests: made grpc preserve output test pass on win32 and Solaris.
The tested response body length was reduced to not step on partial write,
which is a subject for these platforms due to a small socket buffer size.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Fri, 06 Apr 2018 15:06:16 +0300 |
parents | 6de2a27af2d3 |
children | 351b95be742b |
comparison
equal
deleted
inserted
replaced
1318:6de2a27af2d3 | 1319:3b30e97acdcb |
---|---|
364 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | 364 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
365 is($frame->{flags}, 4, 'preserve - HEADERS'); | 365 is($frame->{flags}, 4, 'preserve - HEADERS'); |
366 | 366 |
367 my @data = grep { $_->{type} eq "DATA" } @$frames; | 367 my @data = grep { $_->{type} eq "DATA" } @$frames; |
368 $sum = eval join '+', map { $_->{length} } @data; | 368 $sum = eval join '+', map { $_->{length} } @data; |
369 is($sum, 163840, 'preserve - DATA'); | 369 is($sum, 20480, 'preserve - DATA'); |
370 | 370 |
371 (undef, $frame) = grep { $_->{type} eq "HEADERS" } @$frames; | 371 (undef, $frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
372 is($frame->{flags}, 5, 'preserve - trailers'); | 372 is($frame->{flags}, 5, 'preserve - trailers'); |
373 | 373 |
374 # DATA padding | 374 # DATA padding |
522 | 522 |
523 return $s->read(all => [{ fin => 1 }]); | 523 return $s->read(all => [{ fin => 1 }]); |
524 }; | 524 }; |
525 $f->{http_pres} = sub { | 525 $f->{http_pres} = sub { |
526 my (%extra) = @_; | 526 my (%extra) = @_; |
527 $s->h2_settings(0, 0x4 => 8192); | |
527 $c->new_stream({ body_more => 1, %extra, headers => [ | 528 $c->new_stream({ body_more => 1, %extra, headers => [ |
528 { name => ':status', value => '200', | 529 { name => ':status', value => '200', |
529 mode => $extra{mode} || 0 }, | 530 mode => $extra{mode} || 0 }, |
530 { name => 'content-type', value => 'application/grpc', | 531 { name => 'content-type', value => 'application/grpc', |
531 mode => $extra{mode} || 1, huff => 1 }, | 532 mode => $extra{mode} || 1, huff => 1 }, |
532 { name => 'x-connection', value => $n, | 533 { name => 'x-connection', value => $n, |
533 mode => 2, huff => 1 }, | 534 mode => 2, huff => 1 }, |
534 ]}, $sid); | 535 ]}, $sid); |
535 for (1 .. 20) { | 536 for (1 .. 20) { |
536 $c->h2_body(sprintf('Hello %02d', $_) x 1024, { | 537 $c->h2_body(sprintf('Hello %02d', $_) x 128, { |
537 body_more => 1, | 538 body_more => 1, |
538 body_padding => $extra{body_padding} }); | 539 body_padding => $extra{body_padding} }); |
539 $c->h2_ping("PING"); | 540 $c->h2_ping("PING"); |
540 } | 541 } |
541 # reopen window | 542 # reopen window |
546 mode => 2, huff => 1 }, | 547 mode => 2, huff => 1 }, |
547 { name => 'grpc-message', value => '', | 548 { name => 'grpc-message', value => '', |
548 mode => 2, huff => 1 }, | 549 mode => 2, huff => 1 }, |
549 ]}, $sid); | 550 ]}, $sid); |
550 | 551 |
551 return $s->read(all => [{ fin => 1 }]); | 552 return $s->read(all => [{ sid => $csid, fin => 1 }]); |
552 }; | 553 }; |
553 $f->{http_err} = sub { | 554 $f->{http_err} = sub { |
554 $c->new_stream({ headers => [ | 555 $c->new_stream({ headers => [ |
555 { name => ':status', value => '200', mode => 0 }, | 556 { name => ':status', value => '200', mode => 0 }, |
556 { name => 'content-type', value => 'application/grpc', | 557 { name => 'content-type', value => 'application/grpc', |