xref: /aosp_15_r20/external/grpc-grpc/doc/xds-test-descriptions.md (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
1# xDS (Load-Balancing) Interop Test Case Descriptions
2
3Client and server use [test.proto](../src/proto/grpc/testing/test.proto).
4
5## Server
6
7The code for the xDS test server can be found at:
8[Java](https://github.com/grpc/grpc-java/blob/master/interop-testing/src/main/java/io/grpc/testing/integration/XdsTestServer.java) (other language implementations are in progress).
9
10Server should accept these arguments:
11
12*   --port=PORT
13    *   The port the test server will run on.
14*   --maintenance_port=PORT
15    *   The port for the maintenance server running health, channelz, and admin(CSDS) services.
16*   --secure_mode=BOOLEAN
17    *   When set to true it uses XdsServerCredentials with the test server for security test cases.
18        In case of secure mode, port and maintenance_port should be different.
19
20In addition, when handling requests, if the initial request metadata contains the `rpc-behavior` key, it should modify its handling of the request as follows:
21
22 - If the value matches `sleep-<int>`, the server should wait the specified number of seconds before resuming behavior matching and RPC processing.
23 - If the value matches `keep-open`, the server should never respond to the request and behavior matching ends.
24 - If the value matches `error-code-<int>`, the server should respond with the specified status code and behavior matching ends.
25 - If the value matches `succeed-on-retry-attempt-<int>`, and the value of the `grpc-previous-rpc-attempts` metadata field is equal to the specified number, the normal RPC processing should resume and behavior matching ends.
26 - A value can have a prefix `hostname=<string>` followed by a space. In that case, the rest of the value should only be applied if the specified hostname matches the server's hostname.
27
28The `rpc-behavior` header value can have multiple options separated by commas. In that case, the value should be split by commas and the options should be applied in the order specified. If a request has multiple `rpc-behavior` metadata values, each one should be processed that way in order.
29
30## Client
31
32The base behavior of the xDS test client is to send a constant QPS of unary
33messages and record the remote-peer distribution of the responses. Further, the
34client must expose an implementation of the `LoadBalancerStatsService` gRPC
35service to allow the test driver to validate the load balancing behavior for a
36particular test case (see below for more details).
37
38The code for the xDS test client can be at:
39[Java](https://github.com/grpc/grpc-java/blob/master/interop-testing/src/main/java/io/grpc/testing/integration/XdsTestClient.java) (other language implementations are in progress).
40
41Clients should accept these arguments:
42
43*   --fail_on_failed_rpcs=BOOL
44    *   If true, the client should exit with a non-zero return code if any RPCs
45        fail after at least one RPC has succeeded, indicating a valid xDS config
46        was received. This accounts for any startup-related delays in receiving
47        an initial config from the load balancer. Default is false.
48*   --num_channels=CHANNELS
49    *   The number of channels to create to the server.
50*   --qps=QPS
51    *   The QPS per channel.
52*   --server=HOSTNAME:PORT
53    *   The server host to connect to. For example, "localhost:8080"
54*   --stats_port=PORT
55    *   The port for to expose the client's `LoadBalancerStatsService`
56        implementation.
57*   --rpc_timeout_sec=SEC
58    *   The timeout to set on all outbound RPCs. Default is 20.
59*   --secure_mode=BOOLEAN
60    *   When set to true it uses XdsChannelCredentials with the test client for security test cases.
61
62### XdsUpdateClientConfigureService
63
64The xDS test client's behavior can be dynamically changed in the middle of tests.
65This is achieved by invoking the `XdsUpdateClientConfigureService` gRPC service
66on the test client. This can be useful for tests requiring special client behaviors
67that are not desirable at test initialization and client warmup. The service is
68defined as:
69
70```
71message ClientConfigureRequest {
72  // Type of RPCs to send.
73  enum RpcType {
74    EMPTY_CALL = 0;
75    UNARY_CALL = 1;
76  }
77
78  // Metadata to be attached for the given type of RPCs.
79  message Metadata {
80    RpcType type = 1;
81    string key = 2;
82    string value = 3;
83  }
84
85  // The types of RPCs the client sends.
86  repeated RpcType types = 1;
87  // The collection of custom metadata to be attached to RPCs sent by the client.
88  repeated Metadata metadata = 2;
89  // The deadline to use, in seconds, for all RPCs.  If unset or zero, the
90  // client will use the default from the command-line.
91  int32 timeout_sec = 3;
92}
93
94message ClientConfigureResponse {}
95
96service XdsUpdateClientConfigureService {
97  // Update the tes client's configuration.
98  rpc Configure(ClientConfigureRequest) returns (ClientConfigureResponse);
99}
100```
101
102The test client changes its behavior right after receiving the
103`ClientConfigureRequest`. Currently it only supports configuring the type(s)
104of RPCs sent by the test client, metadata attached to each type of RPCs, and the timeout.
105
106## Test Driver
107
108Note that, unlike our other interop tests, neither the client nor the server has
109any notion of which of the following test scenarios is under test. Instead, a
110separate test driver is responsible for configuring the load balancer and the
111server backends, running the client, and then querying the client's
112`LoadBalancerStatsService` to validate load balancer behavior for each of the
113tests described below.
114
115## LoadBalancerStatsService
116
117The service is defined as:
118
119```
120message LoadBalancerStatsRequest {
121  // Request stats for the next num_rpcs sent by client.
122  int32 num_rpcs = 1;
123  // If num_rpcs have not completed within timeout_sec, return partial results.
124  int32 timeout_sec = 2;
125}
126
127message LoadBalancerStatsResponse {
128  message RpcsByPeer {
129    // The number of completed RPCs for each peer.
130    map<string, int32> rpcs_by_peer = 1;
131  }
132  // The number of completed RPCs for each peer.
133  map<string, int32> rpcs_by_peer = 1;
134  // The number of RPCs that failed to record a remote peer.
135  int32 num_failures = 2;
136  map<string, RpcsByPeer> rpcs_by_method = 3;
137}
138
139message LoadBalancerAccumulatedStatsRequest {}
140
141message LoadBalancerAccumulatedStatsResponse {
142  // The total number of RPCs have ever issued for each type.
143  // Deprecated: use stats_per_method.rpcs_started instead.
144  map<string, int32> num_rpcs_started_by_method = 1 [deprecated = true];
145  // The total number of RPCs have ever completed successfully for each type.
146  // Deprecated: use stats_per_method.result instead.
147  map<string, int32> num_rpcs_succeeded_by_method = 2 [deprecated = true];
148  // The total number of RPCs have ever failed for each type.
149  // Deprecated: use stats_per_method.result instead.
150  map<string, int32> num_rpcs_failed_by_method = 3 [deprecated = true];
151
152  message MethodStats {
153    // The number of RPCs that were started for this method.
154    int32 rpcs_started = 1;
155
156    // The number of RPCs that completed with each status for this method.  The
157    // key is the integral value of a google.rpc.Code; the value is the count.
158    map<int32, int32> result = 2;
159  }
160
161  // Per-method RPC statistics.  The key is the RpcType in string form; e.g.
162  // 'EMPTY_CALL' or 'UNARY_CALL'
163  map<string, MethodStats> stats_per_method = 4;
164}
165
166service LoadBalancerStatsService {
167  // Gets the backend distribution for RPCs sent by a test client.
168  rpc GetClientStats(LoadBalancerStatsRequest)
169      returns (LoadBalancerStatsResponse) {}
170  // Gets the accumulated stats for RPCs sent by a test client.
171  rpc GetClientAccumulatedStats(LoadBalancerAccumulatedStatsRequest)
172      returns (LoadBalancerAccumulatedStatsResponse) {}
173}
174```
175
176Note that the `LoadBalancerStatsResponse` contains the remote peer distribution
177of the next `num_rpcs` *sent* by the client after receiving the
178`LoadBalancerStatsRequest`. It is important that the remote peer distribution be
179recorded for a block of consecutive outgoing RPCs, to validate the intended
180distribution from the load balancer, rather than just looking at the next
181`num_rpcs` responses received from backends, as different backends may respond
182at different rates.
183
184## Test Cases
185
186### ping_pong
187
188This test verifies that every backend receives traffic.
189
190Client parameters:
191
1921.  --num_channels=1
1931.  --qps=100
1941.  --fail_on_failed_rpc=true
195
196Load balancer configuration:
197
1981.  4 backends are created in a single managed instance group (MIG).
199
200Test driver asserts:
201
2021.  All backends receive at least one RPC
203
204### round_robin
205
206This test verifies that RPCs are evenly routed according to an unweighted round
207robin policy.
208
209Client parameters:
210
2111.  --num_channels=1
2121.  --qps=100
2131.  --fail_on_failed_rpc=true
214
215Load balancer configuration:
216
2171.  4 backends are created in a single MIG.
218
219Test driver asserts that:
220
2211.  Once all backends receive at least one RPC, the following 100 RPCs are
222    evenly distributed across the 4 backends.
223
224### backends_restart
225
226This test verifies that the load balancer will resume sending traffic to a set
227of backends that is stopped and then resumed.
228
229Client parameters:
230
2311.  --num_channels=1
2321.  --qps=100
233
234Load balancer configuration:
235
2361.  4 backends are created in a single MIG.
237
238Test driver asserts:
239
2401.  All backends receive at least one RPC.
241
242The test driver records the peer distribution for a subsequent block of 100 RPCs
243then stops the backends.
244
245Test driver asserts:
246
2471.  No RPCs from the client are successful.
248
249The test driver resumes the backends.
250
251Test driver asserts:
252
2531.  Once all backends receive at least one RPC, the distribution for a block of
254    100 RPCs is the same as the distribution recorded prior to restart.
255
256### secondary_locality_gets_requests_on_primary_failure
257
258This test verifies that backends in a secondary locality receive traffic when
259all backends in the primary locality fail.
260
261Client parameters:
262
2631.  --num_channels=1
2641.  --qps=100
265
266Load balancer configuration:
267
2681.  The primary MIG with 2 backends in the same zone as the client
2691.  The secondary MIG with 2 backends in a different zone
270
271Test driver asserts:
272
2731.  All backends in the primary locality receive at least 1 RPC.
2741.  No backends in the secondary locality receive RPCs.
275
276The test driver stops the backends in the primary locality.
277
278Test driver asserts:
279
2801.  All backends in the secondary locality receive at least 1 RPC.
281
282The test driver resumes the backends in the primary locality.
283
284Test driver asserts:
285
2861.  All backends in the primary locality receive at least 1 RPC.
2871.  No backends in the secondary locality receive RPCs.
288
289### secondary_locality_gets_no_requests_on_partial_primary_failure
290
291This test verifies that backends in a failover locality do not receive traffic
292when at least one of the backends in the primary locality remain healthy.
293
294**Note:** Future TD features may change the expected behavior and require
295changes to this test case.
296
297Client parameters:
298
2991.  --num_channels=1
3001.  --qps=100
301
302Load balancer configuration:
303
3041.  The primary MIG with 2 backends in the same zone as the client
3051.  The secondary MIG with 2 backends in a different zone
306
307Test driver asserts:
308
3091.  All backends in the primary locality receive at least 1 RPC.
3101.  No backends in the secondary locality receive RPCs.
311
312The test driver stops one of the backends in the primary locality.
313
314Test driver asserts:
315
3161.  All backends in the primary locality receive at least 1 RPC.
3171.  No backends in the secondary locality receive RPCs.
318
319### remove_instance_group
320
321This test verifies that a remaining instance group can successfully serve RPCs
322after removal of another instance group in the same zone.
323
324Client parameters:
325
3261.  --num_channels=1
3271.  --qps=100
328
329Load balancer configuration:
330
3311.  Two MIGs with two backends each, using rate balancing mode.
332
333Test driver asserts:
334
3351.  All backends receive at least one RPC.
336
337The test driver removes one MIG.
338
339Test driver asserts:
340
3411.  All RPCs are directed to the two remaining backends (no RPC failures).
342
343### change_backend_service
344
345This test verifies that the backend service can be replaced and traffic routed
346to the new backends.
347
348Client parameters:
349
3501.  --num_channels=1
3511.  --qps=100
3521.  --fail_on_failed_rpc=true
353
354Load balancer configuration:
355
3561.  One MIG with two backends
357
358Test driver asserts:
359
3601.  All backends receive at least one RPC.
361
362The test driver creates a new backend service containing a MIG with two backends
363and changes the TD URL map to point to this new backend service.
364
365Test driver asserts:
366
3671.  All RPCs are directed to the new backend service.
368
369### traffic_splitting
370
371This test verifies that the traffic will be distributed between backend
372services with the correct weights when route action is set to weighted
373backend services.
374
375Client parameters:
376
3771.  --num_channels=1
3781.  --qps=100
379
380Load balancer configuration:
381
3821.  One MIG with one backend
383
384Assert:
385
3861. Once all backends receive at least one RPC, the following 1000 RPCs are
387all sent to MIG_a.
388
389The test driver adds a new MIG with 1 backend, and changes the route action
390to weighted backend services with {a: 20, b: 80}.
391
392Assert:
393
3941. Once all backends receive at least one RPC, the following 1000 RPCs are
395distributed across the 2 backends as a: 20, b: 80.
396### path_matching
397
398This test verifies that the traffic for a certain RPC can be routed to a
399specific cluster based on the RPC path.
400
401Client parameters:
402
4031.  –num_channels=1
4041.  –qps=10
4051.  –fail_on_failed_rpc=true
4061.  –rpc=“EmptyCall,UnaryCall”
407
408Load balancer configuration:
409
4101.  2 MIGs, each with 1 backend
4111.  routes
412    - “/”: MIG_default
413
414Assert:
415
4161.  UnaryCall RPCs are sent to MIG_default
4171.  EmptyCall RPCs are sent to MIG_default
418
419The test driver changes route and asserts RPCs are sent to expected backends. **Note** that the default route `"/"` is always pointing to MIG_default, so all RPCs not matching the new route will be sent to MIG_default.
420
421- {path: `/grpc.testing.TestService/EmptyCall`}: MIG_2
422  - UnaryCall -> MIG_default
423  - EmptyCall -> MIG_2
424
425- {prefix: `/grpc.testing.TestService/Unary`}: MIG_2
426  - UnaryCall -> MIG_2
427  - EmptyCall -> MIG_default
428
429- {prefix: `/grpc.testing.TestService/Unary`}: MIG_default & {path: `/grpc.testing.TestService/EmptyCall`}: MIG_2
430  - UnaryCall -> MIG_default
431  - EmptyCall -> MIG_2
432
433- {regex: `^\/.*\/UnaryCall$`}: MIG_2
434  - UnaryCall -> MIG_2
435  - EmptyCall -> MIG_default
436
437- {path: `/gRpC.tEsTinG.tEstseRvice/empTycaLl`, ignoreCase: `True`}: MIG_2
438  - UnaryCall -> MIG_default
439  - EmptyCall -> MIG_2
440
441### header_matching
442
443This test verifies that the traffic for a certain RPC can be routed to a
444specific cluster based on the RPC header (metadata).
445
446Client parameters:
447
4481.  –num_channels=1
4491.  –qps=10
4501.  –fail_on_failed_rpc=true
4511.  –rpc=“EmptyCall,UnaryCall”
4521.  –rpc=“EmptyCall:xds_md:exact_match”
453
454Load balancer configuration:
455
4561.  2 MIGs, each with 1 backend
4571.  routes
458    - “/”: MIG_default
459
460Assert:
461
4621.  UnaryCall RPCs are sent to MIG_default
4631.  EmptyCall RPCs are sent to MIG_default
464
465The test driver changes route and asserts RPCs are sent to expected backends. **Note** that the default route `"/"` is always pointing to MIG_default, so all RPCs not matching the new route will be sent to MIG_default.
466
467- {header `xds_md`, exact: `empty_ytpme`}: MIG_2
468	- Unary -> MIG_default
469	- Empty -> MIG_2
470
471- {header `xds_md`, prefix: `un`}: MIG_2
472	- `un` is the prefix of metadata sent with UnaryCall
473	- Unary -> MIG_2
474	- Empty -> MIG_default
475
476- {header `xds_md`, suffix: `me`}: MIG_2
477	- `me` is the suffix of metadata sent with EmptyCall
478	- Unary -> MIG_default
479	- Empty to MIG_2
480
481- {header `xds_md_numeric`, present: `True`}: MIG_2
482	- Unary is sent with the metadata, so will be sent to alternative
483	- Unary -> MIG_2
484	- Empty -> MIG_default
485
486- {header `xds_md`, exact: `unary_yranu`, invert: `True`}: MIG_2
487	- Unary is sent with the metadata, so this will not match Unary, but will match Empty
488	- Unary -> MIG_default
489	- Empty to MIG_2
490
491- {header `xds_md_numeric`, range `[100,200]`}: MIG_2
492	- Unary is sent with the metadata in range
493	- Unary -> MIG_2
494	- Empty -> MIG_default
495
496- {header `xds_md`, regex: `^em.*me$`}: MIG_2
497	- EmptyCall is sent with the metadata
498	- Unary -> MIG_default
499	- Empty -> MIG_2
500
501### gentle_failover
502
503This test verifies that traffic is partially diverted to a secondary locality
504when > 50% of the instances in the primary locality are unhealthy.
505
506Client parameters:
507
5081.  --num_channels=1
5091.  --qps=100
510
511Load balancer configuration:
512
5131.  The primary MIG with 3 backends in the same zone as the client
5141.  The secondary MIG with 2 backends in a different zone
515
516Test driver asserts:
517
5181.  All backends in the primary locality receive at least 1 RPC.
5191.  No backends in the secondary locality receive RPCs.
520
521The test driver stops 2 of 3 backends in the primary locality.
522
523Test driver asserts:
524
5251.  All backends in the secondary locality receive at least 1 RPC.
5261.  The remaining backend in the primary locality receives at least 1 RPC.
527
528The test driver resumes the backends in the primary locality.
529
530Test driver asserts:
531
5321.  All backends in the primary locality receive at least 1 RPC.
5331.  No backends in the secondary locality receive RPCs.
534
535
536### load_based_failover
537
538This test verifies that traffic is partially diverted to a secondary locality
539when the QPS is greater than the configured RPS in the priority locality.
540
541Client parameters:
542
5431.  --num_channels=1
5441.  --qps=100
545
546Load balancer configuration:
547
5481.  The primary MIG with 2 backends in the same zone as the client
5491.  The secondary MIG with 2 backends in a different zone
550
551Test driver asserts:
552
5531.  All backends in the primary locality receive at least 1 RPC.
5541.  No backends in the secondary locality receive RPCs.
555
556The test driver sets `balancingMode` is `RATE`, and `maxRate` to 20 in the primary locality.
557
558Test driver asserts:
559
5601.  All backends in the primary locality receive at least 1 RPC.
5611.  All backends in the secondary locality receive at least 1 RPC.
562
563The test driver set `maxRate` to 120 in the primary locality.
564
565Test driver asserts:
566
5671.  All backends in the primary locality receive at least 1 RPC.
5681.  No backends in the secondary locality receive RPCs.
569
570
571### circuit_breaking
572
573This test verifies that the maximum number of outstanding requests is limited
574by circuit breakers of the backend service.
575
576Client parameters:
577
5781.  --num_channels=1
5791.  --qps=100
580
581Load balancer configuration:
582
5831.  Two MIGs with each having two backends.
584
585The test driver configures the backend services with:
586
5871. path{“/grpc.testing.TestService/UnaryCall"}: MIG_1
5881. path{“/grpc.testing.TestService/EmptyCall"}: MIG_2
5891. MIG_1 circuit_breakers with max_requests = 500
5901. MIG_2 circuit breakers with max_requests = 1000
591
592The test driver configures the test client to send both UnaryCall and EmptyCall,
593with all RPCs keep-open.
594
595Assert:
596
5971.  After reaching steady state, there are 500 UnaryCall RPCs in-flight
598and 1000 EmptyCall RPCs in-flight.
599
600The test driver updates MIG_1's circuit breakers with max_request = 800.
601
602Test driver asserts:
603
6041.  After reaching steady state, there are 800 UnaryCall RPCs in-flight.
605
606### timeout
607
608This test verifies that traffic along a route with a `max_stream_duration` set
609will cause timeouts on streams open longer than that duration.
610
611Client parameters:
612
6131. `--num_channels=1`
6141. `--qps=100`
615
616Route Configuration:
617
618Two routes:
619
6201. Path match for `/grpc.testing.TestService/UnaryCall`, with a `route_action`
621   containing `max_stream_duration` of 3 seconds.
6221. Default route containing no `max_stream_duration` setting.
623
624There are four sub-tests:
625
6261. `app_timeout_exceeded`
627   1. Test client configured to send UnaryCall RPCs with a 1s application
628      timeout, and metadata of `rpc-behavior: sleep-2`.
629   1. Test driver asserts client recieves ~100% status `DEADLINE_EXCEEDED`.
6301. `timeout_not_exceeded`
631   1. Test client configured to send UnaryCall RPCs with the default
632      application timeout (20 seconds), and no metadata.
633   1. Test driver asserts client recieves ~100% status `OK`.
6341. `timeout_exceeded` (executed with the below test case)
6351. `timeout_different_route`
636   1. Test client configured to send UnaryCall RPCs and EmptyCall RPCs with
637      the default application timeout (20 seconds), and metadata of
638      `rpc-behavior: sleep-4`.
639   1. Test driver asserts client recieves ~100% status `OK` for EmptyCall
640      and ~100% status `DEADLINE_EXCEEDED` for UnaryCall.
641
642### api_listener
643The test case verifies a specific use case where it creates a second TD API
644listener using the same name as the existing one and then delete the old one.
645The test driver verifies this is a safe way to update the API listener
646configuration while keep using the existing name.
647
648Client parameters:
649
6501.  --num_channels=1
6511.  --qps=100
652
653Load balancer configuration:
654
6551.  One MIG with two backends.
656
657Assert:
658
659The test driver configuration steps:
6601. The test driver creates the first set of forwarding rule + target proxy +
661URL map with a test host name.
6621. Then the test driver creates a second set of forwarding rule + target proxy +
663URL map with the same test host name.
6641. The test driver deletes the first set of configurations in step 1.
665
666The test driver verifies, at each configuration step, the traffic is always able
667to reach the designated hosts.
668
669### metadata_filter
670This test case verifies that metadata filter configurations in URL map match
671rule are effective at Traffic Director for routing selection against downstream
672node metadata.
673
674Client parameters:
675
6761.  --num_channels=1
6771.  --qps=100
678
679Load balancer configuration:
680
6811.  Two MIGs in the same zone, each having two backends.
682
683There are four test sub-cases:
6841. Test `MATCH_ALL` metadata filter criteria.
6851. Test `MATCH_ANY` metadata filter criteria.
6861. Test mixed `MATCH_ALL` and `MATCH_ANY` metadata filter criteria.
6871. Test when multiple match rules with metadata filter all match.
688
689Assert:
690
691At each test sub-case described above, the test driver configures
692and verifies:
693
6941. Set default URL map, and verify traffic goes to the original backend hosts.
6951. Then patch URL map to update the match rule with metadata filter
696configuration under test added.
6971. Then it verifies traffic switches to alternate backend service hosts.
698
699This way, we test that TD correctly evaluates both matching and non-matching
700configuration scenario.
701
702### forwarding_rule_port_match
703This test verifies that request server uri port should match with the GCP
704forwarding rule configuration port.
705
706Client parameters:
707
7081.  --num_channels=1
7091.  --qps=100
710
711Load balancer configuration:
712
7131.  One MIG with two backends.
714
715Assert:
7161. The test driver configures matching port in the forwarding rule and in the
717request server uri, then verifies traffic reaches backend service instances.
7181. The test driver updates the forwarding rule to use a different port, then
719verifies that the traffic stops going to those backend service instances.
720
721### forwarding_rule_default_port
722This test verifies that omitting port in the request server uri should only
723match with the default port(80) configuration in the forwarding rule.
724In addition, request server uri port should exactly match that in the URL map
725host rule, as described in
726[public doc](https://cloud.google.com/traffic-director/docs/proxyless-overview#proxyless-url-map).
727
728Client parameters:
729
7301.  --num_channels=1
7311.  --qps=100
732
733Load balancer configuration:
734
7351.  One MIG with two backends.
736
737Assert:
738
739Test driver configures and verifies:
7401. No traffic goes to backends when configuring the target URI
741`xds:///myservice`, the forwarding rule with port *x != 80*, the URL map
742host rule `myservice::x`.
7431. Traffic goes to backends when configuring the target URI `xds:///myservice`,
744the forwarding rule port `80` and the URL map host rule `myservice`.
7451. No traffic goes to backends when configuring the target URI
746`xds:///myservice`, the forwarding rule port `80` and the host rule
747`myservice::80`.
748
749### outlier_detection
750This test verifies that the client applies the outlier detection configuration
751and temporarily drops traffic to a server that fails requests.
752
753Client parameters:
754
7551.  --num_channels=1
7562.  --qps=100
757
758Load balancer configuration:
759
7601.  One MIG with five backends, with a `backendService` configuration with the
761    following `outlierDetection` entry
762    ```json
763    {
764      "interval": {
765        "seconds": 2,
766        "nanos": 0
767      },
768      "successRateRequestVolume": 20
769    }
770    ```
771Assert:
772
7731.  The test driver asserts that traffic is equally distribted among the
774five backends, and all requests end with the `OK` status.
7752.  The test driver chooses one of the five backends to fail requests, and
776configures the client to send the metadata
777`rpc-behavior: hostname=<chosen backend> error-code-2`. The driver asserts
778that during some 10-second interval, all traffic goes to the other four
779backends and all requests end with the `OK` status.
7803.  The test driver removes the client configuration to send metadata. The
781driver asserts that during some 10-second interval, traffic is equally
782distributed among the five backends, and all requests end with the `OK` status.
783
784### custom_lb
785This test verifies that a custom load balancer policy can be configured in the
786client. It also verifies that when given a list of policies the client can
787ignore a bad one and try the next one on the list until it finds a good one.
788
789Client parameters:
790
7911.  --num_channels=1
7922.  --qps=100
793
794Load balancer configuration:
795
796One MIG with a single backend.
797
798The `backendService` will have the following `localityLbPolicies` entry:
799```json
800[
801  {
802    "customPolicy": {
803      "name": "test.ThisLoadBalancerDoesNotExist",
804      "data": "{ \"foo\": \"bar\" }"
805    }
806  },
807  {
808    "customPolicy": {
809      "name": "test.RpcBehaviorLoadBalancer",
810      "data": "{ \"rpcBehavior\": \"error-code-15\" }"
811    }
812  }
813]
814```
815
816The client **should not** implement the `test.ThisLoadBalancerDoesNotExist`, but
817it **should** implement `test.RpcBehaviorLoadBalancer`. The
818`RpcBehaviorLoadBalancer` implementation should set the rpcBehavior request
819header based on the configuration it is provided. The `rpcBehavior` field value
820in the config should be used as the header value.
821
822Assert:
823
8241. The first custom policy is ignored as the client does not have an
825implementation for it.
8262. The second policy, that **is** implemented by the client, has been applied
827by the client. This can be asserted by confirming that each request has
828failed with the configured error code 15 (DATA_LOSS). We should get this error
829because the test server knows to look for the `rpcBehavior` header and fail
830a request with a provided error code.
831
832Note that while this test is for load balancing, we can get by with a single
833backend as our test load balancer does not perform any actual load balancing,
834instead only applying the `rpcBehavior` header to each request.
835