• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 total number of RPCs to execute is controlled by the `soak_iterations`
1009parameter, which defaults to 10. The number of threads used to execute RPCs
1010is controlled by `soak_num_threads`. By default, `soak_num_threads` is set to 1.
1011
1012The client records the latency and status of each RPC in
1013thread-specific data structure, which are later aggregated to form the overall
1014results. If the test ever consumes `soak_overall_timeout_seconds` seconds
1015and still hasn't completed `soak_iterations` RPCs, then the test should
1016discontinue sending RPCs as soon as possible. Each thread should independently
1017track its progress and stop once the overall timeout is reached.
1018
1019After performing all RPCs, the test should examine the previously aggregated RPC
1020latency and status results from all threads in a second pass and fail if either:
1021
1022a) not all `soak_iterations` RPCs were completed across all threads
1023
1024b) the sum of RPCs that either completed with a non-OK status or exceeded
1025   `max_acceptable_per_rpc_latency_ms` exceeds `soak_max_failures`
1026
1027Implementations should use a timer with sub-millisecond precision to measure
1028latency. Also, implementations should avoid setting RPC deadlines and should
1029instead wait for each RPC to complete. Doing so provides more data for
1030debugging in case of failure. For example, if RPC deadlines are set to
1031`soak_per_iteration_max_acceptable_latency_ms` and one of the RPCs hits that
1032deadline, it's not clear if the RPC was late by a millisecond or a minute.
1033
1034In order to make it easy to analyze results, implementations should log the
1035results of each iteration (i.e. RPC) in a format the matches the following
1036regexes:
1037
1038- Upon success:
1039  - `thread_id: \d+ soak iteration: \d+ elapsed_ms: \d+ peer: \S+ server_uri:
1040  \S+ succeeded`
1041
1042- Upon failure:
1043  - `thread_id: \d+ soak iteration: \d+ elapsed_ms: \d+ peer: \S+ server_uri:
1044  \S+ failed`
1045
1046- Thread-specific logs will include the thread_id, helping to track performance
1047  across threads.
1048
1049This test must be configurable via a few different command line flags:
1050
1051* `soak_iterations`: Controls the number of RPCs to perform. This should
1052  default to 10.
1053
1054* `soak_max_failures`: An inclusive upper limit on the number of RPC failures
1055  that should be tolerated (i.e. after which the test process should
1056  still exit 0). A failure is considered to be either a non-OK status or an RPC
1057  whose latency exceeds `soak_per_iteration_max_acceptable_latency_ms`. This
1058  should default to 0.
1059
1060* `soak_per_iteration_max_acceptable_latency_ms`: An upper limit on the latency
1061  of a single RPC in order for that RPC to be considered successful. This
1062  should default to 1000.
1063
1064* `soak_overall_timeout_seconds`: The overall number of seconds after which
1065  the test should stop and fail if `soak_iterations` have not yet been
1066  completed. This should default to
1067  `soak_per_iteration_max_acceptable_latency_ms` * `soak_iterations`.
1068
1069* `soak_min_time_ms_between_rpcs`: The minimum time in milliseconds between
1070  consecutive RPCs. Useful for limiting QPS.
1071
1072* `soak_num_threads`: Specifies the number of threads to use for concurrently
1073  executing the soak test. Each thread performs `soak_iterations / soak_num_threads`
1074  RPCs.
1075
1076This value defaults to 1 (i.e., no concurrency) but can be
1077  increased for concurrent execution. The total soak_iterations must be
1078  divisible by soak_num_threads.
1079
1080The following is optional but encouraged to improve debuggability:
1081
1082* Implementations should log the number of milliseconds that each RPC takes.
1083  Additionally, implementations should use a histogram of RPC latencies
1084  to log interesting latency percentiles at the end of the test (e.g. median,
1085  90th, and max latency percentiles).
1086
1087### channel_soak
1088
1089Similar to rpc_soak, but this time each RPC is performed on a new channel. The
1090channel is created just before each RPC and is destroyed just after.
1091
1092This test is configured with the same command line flags that the rpc_soak test
1093is configured with, with only one semantic difference: when measuring an RPCs
1094latency to see if it exceeds `soak_per_iteration_max_acceptable_latency_ms` or
1095not, the creation of the channel should be included in that
1096latency measurement, but the teardown of that channel should **not** be
1097included in that latency measurement (channel teardown semantics differ widely
1098between languages). This latency measurement should also be the value that is
1099logged and recorded in the latency histogram.
1100
1101### orca_per_rpc
1102[orca_per_rpc]: #orca_per_rpc
1103
1104The client verifies that a custom LB policy, which is integrated with ORCA APIs,
1105will receive per-query metric reports from the backend.
1106
1107The client will register the custom LB policy named
1108`test_backend_metrics_load_balancer`, which using ORCA APIs already installed a
1109per-query report listener. The interop-testing client will run with a service
1110config to select the load balancing config (using argument
1111`--service_config_json`), so that it effectively uses this newly registered
1112custom LB policy. A load report reference can be passed from the call to the LB
1113policy through, e.g. CallOptions, to receive metric reports. The LB policy will
1114fill in the reference with the latest load report from the report listener.
1115This way, together with server behaviors we can verify the expected metric
1116reports are received.
1117
1118Server features:
1119* [UnaryCall][]
1120* [Backend Metrics Report][]
1121
1122Procedures:
1123* The client sends a unary request:
1124    ```
1125    {
1126      orca_per_rpc_report:{
1127        cpu_utilization: 0.8210
1128        memory_utilization: 0.5847
1129        request_cost: {
1130          cost: 3456.32
1131        }
1132        utilization: {
1133          util: 0.30499
1134        }
1135      }
1136    }
1137    ```
1138
1139The call carries a reference to receive the load report, e.g. using CallOptions.
1140The reference is passed to the custom LB policy as part of the
1141`OrcaPerRequestReportListener` API.
1142
1143Client asserts:
1144* The call is successful.
1145* The per-query load report reference contains a metrics report that is
1146identical to the metrics data sent in the request shown above.
1147
1148### orca_oob
1149
1150The client verifies that a custom LB policy, which is integrated with ORCA APIs,
1151will receive out-of-band metric reports from the backend.
1152
1153The client will register the custom LB policy named
1154`test_backend_metrics_load_balancer`. It has similar and additional functions as
1155described in the [orca_per_rpc][] test. We use ORCA APIs to install an
1156out-of-band report listener (configure load report interval to be 1s) in the LB
1157policy. The interop-testing client will run with a service config to select the
1158load balancing config(using argument `--service_config_json`), so that it
1159effectively uses this newly registered custom LB policy. A load report reference
1160can be passed from the call to the LB policy through, e.g. CallOptions, to
1161receive metric reports. The test framework will fill in the reference with the
1162latest load report from the report listener. This way, together with server
1163behaviors we can verify the expected metric reports are received.
1164
1165Server features:
1166* [UnaryCall][]
1167* [FullDuplexCall][]
1168* [Backend Metrics Report][]
1169
1170Procedures:
11711. Client starts a full duplex call and sends:
1172    ```
1173    {
1174      orca_oob_report:{
1175        cpu_utilization: 0.8210
1176        memory_utilization: 0.5847
1177        utilization: {
1178          util: 0.30499
1179        }
1180      }
1181      response_parameters:{
1182        size: 1
1183      }
1184    }
1185    ```
11862. After getting a response, client waits up to 10 seconds (or a total of 30s
1187for the entire test case) to receive an OOB load report that matches the
1188requested load report in step 1. To wait for load report, client may inject a
1189callback to the custom LB policy, or poll the result by doing empty unary call
1190that carries a reference, e.g. using CallOptions, that will be filled in by the
1191custom LB policy as part of the `OrcaOobReportListener` API.
11923. Then client sends:
1193    ```
1194    {
1195      orca_oob_report:{
1196        cpu_utilization: 0.29309
1197        memory_utilization: 0.2
1198        utilization: {
1199          util: 0.2039
1200        }
1201      }
1202      response_parameters:{
1203        size: 1
1204      }
1205    }
1206    ```
12074. After getting a response, client waits up to 10 seconds (or a total of 30s
1208for the entire test case) to receive an OOB load report that matches the
1209requested load report in step 3. Similar to step 2.
12105. Client half closes the stream, and asserts the streaming call is successful.
1211
1212### Experimental Tests
1213
1214These tests are not yet standardized, and are not yet implemented in all
1215languages. Therefore they are not part of our interop matrix.
1216
1217#### long_lived_channel
1218
1219The client performs a number of large_unary RPCs over a single long-lived
1220channel with a fixed but configurable interval between each RPC.
1221
1222#### concurrent_large_unary
1223
1224Status: TODO
1225
1226Client performs 1000 large_unary tests in parallel on the same channel.
1227
1228#### Flow control. Pushback at client for large messages (TODO: fix name)
1229
1230Status: TODO
1231
1232This test verifies that a client sending faster than a server can drain sees
1233pushback (i.e., attempts to send succeed only after appropriate delays).
1234
1235### TODO Tests
1236
1237#### High priority:
1238
1239Propagation of status code and message (yangg)
1240
1241Multiple thousand simultaneous calls on same Channel (ctiller)
1242
1243Metadata: client headers, server headers + trailers, binary+ascii
1244
1245#### Normal priority:
1246
1247Cancel before start (ctiller)
1248
1249Cancel after sent first message (ctiller)
1250
1251Cancel after received headers (ctiller)
1252
1253Timeout but completed before expire (zhaoq)
1254
1255Multiple thousand simultaneous calls timeout on same Channel (ctiller)
1256
1257#### Lower priority:
1258
1259Flow control. Pushback at client for large messages (abhishek)
1260
1261Flow control. Pushback at server for large messages (abhishek)
1262
1263Going over max concurrent streams doesn't fail (client controls itself)
1264(abhishek)
1265
1266RPC method not implemented (yangg)
1267
1268Multiple thousand simultaneous calls on different Channels (ctiller)
1269
1270Failed TLS hostname verification (ejona?)
1271
1272Large amount of headers to cause CONTINUATIONs; 63K of 'X's, all in one header.
1273
1274#### To priorize:
1275
1276Start streaming RPC but don't send any requests, server responds
1277
1278### Postponed Tests
1279
1280Resilience to buggy servers: These tests would verify that a client application
1281isn't affected negatively by the responses put on the wire by a buggy server
1282(e.g. the client library won't make the application crash).
1283
1284Reconnect after transport failure
1285
1286Reconnect backoff
1287
1288Fuzz testing
1289
1290
1291Server
1292------
1293
1294Servers implement various named features for clients to test with. Server
1295features are orthogonal. If a server implements a feature, it is always
1296available for clients. Names are simple descriptions for developer
1297communication and tracking.
1298
1299Servers should accept these arguments:
1300
1301* --port=PORT
1302
1303    * The port to listen on. For example, "8080"
1304
1305* --use_tls=BOOLEAN
1306
1307    * Whether to use a plaintext or encrypted connection
1308
1309Servers that want to be used for dual stack testing must accept this argument:
1310
1311* --address_type=IPV4|IPV6|IPV4_IPV6
1312
1313    * What type of addresses to listen on. Default IPV4_IPV6
1314
1315Servers must support TLS with ALPN. They should use
1316[server1.pem](https://github.com/grpc/grpc/blob/master/src/core/tsi/test_creds/server1.pem)
1317for their certificate.
1318
1319### EmptyCall
1320[EmptyCall]: #emptycall
1321
1322Server implements EmptyCall which immediately returns the empty message.
1323
1324### UnaryCall
1325[UnaryCall]: #unarycall
1326
1327Server implements UnaryCall which immediately returns a SimpleResponse with a
1328payload body of size `SimpleRequest.response_size` bytes and type as appropriate
1329for the `SimpleRequest.response_type`. If the server does not support the
1330`response_type`, then it should fail the RPC with `INVALID_ARGUMENT`.
1331
1332### CacheableUnaryCall
1333[CacheableUnaryCall]: #cacheableunarycall
1334
1335Server gets the default SimpleRequest proto as the request. The content of the
1336request is ignored. It returns the SimpleResponse proto with the payload set
1337to current timestamp.  The timestamp is an integer representing current time
1338with nanosecond resolution. This integer is formatted as ASCII decimal in the
1339response. The format is not really important as long as the response payload
1340is different for each request. In addition it adds
1341  1. cache control headers such that the response can be cached by proxies in
1342     the response path. Server should be behind a caching proxy for this test
1343     to pass. Currently we set the max-age to 60 seconds.
1344
1345### CompressedResponse
1346[CompressedResponse]: #compressedresponse
1347
1348When the client sets `response_compressed` to true, the server's response is
1349sent back compressed. Note that `response_compressed` is present on both
1350`SimpleRequest` (unary) and `StreamingOutputCallRequest` (streaming).
1351
1352### CompressedRequest
1353[CompressedRequest]: #compressedrequest
1354
1355When the client sets `expect_compressed` to true, the server expects the client
1356request to be compressed. If it's not, it fails the RPC with `INVALID_ARGUMENT`.
1357Note that `response_compressed` is present on both `SimpleRequest` (unary) and
1358`StreamingOutputCallRequest` (streaming).
1359
1360### StreamingInputCall
1361[StreamingInputCall]: #streaminginputcall
1362
1363Server implements StreamingInputCall which upon half close immediately returns
1364a StreamingInputCallResponse where aggregated_payload_size is the sum of all
1365request payload bodies received.
1366
1367### StreamingOutputCall
1368[StreamingOutputCall]: #streamingoutputcall
1369
1370Server implements StreamingOutputCall by replying, in order, with one
1371StreamingOutputCallResponse for each ResponseParameters in
1372StreamingOutputCallRequest. Each StreamingOutputCallResponse should have a
1373payload body of size ResponseParameters.size bytes, as specified by its
1374respective ResponseParameters. After sending all responses, it closes with OK.
1375
1376### FullDuplexCall
1377[FullDuplexCall]: #fullduplexcall
1378
1379Server implements FullDuplexCall by replying, in order, with one
1380StreamingOutputCallResponse for each ResponseParameters in each
1381StreamingOutputCallRequest. Each StreamingOutputCallResponse should have a
1382payload body of size ResponseParameters.size bytes, as specified by its
1383respective ResponseParameters. After receiving half close and sending all
1384responses, it closes with OK.
1385
1386### Echo Status
1387[Echo Status]: #echo-status
1388When the client sends a response_status in the request payload, the server closes
1389the stream with the status code and message contained within said response_status.
1390The server will not process any further messages on the stream sent by the client.
1391This can be used by clients to verify correct handling of different status codes and
1392associated status messages end-to-end.
1393
1394### Echo Metadata
1395[Echo Metadata]: #echo-metadata
1396When the client sends metadata with the key `"x-grpc-test-echo-initial"` with its
1397request, the server sends back exactly this key and the corresponding value back to
1398the client as part of initial metadata. When the client sends metadata with the key
1399`"x-grpc-test-echo-trailing-bin"` with its request, the server sends back exactly this
1400key and the corresponding value back to the client as trailing metadata.
1401
1402### Observe ResponseParameters.interval_us
1403[Observe ResponseParameters.interval_us]: #observe-responseparametersinterval_us
1404
1405In StreamingOutputCall and FullDuplexCall, server delays sending a
1406StreamingOutputCallResponse by the ResponseParameters' `interval_us` for that
1407particular response, relative to the last response sent. That is, `interval_us`
1408acts like a sleep *before* sending the response and accumulates from one
1409response to the next.
1410
1411Interaction with flow control is unspecified.
1412
1413### Echo Auth Information
1414
1415Status: Pending
1416
1417#### Echo Authenticated Username
1418[Echo Authenticated Username]: #echo-authenticated-username
1419
1420If a SimpleRequest has fill_username=true and that request was successfully
1421authenticated, then the SimpleResponse should have username filled with the
1422canonical form of the authenticated source. The canonical form is dependent on
1423the authentication method, but is likely to be a base 10 integer identifier or
1424an email address.
1425
1426#### Echo OAuth scope
1427[Echo OAuth Scope]: #echo-oauth-scope
1428
1429If a SimpleRequest has `fill_oauth_scope=true` and that request was successfully
1430authenticated via OAuth, then the SimpleResponse should have oauth_scope filled
1431with the scope of the method being invoked.
1432
1433Although a general server-side feature, most test servers won't implement this
1434feature. The TLS server `grpc-test.sandbox.googleapis.com:443` supports this
1435feature. It requires at least the OAuth scope
1436`https://www.googleapis.com/auth/xapi.zoo` for authentication to succeed.
1437
1438Discussion:
1439
1440Ideally, this would be communicated via metadata and not in the
1441request/response, but we want to use this test in code paths that don't yet
1442fully communicate metadata.
1443
1444### Backend metrics report
1445[Backend Metrics Report]: #backend-metrics-report
1446
1447Server reports backend metrics data in both per-query and out-of-band cases,
1448echoing metrics data from the unary or fullDuplex call.
1449
1450Using ORCA APIs we install the per-query metrics reporting server interceptor,
1451so that it can attach metrics per RPC. We also register the `OpenRCAService`
1452implementation to the server, so that it can report metrics periodically.
1453The minimum report interval in the ORCA service is set to 1 sec.
1454
1455If `SimpleRequest.orca_per_rpc_report` is set in unary call, the server will add
1456the metric data from `orca_per_rpc_report` to the RPC using the language's
1457CallMetricRecorder.
1458
1459If `SimpleRequest.orca_oob_report` is set in fullDuplexCall call, the server
1460will first clear all the previous metrics data, and then add utilization metrics
1461from `orca_oob_report` to the `OpenRCAService`.
1462The server implementation should use a lock or similar mechanism to allow only
1463one client to control the server's out-of-band reports until the end of the RPC.
1464