GRPC Core
43.0.0
|
Client and server use test.proto.
The code for the xDS test server can be found at: Java (other language implementations are in progress).
Server should accept these arguments:
Servers that want to support dual stack testing (like Java) should also accept:
In addition, when handling requests, if the initial request metadata contains the rpc-behavior
key, it should modify its handling of the request as follows:
sleep-<int>
, the server should wait the specified number of seconds before resuming behavior matching and RPC processing.keep-open
, the server should never respond to the request and behavior matching ends.error-code-<int>
, the server should respond with the specified status code and behavior matching ends.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.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.The 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.
The base behavior of the xDS test client is to send a constant QPS of unary messages and record the remote-peer distribution of the responses. Further, the client must expose an implementation of the LoadBalancerStatsService
gRPC service to allow the test driver to validate the load balancing behavior for a particular test case (see below for more details).
The code for the xDS test client can be at: Java (other language implementations are in progress).
Clients should accept these arguments:
LoadBalancerStatsService
implementation.The xDS test client's behavior can be dynamically changed in the middle of tests. This is achieved by invoking the XdsUpdateClientConfigureService
gRPC service on the test client. This can be useful for tests requiring special client behaviors that are not desirable at test initialization and client warmup. The service is defined as:
The test client changes its behavior right after receiving the ClientConfigureRequest
. Currently it only supports configuring the type(s) of RPCs sent by the test client, metadata attached to each type of RPCs, and the timeout.
Note that, unlike our other interop tests, neither the client nor the server has any notion of which of the following test scenarios is under test. Instead, a separate test driver is responsible for configuring the load balancer and the server backends, running the client, and then querying the client's LoadBalancerStatsService
to validate load balancer behavior for each of the tests described below.
The service is defined as:
Note that the LoadBalancerStatsResponse
contains the remote peer distribution of the next num_rpcs
sent by the client after receiving the LoadBalancerStatsRequest
. It is important that the remote peer distribution be recorded for a block of consecutive outgoing RPCs, to validate the intended distribution from the load balancer, rather than just looking at the next num_rpcs
responses received from backends, as different backends may respond at different rates.
This test verifies that every backend receives traffic.
Client parameters:
Load balancer configuration:
Test driver asserts:
This test verifies that RPCs are evenly routed according to an unweighted round robin policy.
Client parameters:
Load balancer configuration:
Test driver asserts that:
This test verifies that the load balancer will resume sending traffic to a set of backends that is stopped and then resumed.
Client parameters:
Load balancer configuration:
Test driver asserts:
The test driver records the peer distribution for a subsequent block of 100 RPCs then stops the backends.
Test driver asserts:
The test driver resumes the backends.
Test driver asserts:
This test verifies that backends in a secondary locality receive traffic when all backends in the primary locality fail.
Client parameters:
Load balancer configuration:
Test driver asserts:
The test driver stops the backends in the primary locality.
Test driver asserts:
The test driver resumes the backends in the primary locality.
Test driver asserts:
This test verifies that backends in a failover locality do not receive traffic when at least one of the backends in the primary locality remain healthy.
Note: Future TD features may change the expected behavior and require changes to this test case.
Client parameters:
Load balancer configuration:
Test driver asserts:
The test driver stops one of the backends in the primary locality.
Test driver asserts:
This test verifies that a remaining instance group can successfully serve RPCs after removal of another instance group in the same zone.
Client parameters:
Load balancer configuration:
Test driver asserts:
The test driver removes one MIG.
Test driver asserts:
This test verifies that the backend service can be replaced and traffic routed to the new backends.
Client parameters:
Load balancer configuration:
Test driver asserts:
The test driver creates a new backend service containing a MIG with two backends and changes the TD URL map to point to this new backend service.
Test driver asserts:
This test verifies that the traffic will be distributed between backend services with the correct weights when route action is set to weighted backend services.
Client parameters:
Load balancer configuration:
Assert:
The test driver adds a new MIG with 1 backend, and changes the route action to weighted backend services with {a: 20, b: 80}.
Assert:
This test verifies that the traffic for a certain RPC can be routed to a specific cluster based on the RPC path.
Client parameters:
Load balancer configuration:
Assert:
The 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.
/grpc.testing.TestService/EmptyCall
}: MIG_2/grpc.testing.TestService/Unary
}: MIG_2/grpc.testing.TestService/Unary
}: MIG_default & {path: /grpc.testing.TestService/EmptyCall
}: MIG_2^\/.*\/UnaryCall$
}: MIG_2/gRpC.tEsTinG.tEstseRvice/empTycaLl
, ignoreCase: True
}: MIG_2This test verifies that the traffic for a certain RPC can be routed to a specific cluster based on the RPC header (metadata).
Client parameters:
Load balancer configuration:
Assert:
The 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.
xds_md
, exact: empty_ytpme
}: MIG_2xds_md
, prefix: un
}: MIG_2un
is the prefix of metadata sent with UnaryCallxds_md
, suffix: me
}: MIG_2me
is the suffix of metadata sent with EmptyCallxds_md_numeric
, present: True
}: MIG_2xds_md
, exact: unary_yranu
, invert: True
}: MIG_2xds_md_numeric
, range [100,200]
}: MIG_2xds_md
, regex: ^em.*me$
}: MIG_2This test verifies that traffic is partially diverted to a secondary locality when > 50% of the instances in the primary locality are unhealthy.
Client parameters:
Load balancer configuration:
Test driver asserts:
The test driver stops 2 of 3 backends in the primary locality.
Test driver asserts:
The test driver resumes the backends in the primary locality.
Test driver asserts:
This test verifies that traffic is partially diverted to a secondary locality when the QPS is greater than the configured RPS in the priority locality.
Client parameters:
Load balancer configuration:
Test driver asserts:
The test driver sets balancingMode
is RATE
, and maxRate
to 20 in the primary locality.
Test driver asserts:
The test driver set maxRate
to 120 in the primary locality.
Test driver asserts:
This test verifies that the maximum number of outstanding requests is limited by circuit breakers of the backend service.
Client parameters:
Load balancer configuration:
The test driver configures the backend services with:
The test driver configures the test client to send both UnaryCall and EmptyCall, with all RPCs keep-open.
Assert:
The test driver updates MIG_1's circuit breakers with max_request = 800.
Test driver asserts:
This test verifies that traffic along a route with a max_stream_duration
set will cause timeouts on streams open longer than that duration.
Client parameters:
--num_channels=1
--qps=100
Route Configuration:
Two routes:
/grpc.testing.TestService/UnaryCall
, with a route_action
containing max_stream_duration
of 3 seconds.max_stream_duration
setting.There are four sub-tests:
app_timeout_exceeded
rpc-behavior: sleep-2
.DEADLINE_EXCEEDED
.timeout_not_exceeded
OK
.timeout_exceeded
(executed with the below test case)timeout_different_route
rpc-behavior: sleep-4
.OK
for EmptyCall and ~100% status DEADLINE_EXCEEDED
for UnaryCall.The test case verifies a specific use case where it creates a second TD API listener using the same name as the existing one and then delete the old one. The test driver verifies this is a safe way to update the API listener configuration while keep using the existing name.
Client parameters:
Load balancer configuration:
Assert:
The test driver configuration steps:
The test driver verifies, at each configuration step, the traffic is always able to reach the designated hosts.
This test case verifies that metadata filter configurations in URL map match rule are effective at Traffic Director for routing selection against downstream node metadata.
Client parameters:
Load balancer configuration:
There are four test sub-cases:
MATCH_ALL
metadata filter criteria.MATCH_ANY
metadata filter criteria.MATCH_ALL
and MATCH_ANY
metadata filter criteria.Assert:
At each test sub-case described above, the test driver configures and verifies:
This way, we test that TD correctly evaluates both matching and non-matching configuration scenario.
This test verifies that request server uri port should match with the GCP forwarding rule configuration port.
Client parameters:
Load balancer configuration:
Assert:
This test verifies that omitting port in the request server uri should only match with the default port(80) configuration in the forwarding rule. In addition, request server uri port should exactly match that in the URL map host rule, as described in public doc.
Client parameters:
Load balancer configuration:
Assert:
Test driver configures and verifies:
xds:///myservice
, the forwarding rule with port x != 80, the URL map host rule myservice::x
.xds:///myservice
, the forwarding rule port 80
and the URL map host rule myservice
.xds:///myservice
, the forwarding rule port 80
and the host rule myservice::80
.This test verifies that the client applies the outlier detection configuration and temporarily drops traffic to a server that fails requests.
Client parameters:
Load balancer configuration:
backendService
configuration with the following outlierDetection
entry ```json { "interval": { "seconds": 2, "nanos": 0 }, "successRateRequestVolume": 20 } ``` Assert:OK
status.rpc-behavior: hostname=<chosen backend> error-code-2
. The driver asserts that during some 10-second interval, all traffic goes to the other four backends and all requests end with the OK
status.OK
status.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:
Load balancer configuration:
One MIG with a single backend.
The backendService
will have the following localityLbPolicies
entry:
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:
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.