1Interoperability Test Case Descriptions 2======================================= 3 4Client and server use 5[test.proto](../src/proto/grpc/testing/test.proto) 6and the [gRPC over HTTP/2 v2 protocol](./PROTOCOL-HTTP2.md). 7 8Client 9------ 10 11Clients implement test cases that test certain functionally. Each client is 12provided the test case it is expected to run as a command-line parameter. Names 13should be lowercase and without spaces. 14 15Clients should accept these arguments: 16* --server_host=HOSTNAME 17 * The server host to connect to. For example, "localhost" or "127.0.0.1" 18* --server_host_override=HOSTNAME 19 * The server host to claim to be connecting to, for use in TLS and HTTP/2 20 :authority header. If unspecified, the value of --server_host will be 21 used 22* --server_port=PORT 23 * The server port to connect to. For example, "8080" 24* --test_case=TESTCASE 25 * The name of the test case to execute. For example, "empty_unary" 26* --use_tls=BOOLEAN 27 * Whether to use a plaintext or encrypted connection 28* --use_test_ca=BOOLEAN 29 * Whether to replace platform root CAs with 30 [ca.pem](https://github.com/grpc/grpc/blob/master/src/core/tsi/test_creds/ca.pem) 31 as the CA root 32* --default_service_account=ACCOUNT_EMAIL 33 * Email of the GCE default service account. 34* --oauth_scope=SCOPE 35 * OAuth scope. For example, "https://www.googleapis.com/auth/xapi.zoo" 36* --service_account_key_file=PATH 37 * The path to the service account JSON key file generated from GCE developer 38 console. 39* --service_config_json=SERVICE_CONFIG_JSON 40 * Disables service config lookups and sets the provided string as the 41 default service config. 42* --additional_metadata=ADDITIONAL_METADATA 43 * Additional metadata to send in each request, as a semicolon-separated list 44 of key:value pairs. The first key/value pair is separated by the first colon. 45 The second key/value pair is separated by the next colon *following* the 46 next semi-colon thereafter, and so on. For example: 47 - `abc-key:abc-value;foo-key:foo-value` 48 - Key/value pairs: `abc-key`/`abc-value`, `foo-key`/`foo-value`. 49 - `abc-key:abc:value;foo-key:foo:value` 50 - Key/value pairs: `abc-key`/`abc:value`, `foo-key`/`foo:value`. 51 52 Keys must be ASCII only (no `-bin` headers allowed). Values may contain 53 any character except semi-colons. 54 55Clients must support TLS with ALPN. Clients must not disable certificate 56checking. 57 58### empty_unary 59 60This test verifies that implementations support zero-size messages. Ideally, 61client implementations would verify that the request and response were zero 62bytes serialized, but this is generally prohibitive to perform, so is not 63required. 64 65Server features: 66* [EmptyCall][] 67 68Procedure: 69 1. Client calls EmptyCall with the default Empty message 70 71Client asserts: 72* call was successful 73* response is non-null 74 75*It may be possible to use UnaryCall instead of EmptyCall, but it is harder to 76ensure that the proto serialized to zero bytes.* 77 78### cacheable_unary 79 80This test verifies that gRPC requests marked as cacheable use GET verb instead 81of POST, and that server sets appropriate cache control headers for the response 82to be cached by a proxy. This test requires that the server is behind 83a caching proxy. Use of current timestamp in the request prevents accidental 84cache matches left over from previous tests. 85 86Server features: 87* [CacheableUnaryCall][] 88 89Procedure: 90 1. Client calls CacheableUnaryCall with `SimpleRequest` request with payload 91 set to current timestamp. Timestamp format is irrelevant, and resolution is 92 in nanoseconds. 93 Client adds a `x-user-ip` header with value `1.2.3.4` to the request. 94 This is done since some proxys such as GFE will not cache requests from 95 localhost. 96 Client marks the request as cacheable by setting the cacheable flag in the 97 request context. Longer term this should be driven by the method option 98 specified in the proto file itself. 99 2. Client calls CacheableUnaryCall again immediately with the same request and 100 configuration as the previous call. 101 102Client asserts: 103* Both calls were successful 104* The payload body of both responses is the same. 105 106### large_unary 107 108This test verifies unary calls succeed in sending messages, and touches on flow 109control (even if compression is enabled on the channel). 110 111Server features: 112* [UnaryCall][] 113 114Procedure: 115 1. Client calls UnaryCall with: 116 117 ``` 118 { 119 response_size: 314159 120 payload:{ 121 body: 271828 bytes of zeros 122 } 123 } 124 ``` 125 126Client asserts: 127* call was successful 128* response payload body is 314159 bytes in size 129* clients are free to assert that the response payload body contents are zero 130 and comparing the entire response message against a golden response 131 132### client_compressed_unary 133 134This test verifies the client can compress unary messages by sending two unary 135calls, for compressed and uncompressed payloads. It also sends an initial 136probing request to verify whether the server supports the [CompressedRequest][] 137feature by checking if the probing call fails with an `INVALID_ARGUMENT` status. 138 139Server features: 140* [UnaryCall][] 141* [CompressedRequest][] 142 143Procedure: 144 1. Client calls UnaryCall with the feature probe, an *uncompressed* message: 145 ``` 146 { 147 expect_compressed:{ 148 value: true 149 } 150 response_size: 314159 151 payload:{ 152 body: 271828 bytes of zeros 153 } 154 } 155 ``` 156 157 1. Client calls UnaryCall with the *compressed* message: 158 159 ``` 160 { 161 expect_compressed:{ 162 value: true 163 } 164 response_size: 314159 165 payload:{ 166 body: 271828 bytes of zeros 167 } 168 } 169 ``` 170 171 1. Client calls UnaryCall with the *uncompressed* message: 172 173 ``` 174 { 175 expect_compressed:{ 176 value: false 177 } 178 response_size: 314159 179 payload:{ 180 body: 271828 bytes of zeros 181 } 182 } 183 ``` 184 185 Client asserts: 186 * First call failed with `INVALID_ARGUMENT` status. 187 * Subsequent calls were successful. 188 * Response payload body is 314159 bytes in size. 189 * Clients are free to assert that the response payload body contents are 190 zeros and comparing the entire response message against a golden response. 191 192 193### server_compressed_unary 194 195This test verifies the server can compress unary messages. It sends two unary 196requests, expecting the server's response to be compressed or not according to 197the `response_compressed` boolean. 198 199Whether compression was actually performed is determined by the compression bit 200in the response's message flags. *Note that some languages may not have access 201to the message flags, in which case the client will be unable to verify that 202the `response_compressed` boolean is obeyed by the server*. 203 204 205Server features: 206* [UnaryCall][] 207* [CompressedResponse][] 208 209Procedure: 210 1. Client calls UnaryCall with `SimpleRequest`: 211 212 ``` 213 { 214 response_compressed:{ 215 value: true 216 } 217 response_size: 314159 218 payload:{ 219 body: 271828 bytes of zeros 220 } 221 } 222 ``` 223 224 ``` 225 { 226 response_compressed:{ 227 value: false 228 } 229 response_size: 314159 230 payload:{ 231 body: 271828 bytes of zeros 232 } 233 } 234 ``` 235 Client asserts: 236 * call was successful 237 * if supported by the implementation, when `response_compressed` is true, 238 the response MUST have the compressed message flag set. 239 * if supported by the implementation, when `response_compressed` is false, 240 the response MUST NOT have the compressed message flag set. 241 * response payload body is 314159 bytes in size in both cases. 242 * clients are free to assert that the response payload body contents are 243 zero and comparing the entire response message against a golden response 244 245 246### client_streaming 247 248This test verifies that client-only streaming succeeds. 249 250Server features: 251* [StreamingInputCall][] 252 253Procedure: 254 1. Client calls StreamingInputCall 255 2. Client sends: 256 257 ``` 258 { 259 payload:{ 260 body: 27182 bytes of zeros 261 } 262 } 263 ``` 264 265 3. Client then sends: 266 267 ``` 268 { 269 payload:{ 270 body: 8 bytes of zeros 271 } 272 } 273 ``` 274 275 4. Client then sends: 276 277 ``` 278 { 279 payload:{ 280 body: 1828 bytes of zeros 281 } 282 } 283 ``` 284 285 5. Client then sends: 286 287 ``` 288 { 289 payload:{ 290 body: 45904 bytes of zeros 291 } 292 } 293 ``` 294 295 6. Client half-closes 296 297Client asserts: 298* call was successful 299* response aggregated_payload_size is 74922 300 301 302### client_compressed_streaming 303 304This test verifies the client can compress requests on per-message basis by 305performing a two-request streaming call. It also sends an initial probing 306request to verify whether the server supports the [CompressedRequest][] feature 307by checking if the probing call fails with an `INVALID_ARGUMENT` status. 308 309Procedure: 310 1. Client calls `StreamingInputCall` and sends the following feature-probing 311 *uncompressed* `StreamingInputCallRequest` message 312 313 ``` 314 { 315 expect_compressed:{ 316 value: true 317 } 318 payload:{ 319 body: 27182 bytes of zeros 320 } 321 } 322 ``` 323 If the call does not fail with `INVALID_ARGUMENT`, the test fails. 324 Otherwise, we continue. 325 326 1. Client calls `StreamingInputCall` again, sending the *compressed* message 327 328 ``` 329 { 330 expect_compressed:{ 331 value: true 332 } 333 payload:{ 334 body: 27182 bytes of zeros 335 } 336 } 337 ``` 338 339 1. And finally, the *uncompressed* message 340 ``` 341 { 342 expect_compressed:{ 343 value: false 344 } 345 payload:{ 346 body: 45904 bytes of zeros 347 } 348 } 349 ``` 350 351 1. Client half-closes 352 353Client asserts: 354* First call fails with `INVALID_ARGUMENT`. 355* Next calls succeeds. 356* Response aggregated payload size is 73086. 357 358 359### server_streaming 360 361This test verifies that server-only streaming succeeds. 362 363Server features: 364* [StreamingOutputCall][] 365 366Procedure: 367 1. Client calls StreamingOutputCall with `StreamingOutputCallRequest`: 368 369 ``` 370 { 371 response_parameters:{ 372 size: 31415 373 } 374 response_parameters:{ 375 size: 9 376 } 377 response_parameters:{ 378 size: 2653 379 } 380 response_parameters:{ 381 size: 58979 382 } 383 } 384 ``` 385 386Client asserts: 387* call was successful 388* exactly four responses 389* response payload bodies are sized (in order): 31415, 9, 2653, 58979 390* clients are free to assert that the response payload body contents are zero 391 and comparing the entire response messages against golden responses 392 393### server_compressed_streaming 394 395This test verifies that the server can compress streaming messages and disable 396compression on individual messages, expecting the server's response to be 397compressed or not according to the `response_compressed` boolean. 398 399Whether compression was actually performed is determined by the compression bit 400in the response's message flags. *Note that some languages may not have access 401to the message flags, in which case the client will be unable to verify that the 402`response_compressed` boolean is obeyed by the server*. 403 404Server features: 405* [StreamingOutputCall][] 406* [CompressedResponse][] 407 408 409Procedure: 410 1. Client calls StreamingOutputCall with `StreamingOutputCallRequest`: 411 412 ``` 413 { 414 response_parameters:{ 415 compressed: { 416 value: true 417 } 418 size: 31415 419 } 420 response_parameters:{ 421 compressed: { 422 value: false 423 } 424 size: 92653 425 } 426 } 427 ``` 428 429 Client asserts: 430 * call was successful 431 * exactly two responses 432 * if supported by the implementation, when `response_compressed` is false, 433 the response's messages MUST NOT have the compressed message flag set. 434 * if supported by the implementation, when `response_compressed` is true, 435 the response's messages MUST have the compressed message flag set. 436 * response payload bodies are sized (in order): 31415, 92653 437 * clients are free to assert that the response payload body contents are 438 zero and comparing the entire response messages against golden responses 439 440### ping_pong 441 442This test verifies that full duplex bidi is supported. 443 444Server features: 445* [FullDuplexCall][] 446 447Procedure: 448 1. Client calls FullDuplexCall with: 449 450 ``` 451 { 452 response_parameters:{ 453 size: 31415 454 } 455 payload:{ 456 body: 27182 bytes of zeros 457 } 458 } 459 ``` 460 461 2. After getting a reply, it sends: 462 463 ``` 464 { 465 response_parameters:{ 466 size: 9 467 } 468 payload:{ 469 body: 8 bytes of zeros 470 } 471 } 472 ``` 473 474 3. After getting a reply, it sends: 475 476 ``` 477 { 478 response_parameters:{ 479 size: 2653 480 } 481 payload:{ 482 body: 1828 bytes of zeros 483 } 484 } 485 ``` 486 487 4. After getting a reply, it sends: 488 489 ``` 490 { 491 response_parameters:{ 492 size: 58979 493 } 494 payload:{ 495 body: 45904 bytes of zeros 496 } 497 } 498 ``` 499 500 5. After getting a reply, client half-closes 501 502Client asserts: 503* call was successful 504* exactly four responses 505* response payload bodies are sized (in order): 31415, 9, 2653, 58979 506* clients are free to assert that the response payload body contents are zero 507 and comparing the entire response messages against golden responses 508 509### empty_stream 510 511This test verifies that streams support having zero-messages in both 512directions. 513 514Server features: 515* [FullDuplexCall][] 516 517Procedure: 518 1. Client calls FullDuplexCall and then half-closes 519 520Client asserts: 521* call was successful 522* exactly zero responses 523 524### compute_engine_creds 525 526This test is only for cloud-to-prod path. 527 528This test verifies unary calls succeed in sending messages while using Service 529Credentials from GCE metadata server. The client instance needs to be created 530with desired oauth scope. 531 532The test uses `--default_service_account` with GCE service account email and 533`--oauth_scope` with the OAuth scope to use. For testing against 534grpc-test.sandbox.googleapis.com, "https://www.googleapis.com/auth/xapi.zoo" 535should 536be passed in as `--oauth_scope`. 537 538Server features: 539* [UnaryCall][] 540* [Echo Authenticated Username][] 541* [Echo OAuth Scope][] 542 543Procedure: 544 1. Client configures channel to use GCECredentials 545 2. Client calls UnaryCall on the channel with: 546 547 ``` 548 { 549 response_size: 314159 550 payload:{ 551 body: 271828 bytes of zeros 552 } 553 fill_username: true 554 fill_oauth_scope: true 555 } 556 ``` 557 558Client asserts: 559* call was successful 560* received SimpleResponse.username equals the value of 561 `--default_service_account` flag 562* received SimpleResponse.oauth_scope is in `--oauth_scope` 563* response payload body is 314159 bytes in size 564* clients are free to assert that the response payload body contents are zero 565 and comparing the entire response message against a golden response 566 567### jwt_token_creds 568 569This test is only for cloud-to-prod path. 570 571This test verifies unary calls succeed in sending messages while using JWT 572token (created by the project's key file) 573 574Test caller should set flag `--service_account_key_file` with the 575path to json key file downloaded from 576https://console.developers.google.com. Alternately, if using a 577usable auth implementation, she may specify the file location in the environment 578variable GOOGLE_APPLICATION_CREDENTIALS. 579 580Server features: 581* [UnaryCall][] 582* [Echo Authenticated Username][] 583* [Echo OAuth Scope][] 584 585Procedure: 586 1. Client configures the channel to use JWTTokenCredentials 587 2. Client calls UnaryCall with: 588 589 ``` 590 { 591 response_size: 314159 592 payload:{ 593 body: 271828 bytes of zeros 594 } 595 fill_username: true 596 } 597 ``` 598 599Client asserts: 600* call was successful 601* received SimpleResponse.username is not empty and is in the json key file used 602by the auth library. The client can optionally check the username matches the 603email address in the key file or equals the value of `--default_service_account` 604flag. 605* response payload body is 314159 bytes in size 606* clients are free to assert that the response payload body contents are zero 607 and comparing the entire response message against a golden response 608 609### oauth2_auth_token 610 611This test is only for cloud-to-prod path and some implementations may run 612in GCE only. 613 614This test verifies unary calls succeed in sending messages using an OAuth2 token 615that is obtained out of band. For the purpose of the test, the OAuth2 token is 616actually obtained from a service account credentials or GCE credentials via the 617language-specific authorization library. 618 619The difference between this test and the other auth tests is that it 620first uses the authorization library to obtain an authorization token. 621 622The test 623- uses the flag `--service_account_key_file` with the path to a json key file 624downloaded from https://console.developers.google.com. Alternately, if using a 625usable auth implementation, it may specify the file location in the environment 626variable GOOGLE_APPLICATION_CREDENTIALS, *OR* if GCE credentials is used to 627fetch the token, `--default_service_account` can be used to pass in GCE service 628account email. 629- uses the flag `--oauth_scope` for the oauth scope. For testing against 630grpc-test.sandbox.googleapis.com, "https://www.googleapis.com/auth/xapi.zoo" 631should be passed as the `--oauth_scope`. 632 633Server features: 634* [UnaryCall][] 635* [Echo Authenticated Username][] 636* [Echo OAuth Scope][] 637 638Procedure: 639 1. Client uses the auth library to obtain an authorization token 640 2. Client configures the channel to use AccessTokenCredentials with the access 641 token obtained in step 1 642 3. Client calls UnaryCall with the following message 643 644 ``` 645 { 646 fill_username: true 647 fill_oauth_scope: true 648 } 649 ``` 650 651Client asserts: 652* call was successful 653* received SimpleResponse.username is valid. Depending on whether a service 654account key file or GCE credentials was used, client should check against the 655json key file or GCE default service account email. 656* received SimpleResponse.oauth_scope is in `--oauth_scope` 657 658### per_rpc_creds 659 660Similar to the other auth tests, this test is only for cloud-to-prod path. 661 662This test verifies unary calls succeed in sending messages using a JWT or a 663service account credentials set on the RPC. 664 665The test 666- uses the flag `--service_account_key_file` with the path to a json key file 667downloaded from https://console.developers.google.com. Alternately, if using a 668usable auth implementation, it may specify the file location in the environment 669variable GOOGLE_APPLICATION_CREDENTIALS 670- optionally uses the flag `--oauth_scope` for the oauth scope if implementer 671wishes to use service account credential instead of JWT credential. For testing 672against grpc-test.sandbox.googleapis.com, oauth scope 673"https://www.googleapis.com/auth/xapi.zoo" should be used. 674 675Server features: 676* [UnaryCall][] 677* [Echo Authenticated Username][] 678* [Echo OAuth Scope][] 679 680Procedure: 681 1. Client configures the channel with just SSL credentials 682 2. Client calls UnaryCall, setting per-call credentials to 683 JWTTokenCredentials. The request is the following message 684 685 ``` 686 { 687 fill_username: true 688 } 689 ``` 690 691Client asserts: 692* call was successful 693* received SimpleResponse.username is not empty and is in the json key file used 694by the auth library. The client can optionally check the username matches the 695email address in the key file. 696 697### google_default_credentials 698 699Similar to the other auth tests, this test should only be run against prod 700servers. Different from some of the other auth tests however, this test 701may be also run from outside of GCP. 702 703This test verifies unary calls succeed when the client uses 704GoogleDefaultCredentials. The path to a service account key file in the 705GOOGLE_APPLICATION_CREDENTIALS environment variable may or may not be 706provided by the test runner. For example, the test runner might set 707this environment when outside of GCP but keep it unset when on GCP. 708 709The test uses `--default_service_account` with GCE service account email. 710 711Server features: 712* [UnaryCall][] 713* [Echo Authenticated Username][] 714 715Procedure: 716 1. Client configures the channel to use GoogleDefaultCredentials 717 * Note: the term `GoogleDefaultCredentials` within the context 718 of this test description refers to an API which encapsulates 719 both "transport credentials" and "call credentials" and which 720 is capable of transport creds auto-selection (including ALTS). 721 Similar APIs involving only auto-selection of OAuth mechanisms 722 might work for this test but aren't the intended subjects. 723 2. Client calls UnaryCall with: 724 725 ``` 726 { 727 fill_username: true 728 } 729 ``` 730 731Client asserts: 732* call was successful 733* received SimpleResponse.username matches the value of 734 `--default_service_account` 735 736### compute_engine_channel_credentials 737 738Similar to the other auth tests, this test should only be run against prod 739servers. Note that this test may only be ran on GCP. 740 741This test verifies unary calls succeed when the client uses 742ComputeEngineChannelCredentials. All that is needed by the test environment 743is for the client to be running on GCP. 744 745The test uses `--default_service_account` with GCE service account email. This 746email must identify the default service account of the GCP VM that the test 747is running on. 748 749Server features: 750* [UnaryCall][] 751* [Echo Authenticated Username][] 752 753Procedure: 754 1. Client configures the channel to use ComputeEngineChannelCredentials 755 * Note: the term `ComputeEngineChannelCredentials` within the context 756 of this test description refers to an API which encapsulates 757 both "transport credentials" and "call credentials" and which 758 is capable of transport creds auto-selection (including ALTS). 759 The exact name of the API may vary per language. 760 2. Client calls UnaryCall with: 761 762 ``` 763 { 764 fill_username: true 765 } 766 ``` 767 768Client asserts: 769* call was successful 770* received SimpleResponse.username matches the value of 771 `--default_service_account` 772 773### custom_metadata 774 775This test verifies that custom metadata in either binary or ascii format can be 776sent as initial-metadata by the client and as both initial- and trailing-metadata 777by the server. 778 779Server features: 780* [UnaryCall][] 781* [FullDuplexCall][] 782* [Echo Metadata][] 783 784Procedure: 785 1. The client attaches custom metadata with the following keys and values: 786 787 ``` 788 key: "x-grpc-test-echo-initial", value: "test_initial_metadata_value" 789 key: "x-grpc-test-echo-trailing-bin", value: 0xababab 790 ``` 791 792 to a UnaryCall with request: 793 794 ``` 795 { 796 response_size: 314159 797 payload:{ 798 body: 271828 bytes of zeros 799 } 800 } 801 ``` 802 803 2. The client attaches custom metadata with the following keys and values: 804 805 ``` 806 key: "x-grpc-test-echo-initial", value: "test_initial_metadata_value" 807 key: "x-grpc-test-echo-trailing-bin", value: 0xababab 808 ``` 809 810 to a FullDuplexCall with request: 811 812 ``` 813 { 814 response_parameters:{ 815 size: 314159 816 } 817 payload:{ 818 body: 271828 bytes of zeros 819 } 820 } 821 ``` 822 823 and then half-closes 824 825Client asserts: 826* call was successful 827* metadata with key `"x-grpc-test-echo-initial"` and value 828 `"test_initial_metadata_value"`is received in the initial metadata for calls 829 in Procedure steps 1 and 2. 830* metadata with key `"x-grpc-test-echo-trailing-bin"` and value `0xababab` is 831 received in the trailing metadata for calls in Procedure steps 1 and 2. 832 833 834 835### status_code_and_message 836 837This test verifies unary calls succeed in sending messages, and propagate back 838status code and message sent along with the messages. 839 840Server features: 841* [UnaryCall][] 842* [FullDuplexCall][] 843* [Echo Status][] 844 845Procedure: 846 1. Client calls UnaryCall with: 847 848 ``` 849 { 850 response_status:{ 851 code: 2 852 message: "test status message" 853 } 854 } 855 ``` 856 857 2. Client calls FullDuplexCall with: 858 859 ``` 860 { 861 response_status:{ 862 code: 2 863 message: "test status message" 864 } 865 } 866 ``` 867 868 and then half-closes 869 870 871Client asserts: 872* received status code is the same as the sent code for both Procedure steps 1 873 and 2 874* received status message is the same as the sent message for both Procedure 875 steps 1 and 2 876 877### special_status_message 878 879This test verifies Unicode and whitespace is correctly processed in status 880message. "\t" is horizontal tab. "\r" is carriage return. "\n" is line feed. 881 882Server features: 883* [UnaryCall][] 884* [Echo Status][] 885 886Procedure: 887 1. Client calls UnaryCall with: 888 889 ``` 890 { 891 response_status:{ 892 code: 2 893 message: "\t\ntest with whitespace\r\nand Unicode BMP ☺ and non-BMP \t\n" 894 } 895 } 896 ``` 897 898Client asserts: 899* received status code is the same as the sent code for Procedure step 1 900* received status message is the same as the sent message for Procedure step 1, 901 including all whitespace characters 902 903### unimplemented_method 904 905This test verifies that calling an unimplemented RPC method returns the 906UNIMPLEMENTED status code. 907 908Server features: 909N/A 910 911Procedure: 912* Client calls `grpc.testing.TestService/UnimplementedCall` with an empty 913 request (defined as `grpc.testing.Empty`): 914 915 ``` 916 { 917 } 918 ``` 919 920Client asserts: 921* received status code is 12 (UNIMPLEMENTED) 922 923### unimplemented_service 924 925This test verifies calling an unimplemented server returns the UNIMPLEMENTED 926status code. 927 928Server features: 929N/A 930 931Procedure: 932* Client calls `grpc.testing.UnimplementedService/UnimplementedCall` with an 933 empty request (defined as `grpc.testing.Empty`) 934 935Client asserts: 936* received status code is 12 (UNIMPLEMENTED) 937 938### cancel_after_begin 939 940This test verifies that a request can be cancelled after metadata has been sent 941but before payloads are sent. 942 943Server features: 944* [StreamingInputCall][] 945 946Procedure: 947 1. Client starts StreamingInputCall 948 2. Client immediately cancels request 949 950Client asserts: 951* Call completed with status CANCELLED 952 953### cancel_after_first_response 954 955This test verifies that a request can be cancelled after receiving a message 956from the server. 957 958Server features: 959* [FullDuplexCall][] 960 961Procedure: 962 1. Client starts FullDuplexCall with 963 964 ``` 965 { 966 response_parameters:{ 967 size: 31415 968 } 969 payload:{ 970 body: 27182 bytes of zeros 971 } 972 } 973 ``` 974 975 2. After receiving a response, client cancels request 976 977Client asserts: 978* Call completed with status CANCELLED 979 980### timeout_on_sleeping_server 981 982This test verifies that an RPC request whose lifetime exceeds its configured 983timeout value will end with the DeadlineExceeded status. 984 985Server features: 986* [FullDuplexCall][] 987 988Procedure: 989 1. Client calls FullDuplexCall with the following request and sets its timeout 990 to 1ms 991 992 ``` 993 { 994 payload:{ 995 body: 27182 bytes of zeros 996 } 997 } 998 ``` 999 1000 2. Client waits 1001 1002Client asserts: 1003* Call completed with status DEADLINE_EXCEEDED. 1004 1005### rpc_soak 1006 1007The client performs many large_unary RPCs in sequence over the same channel. 1008The client records the latency and status of each RPC in some data structure. 1009If the test ever consumes `soak_overall_timeout_seconds` seconds and still hasn't 1010completed `soak_iterations` RPCs, then the test should discontinue sending RPCs 1011as soon as possible. After performing all RPCs, the test should examine 1012previously recorded RPC latency and status results in a second pass and fail if 1013either: 1014 1015a) not all `soak_iterations` RPCs were completed 1016 1017b) the sum of RPCs that either completed with a non-OK status or exceeded 1018 `max_acceptable_per_rpc_latency_ms` exceeds `soak_max_failures` 1019 1020Implementations should use a timer with sub-millisecond precision to measure 1021latency. Also, implementations should avoid setting RPC deadlines and should 1022instead wait for each RPC to complete. Doing so provides more data for 1023debugging in case of failure. For example, if RPC deadlines are set to 1024`soak_per_iteration_max_acceptable_latency_ms` and one of the RPCs hits that 1025deadline, it's not clear if the RPC was late by a millisecond or a minute. 1026 1027In order to make it easy to analyze results, implementations should log the 1028results of each iteration (i.e. RPC) in a format the matches the following 1029regexes: 1030 1031- Upon success: 1032 - `soak iteration: \d+ elapsed_ms: \d+ peer: \S+ succeeded` 1033 1034- Upon failure: 1035 - `soak iteration: \d+ elapsed_ms: \d+ peer: \S+ failed:` 1036 1037This test must be configurable via a few different command line flags: 1038 1039* `soak_iterations`: Controls the number of RPCs to perform. This should 1040 default to 10. 1041 1042* `soak_max_failures`: An inclusive upper limit on the number of RPC failures 1043 that should be tolerated (i.e. after which the test process should 1044 still exit 0). A failure is considered to be either a non-OK status or an RPC 1045 whose latency exceeds `soak_per_iteration_max_acceptable_latency_ms`. This 1046 should default to 0. 1047 1048* `soak_per_iteration_max_acceptable_latency_ms`: An upper limit on the latency 1049 of a single RPC in order for that RPC to be considered successful. This 1050 should default to 1000. 1051 1052* `soak_overall_timeout_seconds`: The overall number of seconds after which 1053 the test should stop and fail if `soak_iterations` have not yet been 1054 completed. This should default to 1055 `soak_per_iteration_max_acceptable_latency_ms` * `soak_iterations`. 1056 1057* `soak_min_time_ms_between_rpcs`: The minimum time in milliseconds between 1058 consecutive RPCs. Useful for limiting QPS. 1059 1060The following is optional but encouraged to improve debuggability: 1061 1062* Implementations should log the number of milliseconds that each RPC takes. 1063 Additionally, implementations should use a histogram of RPC latencies 1064 to log interesting latency percentiles at the end of the test (e.g. median, 1065 90th, and max latency percentiles). 1066 1067### channel_soak 1068 1069Similar to rpc_soak, but this time each RPC is performed on a new channel. The 1070channel is created just before each RPC and is destroyed just after. 1071 1072This test is configured with the same command line flags that the rpc_soak test 1073is configured with, with only one semantic difference: when measuring an RPCs 1074latency to see if it exceeds `soak_per_iteration_max_acceptable_latency_ms` or 1075not, the creation of the channel should be included in that 1076latency measurement, but the teardown of that channel should **not** be 1077included in that latency measurement (channel teardown semantics differ widely 1078between languages). This latency measurement should also be the value that is 1079logged and recorded in the latency histogram. 1080 1081 1082### orca_per_rpc 1083[orca_per_rpc]: #orca_per_rpc 1084 1085The client verifies that a custom LB policy, which is integrated with ORCA APIs, 1086will receive per-query metric reports from the backend. 1087 1088The client will register the custom LB policy named 1089`test_backend_metrics_load_balancer`, which using ORCA APIs already installed a 1090per-query report listener. The interop-testing client will run with a service 1091config to select the load balancing config (using argument 1092`--service_config_json`), so that it effectively uses this newly registered 1093custom LB policy. A load report reference can be passed from the call to the LB 1094policy through, e.g. CallOptions, to receive metric reports. The LB policy will 1095fill in the reference with the latest load report from the report listener. 1096This way, together with server behaviors we can verify the expected metric 1097reports are received. 1098 1099Server features: 1100* [UnaryCall][] 1101* [Backend Metrics Report][] 1102 1103Procedures: 1104* The client sends a unary request: 1105 ``` 1106 { 1107 orca_per_rpc_report:{ 1108 cpu_utilization: 0.8210 1109 memory_utilization: 0.5847 1110 request_cost: { 1111 cost: 3456.32 1112 } 1113 utilization: { 1114 util: 0.30499 1115 } 1116 } 1117 } 1118 ``` 1119 1120The call carries a reference to receive the load report, e.g. using CallOptions. 1121The reference is passed to the custom LB policy as part of the 1122`OrcaPerRequestReportListener` API. 1123 1124Client asserts: 1125* The call is successful. 1126* The per-query load report reference contains a metrics report that is 1127identical to the metrics data sent in the request shown above. 1128 1129### orca_oob 1130 1131The client verifies that a custom LB policy, which is integrated with ORCA APIs, 1132will receive out-of-band metric reports from the backend. 1133 1134The client will register the custom LB policy named 1135`test_backend_metrics_load_balancer`. It has similar and additional functions as 1136described in the [orca_per_rpc][] test. We use ORCA APIs to install an 1137out-of-band report listener (configure load report interval to be 1s) in the LB 1138policy. The interop-testing client will run with a service config to select the 1139load balancing config(using argument `--service_config_json`), so that it 1140effectively uses this newly registered custom LB policy. A load report reference 1141can be passed from the call to the LB policy through, e.g. CallOptions, to 1142receive metric reports. The test framework will fill in the reference with the 1143latest load report from the report listener. This way, together with server 1144behaviors we can verify the expected metric reports are received. 1145 1146Server features: 1147* [UnaryCall][] 1148* [FullDuplexCall][] 1149* [Backend Metrics Report][] 1150 1151Procedures: 11521. Client starts a full duplex call and sends: 1153 ``` 1154 { 1155 orca_oob_report:{ 1156 cpu_utilization: 0.8210 1157 memory_utilization: 0.5847 1158 utilization: { 1159 util: 0.30499 1160 } 1161 } 1162 response_parameters:{ 1163 size: 1 1164 } 1165 } 1166 ``` 11672. After getting a response, client waits up to 10 seconds (or a total of 30s 1168for the entire test case) to receive an OOB load report that matches the 1169requested load report in step 1. To wait for load report, client may inject a 1170callback to the custom LB policy, or poll the result by doing empty unary call 1171that carries a reference, e.g. using CallOptions, that will be filled in by the 1172custom LB policy as part of the `OrcaOobReportListener` API. 11733. Then client sends: 1174 ``` 1175 { 1176 orca_oob_report:{ 1177 cpu_utilization: 0.29309 1178 memory_utilization: 0.2 1179 utilization: { 1180 util: 0.2039 1181 } 1182 } 1183 response_parameters:{ 1184 size: 1 1185 } 1186 } 1187 ``` 11884. After getting a response, client waits up to 10 seconds (or a total of 30s 1189for the entire test case) to receive an OOB load report that matches the 1190requested load report in step 3. Similar to step 2. 11915. Client half closes the stream, and asserts the streaming call is successful. 1192 1193### Experimental Tests 1194 1195These tests are not yet standardized, and are not yet implemented in all 1196languages. Therefore they are not part of our interop matrix. 1197 1198#### long_lived_channel 1199 1200The client performs a number of large_unary RPCs over a single long-lived 1201channel with a fixed but configurable interval between each RPC. 1202 1203#### concurrent_large_unary 1204 1205Status: TODO 1206 1207Client performs 1000 large_unary tests in parallel on the same channel. 1208 1209#### Flow control. Pushback at client for large messages (TODO: fix name) 1210 1211Status: TODO 1212 1213This test verifies that a client sending faster than a server can drain sees 1214pushback (i.e., attempts to send succeed only after appropriate delays). 1215 1216### TODO Tests 1217 1218#### High priority: 1219 1220Propagation of status code and message (yangg) 1221 1222Multiple thousand simultaneous calls on same Channel (ctiller) 1223 1224Metadata: client headers, server headers + trailers, binary+ascii 1225 1226#### Normal priority: 1227 1228Cancel before start (ctiller) 1229 1230Cancel after sent first message (ctiller) 1231 1232Cancel after received headers (ctiller) 1233 1234Timeout but completed before expire (zhaoq) 1235 1236Multiple thousand simultaneous calls timeout on same Channel (ctiller) 1237 1238#### Lower priority: 1239 1240Flow control. Pushback at client for large messages (abhishek) 1241 1242Flow control. Pushback at server for large messages (abhishek) 1243 1244Going over max concurrent streams doesn't fail (client controls itself) 1245(abhishek) 1246 1247RPC method not implemented (yangg) 1248 1249Multiple thousand simultaneous calls on different Channels (ctiller) 1250 1251Failed TLS hostname verification (ejona?) 1252 1253Large amount of headers to cause CONTINUATIONs; 63K of 'X's, all in one header. 1254 1255#### To priorize: 1256 1257Start streaming RPC but don't send any requests, server responds 1258 1259### Postponed Tests 1260 1261Resilience to buggy servers: These tests would verify that a client application 1262isn't affected negatively by the responses put on the wire by a buggy server 1263(e.g. the client library won't make the application crash). 1264 1265Reconnect after transport failure 1266 1267Reconnect backoff 1268 1269Fuzz testing 1270 1271 1272Server 1273------ 1274 1275Servers implement various named features for clients to test with. Server 1276features are orthogonal. If a server implements a feature, it is always 1277available for clients. Names are simple descriptions for developer 1278communication and tracking. 1279 1280Servers should accept these arguments: 1281 1282* --port=PORT 1283 1284 * The port to listen on. For example, "8080" 1285 1286* --use_tls=BOOLEAN 1287 1288 * Whether to use a plaintext or encrypted connection 1289 1290Servers must support TLS with ALPN. They should use 1291[server1.pem](https://github.com/grpc/grpc/blob/master/src/core/tsi/test_creds/server1.pem) 1292for their certificate. 1293 1294### EmptyCall 1295[EmptyCall]: #emptycall 1296 1297Server implements EmptyCall which immediately returns the empty message. 1298 1299### UnaryCall 1300[UnaryCall]: #unarycall 1301 1302Server implements UnaryCall which immediately returns a SimpleResponse with a 1303payload body of size `SimpleRequest.response_size` bytes and type as appropriate 1304for the `SimpleRequest.response_type`. If the server does not support the 1305`response_type`, then it should fail the RPC with `INVALID_ARGUMENT`. 1306 1307### CacheableUnaryCall 1308[CacheableUnaryCall]: #cacheableunarycall 1309 1310Server gets the default SimpleRequest proto as the request. The content of the 1311request is ignored. It returns the SimpleResponse proto with the payload set 1312to current timestamp. The timestamp is an integer representing current time 1313with nanosecond resolution. This integer is formatted as ASCII decimal in the 1314response. The format is not really important as long as the response payload 1315is different for each request. In addition it adds 1316 1. cache control headers such that the response can be cached by proxies in 1317 the response path. Server should be behind a caching proxy for this test 1318 to pass. Currently we set the max-age to 60 seconds. 1319 1320### CompressedResponse 1321[CompressedResponse]: #compressedresponse 1322 1323When the client sets `response_compressed` to true, the server's response is 1324sent back compressed. Note that `response_compressed` is present on both 1325`SimpleRequest` (unary) and `StreamingOutputCallRequest` (streaming). 1326 1327### CompressedRequest 1328[CompressedRequest]: #compressedrequest 1329 1330When the client sets `expect_compressed` to true, the server expects the client 1331request to be compressed. If it's not, it fails the RPC with `INVALID_ARGUMENT`. 1332Note that `response_compressed` is present on both `SimpleRequest` (unary) and 1333`StreamingOutputCallRequest` (streaming). 1334 1335### StreamingInputCall 1336[StreamingInputCall]: #streaminginputcall 1337 1338Server implements StreamingInputCall which upon half close immediately returns 1339a StreamingInputCallResponse where aggregated_payload_size is the sum of all 1340request payload bodies received. 1341 1342### StreamingOutputCall 1343[StreamingOutputCall]: #streamingoutputcall 1344 1345Server implements StreamingOutputCall by replying, in order, with one 1346StreamingOutputCallResponse for each ResponseParameters in 1347StreamingOutputCallRequest. Each StreamingOutputCallResponse should have a 1348payload body of size ResponseParameters.size bytes, as specified by its 1349respective ResponseParameters. After sending all responses, it closes with OK. 1350 1351### FullDuplexCall 1352[FullDuplexCall]: #fullduplexcall 1353 1354Server implements FullDuplexCall by replying, in order, with one 1355StreamingOutputCallResponse for each ResponseParameters in each 1356StreamingOutputCallRequest. Each StreamingOutputCallResponse should have a 1357payload body of size ResponseParameters.size bytes, as specified by its 1358respective ResponseParameters. After receiving half close and sending all 1359responses, it closes with OK. 1360 1361### Echo Status 1362[Echo Status]: #echo-status 1363When the client sends a response_status in the request payload, the server closes 1364the stream with the status code and message contained within said response_status. 1365The server will not process any further messages on the stream sent by the client. 1366This can be used by clients to verify correct handling of different status codes and 1367associated status messages end-to-end. 1368 1369### Echo Metadata 1370[Echo Metadata]: #echo-metadata 1371When the client sends metadata with the key `"x-grpc-test-echo-initial"` with its 1372request, the server sends back exactly this key and the corresponding value back to 1373the client as part of initial metadata. When the client sends metadata with the key 1374`"x-grpc-test-echo-trailing-bin"` with its request, the server sends back exactly this 1375key and the corresponding value back to the client as trailing metadata. 1376 1377### Observe ResponseParameters.interval_us 1378[Observe ResponseParameters.interval_us]: #observe-responseparametersinterval_us 1379 1380In StreamingOutputCall and FullDuplexCall, server delays sending a 1381StreamingOutputCallResponse by the ResponseParameters' `interval_us` for that 1382particular response, relative to the last response sent. That is, `interval_us` 1383acts like a sleep *before* sending the response and accumulates from one 1384response to the next. 1385 1386Interaction with flow control is unspecified. 1387 1388### Echo Auth Information 1389 1390Status: Pending 1391 1392#### Echo Authenticated Username 1393[Echo Authenticated Username]: #echo-authenticated-username 1394 1395If a SimpleRequest has fill_username=true and that request was successfully 1396authenticated, then the SimpleResponse should have username filled with the 1397canonical form of the authenticated source. The canonical form is dependent on 1398the authentication method, but is likely to be a base 10 integer identifier or 1399an email address. 1400 1401#### Echo OAuth scope 1402[Echo OAuth Scope]: #echo-oauth-scope 1403 1404If a SimpleRequest has `fill_oauth_scope=true` and that request was successfully 1405authenticated via OAuth, then the SimpleResponse should have oauth_scope filled 1406with the scope of the method being invoked. 1407 1408Although a general server-side feature, most test servers won't implement this 1409feature. The TLS server `grpc-test.sandbox.googleapis.com:443` supports this 1410feature. It requires at least the OAuth scope 1411`https://www.googleapis.com/auth/xapi.zoo` for authentication to succeed. 1412 1413Discussion: 1414 1415Ideally, this would be communicated via metadata and not in the 1416request/response, but we want to use this test in code paths that don't yet 1417fully communicate metadata. 1418 1419### Backend metrics report 1420[Backend Metrics Report]: #backend-metrics-report 1421 1422Server reports backend metrics data in both per-query and out-of-band cases, 1423echoing metrics data from the unary or fullDuplex call. 1424 1425Using ORCA APIs we install the per-query metrics reporting server interceptor, 1426so that it can attach metrics per RPC. We also register the `OpenRCAService` 1427implementation to the server, so that it can report metrics periodically. 1428The minimum report interval in the ORCA service is set to 1 sec. 1429 1430If `SimpleRequest.orca_per_rpc_report` is set in unary call, the server will add 1431the metric data from `orca_per_rpc_report` to the RPC using the language's 1432CallMetricRecorder. 1433 1434If `SimpleRequest.orca_oob_report` is set in fullDuplexCall call, the server 1435will first clear all the previous metrics data, and then add utilization metrics 1436from `orca_oob_report` to the `OpenRCAService`. 1437The server implementation should use a lock or similar mechanism to allow only 1438one client to control the server's out-of-band reports until the end of the RPC. 1439