| 1 |
# xDS (Load-Balancing) Interop Test Case Descriptions |
| 2 |
|
| 3 |
Client and server use [test.proto](../src/proto/grpc/testing/test.proto). |
| 4 |
|
| 5 |
## Server |
| 6 |
|
| 7 |
The 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 |
|
| 10 |
Server 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 |
|
| 20 |
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: |
| 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 `success-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 |
|
| 28 |
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. |
| 29 |
|
| 30 |
## Client |
| 31 |
|
| 32 |
The base behavior of the xDS test client is to send a constant QPS of unary |
| 33 |
messages and record the remote-peer distribution of the responses. Further, the |
| 34 |
client must expose an implementation of the `LoadBalancerStatsService` gRPC |
| 35 |
service to allow the test driver to validate the load balancing behavior for a |
| 36 |
particular test case (see below for more details). |
| 37 |
|
| 38 |
The 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 |
|
| 41 |
Clients 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 |
|
| 64 |
The xDS test client's behavior can be dynamically changed in the middle of tests. |
| 65 |
This is achieved by invoking the `XdsUpdateClientConfigureService` gRPC service |
| 66 |
on the test client. This can be useful for tests requiring special client behaviors |
| 67 |
that are not desirable at test initialization and client warmup. The service is |
| 68 |
defined as: |
| 69 |
|
| 70 |
``` |
| 71 |
message 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 |
|
| 94 |
message ClientConfigureResponse {} |
| 95 |
|
| 96 |
service XdsUpdateClientConfigureService { |
| 97 |
// Update the tes client's configuration. |
| 98 |
rpc Configure(ClientConfigureRequest) returns (ClientConfigureResponse); |
| 99 |
} |
| 100 |
``` |
| 101 |
|
| 102 |
The test client changes its behavior right after receiving the |
| 103 |
`ClientConfigureRequest`. Currently it only supports configuring the type(s) |
| 104 |
of RPCs sent by the test client, metadata attached to each type of RPCs, and the timeout. |
| 105 |
|
| 106 |
## Test Driver |
| 107 |
|
| 108 |
Note that, unlike our other interop tests, neither the client nor the server has |
| 109 |
any notion of which of the following test scenarios is under test. Instead, a |
| 110 |
separate test driver is responsible for configuring the load balancer and the |
| 111 |
server backends, running the client, and then querying the client's |
| 112 |
`LoadBalancerStatsService` to validate load balancer behavior for each of the |
| 113 |
tests described below. |
| 114 |
|
| 115 |
## LoadBalancerStatsService |
| 116 |
|
| 117 |
The service is defined as: |
| 118 |
|
| 119 |
``` |
| 120 |
message 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 |
|
| 127 |
message 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 |
|
| 139 |
message LoadBalancerAccumulatedStatsRequest {} |
| 140 |
|
| 141 |
message 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 |
|
| 166 |
service 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 |
|
| 176 |
Note that the `LoadBalancerStatsResponse` contains the remote peer distribution |
| 177 |
of the next `num_rpcs` *sent* by the client after receiving the |
| 178 |
`LoadBalancerStatsRequest`. It is important that the remote peer distribution be |
| 179 |
recorded for a block of consecutive outgoing RPCs, to validate the intended |
| 180 |
distribution from the load balancer, rather than just looking at the next |
| 181 |
`num_rpcs` responses received from backends, as different backends may respond |
| 182 |
at different rates. |
| 183 |
|
| 184 |
## Test Cases |
| 185 |
|
| 186 |
### ping_pong |
| 187 |
|
| 188 |
This test verifies that every backend receives traffic. |
| 189 |
|
| 190 |
Client parameters: |
| 191 |
|
| 192 |
1. --num_channels=1 |
| 193 |
1. --qps=100 |
| 194 |
1. --fail_on_failed_rpc=true |
| 195 |
|
| 196 |
Load balancer configuration: |
| 197 |
|
| 198 |
1. 4 backends are created in a single managed instance group (MIG). |
| 199 |
|
| 200 |
Test driver asserts: |
| 201 |
|
| 202 |
1. All backends receive at least one RPC |
| 203 |
|
| 204 |
### round_robin |
| 205 |
|
| 206 |
This test verifies that RPCs are evenly routed according to an unweighted round |
| 207 |
robin policy. |
| 208 |
|
| 209 |
Client parameters: |
| 210 |
|
| 211 |
1. --num_channels=1 |
| 212 |
1. --qps=100 |
| 213 |
1. --fail_on_failed_rpc=true |
| 214 |
|
| 215 |
Load balancer configuration: |
| 216 |
|
| 217 |
1. 4 backends are created in a single MIG. |
| 218 |
|
| 219 |
Test driver asserts that: |
| 220 |
|
| 221 |
1. 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 |
|
| 226 |
This test verifies that the load balancer will resume sending traffic to a set |
| 227 |
of backends that is stopped and then resumed. |
| 228 |
|
| 229 |
Client parameters: |
| 230 |
|
| 231 |
1. --num_channels=1 |
| 232 |
1. --qps=100 |
| 233 |
|
| 234 |
Load balancer configuration: |
| 235 |
|
| 236 |
1. 4 backends are created in a single MIG. |
| 237 |
|
| 238 |
Test driver asserts: |
| 239 |
|
| 240 |
1. All backends receive at least one RPC. |
| 241 |
|
| 242 |
The test driver records the peer distribution for a subsequent block of 100 RPCs |
| 243 |
then stops the backends. |
| 244 |
|
| 245 |
Test driver asserts: |
| 246 |
|
| 247 |
1. No RPCs from the client are successful. |
| 248 |
|
| 249 |
The test driver resumes the backends. |
| 250 |
|
| 251 |
Test driver asserts: |
| 252 |
|
| 253 |
1. 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 |
|
| 258 |
This test verifies that backends in a secondary locality receive traffic when |
| 259 |
all backends in the primary locality fail. |
| 260 |
|
| 261 |
Client parameters: |
| 262 |
|
| 263 |
1. --num_channels=1 |
| 264 |
1. --qps=100 |
| 265 |
|
| 266 |
Load balancer configuration: |
| 267 |
|
| 268 |
1. The primary MIG with 2 backends in the same zone as the client |
| 269 |
1. The secondary MIG with 2 backends in a different zone |
| 270 |
|
| 271 |
Test driver asserts: |
| 272 |
|
| 273 |
1. All backends in the primary locality receive at least 1 RPC. |
| 274 |
1. No backends in the secondary locality receive RPCs. |
| 275 |
|
| 276 |
The test driver stops the backends in the primary locality. |
| 277 |
|
| 278 |
Test driver asserts: |
| 279 |
|
| 280 |
1. All backends in the secondary locality receive at least 1 RPC. |
| 281 |
|
| 282 |
The test driver resumes the backends in the primary locality. |
| 283 |
|
| 284 |
Test driver asserts: |
| 285 |
|
| 286 |
1. All backends in the primary locality receive at least 1 RPC. |
| 287 |
1. No backends in the secondary locality receive RPCs. |
| 288 |
|
| 289 |
### secondary_locality_gets_no_requests_on_partial_primary_failure |
| 290 |
|
| 291 |
This test verifies that backends in a failover locality do not receive traffic |
| 292 |
when 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 |
| 295 |
changes to this test case. |
| 296 |
|
| 297 |
Client parameters: |
| 298 |
|
| 299 |
1. --num_channels=1 |
| 300 |
1. --qps=100 |
| 301 |
|
| 302 |
Load balancer configuration: |
| 303 |
|
| 304 |
1. The primary MIG with 2 backends in the same zone as the client |
| 305 |
1. The secondary MIG with 2 backends in a different zone |
| 306 |
|
| 307 |
Test driver asserts: |
| 308 |
|
| 309 |
1. All backends in the primary locality receive at least 1 RPC. |
| 310 |
1. No backends in the secondary locality receive RPCs. |
| 311 |
|
| 312 |
The test driver stops one of the backends in the primary locality. |
| 313 |
|
| 314 |
Test driver asserts: |
| 315 |
|
| 316 |
1. All backends in the primary locality receive at least 1 RPC. |
| 317 |
1. No backends in the secondary locality receive RPCs. |
| 318 |
|
| 319 |
### remove_instance_group |
| 320 |
|
| 321 |
This test verifies that a remaining instance group can successfully serve RPCs |
| 322 |
after removal of another instance group in the same zone. |
| 323 |
|
| 324 |
Client parameters: |
| 325 |
|
| 326 |
1. --num_channels=1 |
| 327 |
1. --qps=100 |
| 328 |
|
| 329 |
Load balancer configuration: |
| 330 |
|
| 331 |
1. Two MIGs with two backends each, using rate balancing mode. |
| 332 |
|
| 333 |
Test driver asserts: |
| 334 |
|
| 335 |
1. All backends receive at least one RPC. |
| 336 |
|
| 337 |
The test driver removes one MIG. |
| 338 |
|
| 339 |
Test driver asserts: |
| 340 |
|
| 341 |
1. All RPCs are directed to the two remaining backends (no RPC failures). |
| 342 |
|
| 343 |
### change_backend_service |
| 344 |
|
| 345 |
This test verifies that the backend service can be replaced and traffic routed |
| 346 |
to the new backends. |
| 347 |
|
| 348 |
Client parameters: |
| 349 |
|
| 350 |
1. --num_channels=1 |
| 351 |
1. --qps=100 |
| 352 |
1. --fail_on_failed_rpc=true |
| 353 |
|
| 354 |
Load balancer configuration: |
| 355 |
|
| 356 |
1. One MIG with two backends |
| 357 |
|
| 358 |
Test driver asserts: |
| 359 |
|
| 360 |
1. All backends receive at least one RPC. |
| 361 |
|
| 362 |
The test driver creates a new backend service containing a MIG with two backends |
| 363 |
and changes the TD URL map to point to this new backend service. |
| 364 |
|
| 365 |
Test driver asserts: |
| 366 |
|
| 367 |
1. All RPCs are directed to the new backend service. |
| 368 |
|
| 369 |
### traffic_splitting |
| 370 |
|
| 371 |
This test verifies that the traffic will be distributed between backend |
| 372 |
services with the correct weights when route action is set to weighted |
| 373 |
backend services. |
| 374 |
|
| 375 |
Client parameters: |
| 376 |
|
| 377 |
1. --num_channels=1 |
| 378 |
1. --qps=100 |
| 379 |
|
| 380 |
Load balancer configuration: |
| 381 |
|
| 382 |
1. One MIG with one backend |
| 383 |
|
| 384 |
Assert: |
| 385 |
|
| 386 |
1. Once all backends receive at least one RPC, the following 1000 RPCs are |
| 387 |
all sent to MIG_a. |
| 388 |
|
| 389 |
The test driver adds a new MIG with 1 backend, and changes the route action |
| 390 |
to weighted backend services with {a: 20, b: 80}. |
| 391 |
|
| 392 |
Assert: |
| 393 |
|
| 394 |
1. Once all backends receive at least one RPC, the following 1000 RPCs are |
| 395 |
distributed across the 2 backends as a: 20, b: 80. |
| 396 |
### path_matching |
| 397 |
|
| 398 |
This test verifies that the traffic for a certain RPC can be routed to a |
| 399 |
specific cluster based on the RPC path. |
| 400 |
|
| 401 |
Client parameters: |
| 402 |
|
| 403 |
1. –num_channels=1 |
| 404 |
1. –qps=10 |
| 405 |
1. –fail_on_failed_rpc=true |
| 406 |
1. –rpc=“EmptyCall,UnaryCall” |
| 407 |
|
| 408 |
Load balancer configuration: |
| 409 |
|
| 410 |
1. 2 MIGs, each with 1 backend |
| 411 |
1. routes |
| 412 |
- “/”: MIG_default |
| 413 |
|
| 414 |
Assert: |
| 415 |
|
| 416 |
1. UnaryCall RPCs are sent to MIG_default |
| 417 |
1. EmptyCall RPCs are sent to MIG_default |
| 418 |
|
| 419 |
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. |
| 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 |
|
| 443 |
This test verifies that the traffic for a certain RPC can be routed to a |
| 444 |
specific cluster based on the RPC header (metadata). |
| 445 |
|
| 446 |
Client parameters: |
| 447 |
|
| 448 |
1. –num_channels=1 |
| 449 |
1. –qps=10 |
| 450 |
1. –fail_on_failed_rpc=true |
| 451 |
1. –rpc=“EmptyCall,UnaryCall” |
| 452 |
1. –rpc=“EmptyCall:xds_md:exact_match” |
| 453 |
|
| 454 |
Load balancer configuration: |
| 455 |
|
| 456 |
1. 2 MIGs, each with 1 backend |
| 457 |
1. routes |
| 458 |
- “/”: MIG_default |
| 459 |
|
| 460 |
Assert: |
| 461 |
|
| 462 |
1. UnaryCall RPCs are sent to MIG_default |
| 463 |
1. EmptyCall RPCs are sent to MIG_default |
| 464 |
|
| 465 |
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. |
| 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 |
|
| 503 |
This test verifies that traffic is partially diverted to a secondary locality |
| 504 |
when > 50% of the instances in the primary locality are unhealthy. |
| 505 |
|
| 506 |
Client parameters: |
| 507 |
|
| 508 |
1. --num_channels=1 |
| 509 |
1. --qps=100 |
| 510 |
|
| 511 |
Load balancer configuration: |
| 512 |
|
| 513 |
1. The primary MIG with 3 backends in the same zone as the client |
| 514 |
1. The secondary MIG with 2 backends in a different zone |
| 515 |
|
| 516 |
Test driver asserts: |
| 517 |
|
| 518 |
1. All backends in the primary locality receive at least 1 RPC. |
| 519 |
1. No backends in the secondary locality receive RPCs. |
| 520 |
|
| 521 |
The test driver stops 2 of 3 backends in the primary locality. |
| 522 |
|
| 523 |
Test driver asserts: |
| 524 |
|
| 525 |
1. All backends in the secondary locality receive at least 1 RPC. |
| 526 |
1. The remaining backend in the primary locality receives at least 1 RPC. |
| 527 |
|
| 528 |
The test driver resumes the backends in the primary locality. |
| 529 |
|
| 530 |
Test driver asserts: |
| 531 |
|
| 532 |
1. All backends in the primary locality receive at least 1 RPC. |
| 533 |
1. No backends in the secondary locality receive RPCs. |
| 534 |
|
| 535 |
|
| 536 |
### load_based_failover |
| 537 |
|
| 538 |
This test verifies that traffic is partially diverted to a secondary locality |
| 539 |
when the QPS is greater than the configured RPS in the priority locality. |
| 540 |
|
| 541 |
Client parameters: |
| 542 |
|
| 543 |
1. --num_channels=1 |
| 544 |
1. --qps=100 |
| 545 |
|
| 546 |
Load balancer configuration: |
| 547 |
|
| 548 |
1. The primary MIG with 2 backends in the same zone as the client |
| 549 |
1. The secondary MIG with 2 backends in a different zone |
| 550 |
|
| 551 |
Test driver asserts: |
| 552 |
|
| 553 |
1. All backends in the primary locality receive at least 1 RPC. |
| 554 |
1. No backends in the secondary locality receive RPCs. |
| 555 |
|
| 556 |
The test driver sets `balancingMode` is `RATE`, and `maxRate` to 20 in the primary locality. |
| 557 |
|
| 558 |
Test driver asserts: |
| 559 |
|
| 560 |
1. All backends in the primary locality receive at least 1 RPC. |
| 561 |
1. All backends in the secondary locality receive at least 1 RPC. |
| 562 |
|
| 563 |
The test driver set `maxRate` to 120 in the primary locality. |
| 564 |
|
| 565 |
Test driver asserts: |
| 566 |
|
| 567 |
1. All backends in the primary locality receive at least 1 RPC. |
| 568 |
1. No backends in the secondary locality receive RPCs. |
| 569 |
|
| 570 |
|
| 571 |
### circuit_breaking |
| 572 |
|
| 573 |
This test verifies that the maximum number of outstanding requests is limited |
| 574 |
by circuit breakers of the backend service. |
| 575 |
|
| 576 |
Client parameters: |
| 577 |
|
| 578 |
1. --num_channels=1 |
| 579 |
1. --qps=100 |
| 580 |
|
| 581 |
Load balancer configuration: |
| 582 |
|
| 583 |
1. Two MIGs with each having two backends. |
| 584 |
|
| 585 |
The test driver configures the backend services with: |
| 586 |
|
| 587 |
1. path{“/grpc.testing.TestService/UnaryCall"}: MIG_1 |
| 588 |
1. path{“/grpc.testing.TestService/EmptyCall"}: MIG_2 |
| 589 |
1. MIG_1 circuit_breakers with max_requests = 500 |
| 590 |
1. MIG_2 circuit breakers with max_requests = 1000 |
| 591 |
|
| 592 |
The test driver configures the test client to send both UnaryCall and EmptyCall, |
| 593 |
with all RPCs keep-open. |
| 594 |
|
| 595 |
Assert: |
| 596 |
|
| 597 |
1. After reaching steady state, there are 500 UnaryCall RPCs in-flight |
| 598 |
and 1000 EmptyCall RPCs in-flight. |
| 599 |
|
| 600 |
The test driver updates MIG_1's circuit breakers with max_request = 800. |
| 601 |
|
| 602 |
Test driver asserts: |
| 603 |
|
| 604 |
1. After reaching steady state, there are 800 UnaryCall RPCs in-flight. |
| 605 |
|
| 606 |
### timeout |
| 607 |
|
| 608 |
This test verifies that traffic along a route with a `max_stream_duration` set |
| 609 |
will cause timeouts on streams open longer than that duration. |
| 610 |
|
| 611 |
Client parameters: |
| 612 |
|
| 613 |
1. `--num_channels=1` |
| 614 |
1. `--qps=100` |
| 615 |
|
| 616 |
Route Configuration: |
| 617 |
|
| 618 |
Two routes: |
| 619 |
|
| 620 |
1. Path match for `/grpc.testing.TestService/UnaryCall`, with a `route_action` |
| 621 |
containing `max_stream_duration` of 3 seconds. |
| 622 |
1. Default route containing no `max_stream_duration` setting. |
| 623 |
|
| 624 |
There are four sub-tests: |
| 625 |
|
| 626 |
1. `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`. |
| 630 |
1. `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`. |
| 634 |
1. `timeout_exceeded` (executed with the below test case) |
| 635 |
1. `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 |
| 643 |
The test case verifies a specific use case where it creates a second TD API |
| 644 |
listener using the same name as the existing one and then delete the old one. |
| 645 |
The test driver verifies this is a safe way to update the API listener |
| 646 |
configuration while keep using the existing name. |
| 647 |
|
| 648 |
Client parameters: |
| 649 |
|
| 650 |
1. --num_channels=1 |
| 651 |
1. --qps=100 |
| 652 |
|
| 653 |
Load balancer configuration: |
| 654 |
|
| 655 |
1. One MIG with two backends. |
| 656 |
|
| 657 |
Assert: |
| 658 |
|
| 659 |
The test driver configuration steps: |
| 660 |
1. The test driver creates the first set of forwarding rule + target proxy + |
| 661 |
URL map with a test host name. |
| 662 |
1. Then the test driver creates a second set of forwarding rule + target proxy + |
| 663 |
URL map with the same test host name. |
| 664 |
1. The test driver deletes the first set of configurations in step 1. |
| 665 |
|
| 666 |
The test driver verifies, at each configuration step, the traffic is always able |
| 667 |
to reach the designated hosts. |
| 668 |
|
| 669 |
### metadata_filter |
| 670 |
This test case verifies that metadata filter configurations in URL map match |
| 671 |
rule are effective at Traffic Director for routing selection against downstream |
| 672 |
node metadata. |
| 673 |
|
| 674 |
Client parameters: |
| 675 |
|
| 676 |
1. --num_channels=1 |
| 677 |
1. --qps=100 |
| 678 |
|
| 679 |
Load balancer configuration: |
| 680 |
|
| 681 |
1. Two MIGs in the same zone, each having two backends. |
| 682 |
|
| 683 |
There are four test sub-cases: |
| 684 |
1. Test `MATCH_ALL` metadata filter criteria. |
| 685 |
1. Test `MATCH_ANY` metadata filter criteria. |
| 686 |
1. Test mixed `MATCH_ALL` and `MATCH_ANY` metadata filter criteria. |
| 687 |
1. Test when multiple match rules with metadata filter all match. |
| 688 |
|
| 689 |
Assert: |
| 690 |
|
| 691 |
At each test sub-case described above, the test driver configures |
| 692 |
and verifies: |
| 693 |
|
| 694 |
1. Set default URL map, and verify traffic goes to the original backend hosts. |
| 695 |
1. Then patch URL map to update the match rule with metadata filter |
| 696 |
configuration under test added. |
| 697 |
1. Then it verifies traffic switches to alternate backend service hosts. |
| 698 |
|
| 699 |
This way, we test that TD correctly evaluates both matching and non-matching |
| 700 |
configuration scenario. |
| 701 |
|
| 702 |
### forwarding_rule_port_match |
| 703 |
This test verifies that request server uri port should match with the GCP |
| 704 |
forwarding rule configuration port. |
| 705 |
|
| 706 |
Client parameters: |
| 707 |
|
| 708 |
1. --num_channels=1 |
| 709 |
1. --qps=100 |
| 710 |
|
| 711 |
Load balancer configuration: |
| 712 |
|
| 713 |
1. One MIG with two backends. |
| 714 |
|
| 715 |
Assert: |
| 716 |
1. The test driver configures matching port in the forwarding rule and in the |
| 717 |
request server uri, then verifies traffic reaches backend service instances. |
| 718 |
1. The test driver updates the forwarding rule to use a different port, then |
| 719 |
verifies that the traffic stops going to those backend service instances. |
| 720 |
|
| 721 |
### forwarding_rule_default_port |
| 722 |
This test verifies that omitting port in the request server uri should only |
| 723 |
match with the default port(80) configuration in the forwarding rule. |
| 724 |
In addition, request server uri port should exactly match that in the URL map |
| 725 |
host rule, as described in |
| 726 |
[public doc](https://cloud.google.com/traffic-director/docs/proxyless-overview#proxyless-url-map). |
| 727 |
|
| 728 |
Client parameters: |
| 729 |
|
| 730 |
1. --num_channels=1 |
| 731 |
1. --qps=100 |
| 732 |
|
| 733 |
Load balancer configuration: |
| 734 |
|
| 735 |
1. One MIG with two backends. |
| 736 |
|
| 737 |
Assert: |
| 738 |
|
| 739 |
Test driver configures and verifies: |
| 740 |
1. No traffic goes to backends when configuring the target URI |
| 741 |
`xds:///myservice`, the forwarding rule with port *x != 80*, the URL map |
| 742 |
host rule `myservice::x`. |
| 743 |
1. Traffic goes to backends when configuring the target URI `xds:///myservice`, |
| 744 |
the forwarding rule port `80` and the URL map host rule `myservice`. |
| 745 |
1. 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 |
| 750 |
This test verifies that the client applies the outlier detection configuration |
| 751 |
and temporarily drops traffic to a server that fails requests. |
| 752 |
|
| 753 |
Client parameters: |
| 754 |
|
| 755 |
1. --num_channels=1 |
| 756 |
2. --qps=100 |
| 757 |
|
| 758 |
Load balancer configuration: |
| 759 |
|
| 760 |
1. 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 |
``` |
| 771 |
Assert: |
| 772 |
|
| 773 |
1. The test driver asserts that traffic is equally distribted among the |
| 774 |
five backends, and all requests end with the `OK` status. |
| 775 |
2. The test driver chooses one of the five backends to fail requests, and |
| 776 |
configures the client to send the metadata |
| 777 |
`rpc-behavior: hostname=<chosen backend> error-code-2`. The driver asserts |
| 778 |
that during some 10-second interval, all traffic goes to the other four |
| 779 |
backends and all requests end with the `OK` status. |
| 780 |
3. The test driver removes the client configuration to send metadata. The |
| 781 |
driver asserts that during some 10-second interval, traffic is equally |
| 782 |
distributed among the five backends, and all requests end with the `OK` status. |