Debian Codegraph @

doc/interop-test-descriptions.md

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