Mercurial > hg > nginx-tests
comparison grpc.t @ 1693:5ac6efbe5552
Tests: removed TODO and try_run() checks for legacy versions.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 01 Jun 2021 16:40:18 +0300 |
parents | 816d6ceefe50 |
children | 90201294e1b6 |
comparison
equal
deleted
inserted
replaced
1692:f6795e2e6a4b | 1693:5ac6efbe5552 |
---|---|
45 | 45 |
46 server { | 46 server { |
47 listen 127.0.0.1:8080 http2; | 47 listen 127.0.0.1:8080 http2; |
48 server_name localhost; | 48 server_name localhost; |
49 | 49 |
50 http2_max_field_size 128k; | |
51 http2_max_header_size 128k; | |
52 http2_body_preread_size 128k; | 50 http2_body_preread_size 128k; |
53 large_client_header_buffers 4 32k; | 51 large_client_header_buffers 4 32k; |
54 | 52 |
55 location / { | 53 location / { |
56 grpc_pass grpc://127.0.0.1:8081; | 54 grpc_pass grpc://127.0.0.1:8081; |
90 } | 88 } |
91 } | 89 } |
92 | 90 |
93 EOF | 91 EOF |
94 | 92 |
95 # suppress deprecation warning | |
96 | |
97 open OLDERR, ">&", \*STDERR; close STDERR; | |
98 $t->run(); | 93 $t->run(); |
99 open STDERR, ">&", \*OLDERR; | |
100 | 94 |
101 ############################################################################### | 95 ############################################################################### |
102 | 96 |
103 my $p = port(8081); | 97 my $p = port(8081); |
104 my $f = grpc(); | 98 my $f = grpc(); |
282 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | 276 ($frame) = grep { $_->{type} eq "DATA" } @$frames; |
283 ok(!$frame, 'grpc error - no DATA frame'); | 277 ok(!$frame, 'grpc error - no DATA frame'); |
284 | 278 |
285 # malformed response body length not equal to content-length | 279 # malformed response body length not equal to content-length |
286 | 280 |
287 TODO: { | |
288 local $TODO = 'not yet' unless $t->has_version('1.19.1'); | |
289 | |
290 $f->{http_start}('/SayHello'); | 281 $f->{http_start}('/SayHello'); |
291 $f->{data}('Hello'); | 282 $f->{data}('Hello'); |
292 $frames = $f->{http_err2}(cl => 42); | 283 $frames = $f->{http_err2}(cl => 42); |
293 ($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames; | 284 ($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames; |
294 ok($frame, 'response body less than content-length'); | 285 ok($frame, 'response body less than content-length'); |
296 $f->{http_start}('/SayHello'); | 287 $f->{http_start}('/SayHello'); |
297 $f->{data}('Hello'); | 288 $f->{data}('Hello'); |
298 $frames = $f->{http_err2}(cl => 8); | 289 $frames = $f->{http_err2}(cl => 8); |
299 ($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames; | 290 ($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames; |
300 ok($frame, 'response body more than content-length'); | 291 ok($frame, 'response body more than content-length'); |
301 | |
302 } | |
303 | 292 |
304 # continuation from backend, expect parts assembled | 293 # continuation from backend, expect parts assembled |
305 | 294 |
306 $f->{http_start}('/SayHello'); | 295 $f->{http_start}('/SayHello'); |
307 $f->{data}('Hello'); | 296 $f->{data}('Hello'); |
479 is($frame->{length}, 11, 'DATA padding - length'); | 468 is($frame->{length}, 11, 'DATA padding - length'); |
480 is($frame->{flags}, 0, 'DATA padding - flags'); | 469 is($frame->{flags}, 0, 'DATA padding - flags'); |
481 | 470 |
482 # DATA padding with Content-Length | 471 # DATA padding with Content-Length |
483 | 472 |
484 TODO: { | |
485 local $TODO = 'not yet' | |
486 if $t->has_version('1.19.1') and !$t->has_version('1.19.9'); | |
487 | |
488 $f->{http_start}('/SayPadding'); | 473 $f->{http_start}('/SayPadding'); |
489 $f->{data}('Hello'); | 474 $f->{data}('Hello'); |
490 $frames = $f->{http_end}(body_padding => 42, cl => length('Hello world')); | 475 $frames = $f->{http_end}(body_padding => 42, cl => length('Hello world')); |
491 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | 476 ($frame) = grep { $_->{type} eq "DATA" } @$frames; |
492 is($frame->{data}, 'Hello world', 'DATA padding cl'); | 477 is($frame->{data}, 'Hello world', 'DATA padding cl'); |
493 is($frame->{length}, 11, 'DATA padding cl - length'); | 478 is($frame->{length}, 11, 'DATA padding cl - length'); |
494 is($frame->{flags}, 0, 'DATA padding cl - flags'); | 479 is($frame->{flags}, 0, 'DATA padding cl - flags'); |
495 | 480 |
496 } | |
497 | |
498 # :authority inheritance | 481 # :authority inheritance |
499 | 482 |
500 $frames = $f->{http_start}('/SayHello?if=1'); | 483 $frames = $f->{http_start}('/SayHello?if=1'); |
501 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | 484 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
502 is($frame->{headers}{':authority'}, "127.0.0.1:$p", 'authority in if'); | 485 is($frame->{headers}{':authority'}, "127.0.0.1:$p", 'authority in if'); |
545 $frames = $f->{http_start}('/', method => 'HEAD'); | 528 $frames = $f->{http_start}('/', method => 'HEAD'); |
546 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | 529 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
547 is($frame->{headers}{':method'}, 'HEAD', 'method head'); | 530 is($frame->{headers}{':method'}, 'HEAD', 'method head'); |
548 $f->{data}('Hello'); | 531 $f->{data}('Hello'); |
549 $f->{http_end}(); | 532 $f->{http_end}(); |
550 | |
551 TODO: { | |
552 local $TODO = 'not yet' unless $t->has_version('1.19.0'); | |
553 | 533 |
554 # receiving END_STREAM followed by WINDOW_UPDATE on incomplete request body | 534 # receiving END_STREAM followed by WINDOW_UPDATE on incomplete request body |
555 | 535 |
556 $f->{http_start}('/Discard_WU'); | 536 $f->{http_start}('/Discard_WU'); |
557 $frames = $f->{discard}(); | 537 $frames = $f->{discard}(); |
563 $f->{http_start}('/Discard_NE'); | 543 $f->{http_start}('/Discard_NE'); |
564 $frames = $f->{discard}(); | 544 $frames = $f->{discard}(); |
565 (undef, $frame) = grep { $_->{type} eq "HEADERS" } @$frames; | 545 (undef, $frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
566 is($frame->{flags}, 5, 'discard NO_ERROR - trailers'); | 546 is($frame->{flags}, 5, 'discard NO_ERROR - trailers'); |
567 | 547 |
568 } | |
569 | |
570 # receiving END_STREAM followed by several RST_STREAM NO_ERROR | 548 # receiving END_STREAM followed by several RST_STREAM NO_ERROR |
571 | 549 |
572 $f->{http_start}('/Discard_NE3'); | 550 $f->{http_start}('/Discard_NE3'); |
573 $frames = $f->{discard}(); | 551 $frames = $f->{discard}(); |
574 (undef, $frame) = grep { $_->{type} eq "HEADERS" } @$frames; | 552 (undef, $frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
593 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | 571 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
594 ok($frame->{headers}{'grpc-status'}, 'keepalive 3 - grpc error, rst'); | 572 ok($frame->{headers}{'grpc-status'}, 'keepalive 3 - grpc error, rst'); |
595 | 573 |
596 $frames = $f->{http_start}('/KeepAlive', reuse => 1); | 574 $frames = $f->{http_start}('/KeepAlive', reuse => 1); |
597 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | 575 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
598 | |
599 TODO: { | |
600 local $TODO = 'not yet' unless $t->has_version('1.19.5'); | |
601 | |
602 ok($frame, 'keepalive 3 - connection reused'); | 576 ok($frame, 'keepalive 3 - connection reused'); |
603 | |
604 } | |
605 | 577 |
606 undef $f; | 578 undef $f; |
607 $f = grpc(); | 579 $f = grpc(); |
608 | 580 |
609 ############################################################################### | 581 ############################################################################### |