|
|
@ -779,4 +779,56 @@ that during some 10-second interval, all traffic goes to the other four |
|
|
|
backends and all requests end with the `OK` status. |
|
|
|
backends and all requests end with the `OK` status. |
|
|
|
3. The test driver removes the client configuration to send metadata. The |
|
|
|
3. The test driver removes the client configuration to send metadata. The |
|
|
|
driver asserts that during some 10-second interval, traffic is equally |
|
|
|
driver asserts that during some 10-second interval, traffic is equally |
|
|
|
distributed among the five backends, and all requests end with the `OK` status. |
|
|
|
distributed among the five backends, and all requests end with the `OK` status. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### custom_lb |
|
|
|
|
|
|
|
This test verifies that a custom load balancer policy can be configured in the |
|
|
|
|
|
|
|
client. It also verifies that when given a list of policies the client can |
|
|
|
|
|
|
|
ignore a bad one and try the next one on the list until it finds a good one. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Client parameters: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1. --num_channels=1 |
|
|
|
|
|
|
|
2. --qps=100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balancer configuration: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
One MIG with a single backend. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The `backendService` will have the following `localityLbPolicies` entry: |
|
|
|
|
|
|
|
```json |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
"customPolicy": { |
|
|
|
|
|
|
|
"name": "test.ThisLoadBalancerDoesNotExist", |
|
|
|
|
|
|
|
"data": "{ \"foo\": \"bar\" }" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
"customPolicy": { |
|
|
|
|
|
|
|
"name": "test.RpcBehaviorLoadBalancer", |
|
|
|
|
|
|
|
"data": "{ \"rpcBehavior\": \"error-code-15\" }" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The client **should not** implement the `test.ThisLoadBalancerDoesNotExist`, but |
|
|
|
|
|
|
|
it **should** implement `test.RpcBehaviorLoadBalancer`. The |
|
|
|
|
|
|
|
`RpcBehaviorLoadBalancer` implementation should set the rpcBehavior request |
|
|
|
|
|
|
|
header based on the configuration it is provided. The `rpcBehavior` field value |
|
|
|
|
|
|
|
in the config should be used as the header value. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Assert: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1. The first custom policy is ignored as the client does not have an |
|
|
|
|
|
|
|
implementation for it. |
|
|
|
|
|
|
|
2. The second policy, that **is** implemented by the client, has been applied |
|
|
|
|
|
|
|
by the client. This can be asserted by confirming that each request has |
|
|
|
|
|
|
|
failed with the configured error code 15 (DATA_LOSS). We should get this error |
|
|
|
|
|
|
|
because the test server knows to look for the `rpcBehavior` header and fail |
|
|
|
|
|
|
|
a request with a provided error code. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Note that while this test is for load balancing, we can get by with a single |
|
|
|
|
|
|
|
backend as our test load balancer does not perform any actual load balancing, |
|
|
|
|
|
|
|
instead only applying the `rpcBehavior` header to each request. |
|
|
|