@@ -378,7 +378,7 @@ class TimeoutTest : public XdsEnd2endTest {
378
378
protected:
379
379
void SetUp () override {
380
380
InitClient (BootstrapBuilder (), /* lb_expected_authority=*/ " " ,
381
- /* xds_resource_does_not_exist_timeout_ms=*/ 500 );
381
+ /* xds_resource_does_not_exist_timeout_ms=*/ 2000 );
382
382
}
383
383
};
384
384
@@ -394,12 +394,16 @@ INSTANTIATE_TEST_SUITE_P(
394
394
395
395
TEST_P (TimeoutTest, LdsServerIgnoresRequest) {
396
396
balancer_->ads_service ()->IgnoreResourceType (kLdsTypeUrl );
397
- CheckRpcSendFailure (DEBUG_LOCATION);
397
+ CheckRpcSendFailure (DEBUG_LOCATION,
398
+ CheckRpcSendFailureOptions ().set_rpc_options (
399
+ RpcOptions ().set_timeout_ms (4000 )));
398
400
}
399
401
400
402
TEST_P (TimeoutTest, LdsResourceNotPresentInRequest) {
401
403
balancer_->ads_service ()->UnsetResource (kLdsTypeUrl , kServerName );
402
- CheckRpcSendFailure (DEBUG_LOCATION);
404
+ CheckRpcSendFailure (DEBUG_LOCATION,
405
+ CheckRpcSendFailureOptions ().set_rpc_options (
406
+ RpcOptions ().set_timeout_ms (4000 )));
403
407
}
404
408
405
409
TEST_P (TimeoutTest, LdsSecondResourceNotPresentInRequest) {
@@ -410,7 +414,7 @@ TEST_P(TimeoutTest, LdsSecondResourceNotPresentInRequest) {
410
414
CreateAndStartBackends (1 );
411
415
EdsResourceArgs args ({{" locality0" , CreateEndpointsForBackends ()}});
412
416
balancer_->ads_service ()->SetEdsResource (BuildEdsResource (args));
413
- WaitForAllBackends (DEBUG_LOCATION);
417
+ CheckRpcSendOk (DEBUG_LOCATION, 1 , RpcOptions (). set_timeout_ms ( 4000 ) );
414
418
// Create second channel for a new server name.
415
419
// This should fail because there is no LDS resource for this server name.
416
420
auto channel2 =
@@ -420,21 +424,25 @@ TEST_P(TimeoutTest, LdsSecondResourceNotPresentInRequest) {
420
424
EchoRequest request;
421
425
EchoResponse response;
422
426
RpcOptions rpc_options;
423
- rpc_options.SetupRpc (&context, &request);
427
+ rpc_options.set_timeout_ms ( 4000 ). SetupRpc (&context, &request);
424
428
auto status =
425
429
SendRpcMethod (stub2.get (), rpc_options, &context, request, &response);
426
430
EXPECT_EQ (StatusCode::UNAVAILABLE, status.error_code ());
427
431
}
428
432
429
433
TEST_P (TimeoutTest, RdsServerIgnoresRequest) {
430
434
balancer_->ads_service ()->IgnoreResourceType (kRdsTypeUrl );
431
- CheckRpcSendFailure (DEBUG_LOCATION);
435
+ CheckRpcSendFailure (DEBUG_LOCATION,
436
+ CheckRpcSendFailureOptions ().set_rpc_options (
437
+ RpcOptions ().set_timeout_ms (4000 )));
432
438
}
433
439
434
440
TEST_P (TimeoutTest, RdsResourceNotPresentInRequest) {
435
441
balancer_->ads_service ()->UnsetResource (kRdsTypeUrl ,
436
442
kDefaultRouteConfigurationName );
437
- CheckRpcSendFailure (DEBUG_LOCATION);
443
+ CheckRpcSendFailure (DEBUG_LOCATION,
444
+ CheckRpcSendFailureOptions ().set_rpc_options (
445
+ RpcOptions ().set_timeout_ms (4000 )));
438
446
}
439
447
440
448
TEST_P (TimeoutTest, RdsSecondResourceNotPresentInRequest) {
@@ -445,6 +453,7 @@ TEST_P(TimeoutTest, RdsSecondResourceNotPresentInRequest) {
445
453
CreateAndStartBackends (1 );
446
454
EdsResourceArgs args ({{" locality0" , CreateEndpointsForBackends ()}});
447
455
balancer_->ads_service ()->SetEdsResource (BuildEdsResource (args));
456
+ CheckRpcSendOk (DEBUG_LOCATION, 1 , RpcOptions ().set_timeout_ms (4000 ));
448
457
// Add listener for 2nd channel, but no RDS resource.
449
458
const char * kNewServerName = " new-server.example.com" ;
450
459
Listener listener = default_listener_;
@@ -456,7 +465,6 @@ TEST_P(TimeoutTest, RdsSecondResourceNotPresentInRequest) {
456
465
rds->mutable_config_source ()->mutable_self ();
457
466
ClientHcmAccessor ().Pack (http_connection_manager, &listener);
458
467
balancer_->ads_service ()->SetLdsResource (listener);
459
- WaitForAllBackends (DEBUG_LOCATION);
460
468
// Create second channel for a new server name.
461
469
// This should fail because the LDS resource points to a non-existent RDS
462
470
// resource.
@@ -466,27 +474,31 @@ TEST_P(TimeoutTest, RdsSecondResourceNotPresentInRequest) {
466
474
EchoRequest request;
467
475
EchoResponse response;
468
476
RpcOptions rpc_options;
469
- rpc_options.SetupRpc (&context, &request);
477
+ rpc_options.set_timeout_ms ( 4000 ). SetupRpc (&context, &request);
470
478
auto status =
471
479
SendRpcMethod (stub2.get (), rpc_options, &context, request, &response);
472
480
EXPECT_EQ (StatusCode::UNAVAILABLE, status.error_code ());
473
481
}
474
482
475
483
TEST_P (TimeoutTest, CdsServerIgnoresRequest) {
476
484
balancer_->ads_service ()->IgnoreResourceType (kCdsTypeUrl );
477
- CheckRpcSendFailure (DEBUG_LOCATION);
485
+ CheckRpcSendFailure (DEBUG_LOCATION,
486
+ CheckRpcSendFailureOptions ().set_rpc_options (
487
+ RpcOptions ().set_timeout_ms (4000 )));
478
488
}
479
489
480
490
TEST_P (TimeoutTest, CdsResourceNotPresentInRequest) {
481
491
balancer_->ads_service ()->UnsetResource (kCdsTypeUrl , kDefaultClusterName );
482
- CheckRpcSendFailure (DEBUG_LOCATION);
492
+ CheckRpcSendFailure (DEBUG_LOCATION,
493
+ CheckRpcSendFailureOptions ().set_rpc_options (
494
+ RpcOptions ().set_timeout_ms (4000 )));
483
495
}
484
496
485
497
TEST_P (TimeoutTest, CdsSecondResourceNotPresentInRequest) {
486
498
CreateAndStartBackends (1 );
487
499
EdsResourceArgs args ({{" locality0" , CreateEndpointsForBackends ()}});
488
500
balancer_->ads_service ()->SetEdsResource (BuildEdsResource (args));
489
- WaitForAllBackends (DEBUG_LOCATION);
501
+ CheckRpcSendOk (DEBUG_LOCATION, 1 , RpcOptions (). set_timeout_ms ( 4000 ) );
490
502
// Change route config to point to non-existing cluster.
491
503
const char * kNewClusterName = " new_cluster_name" ;
492
504
RouteConfiguration route_config = default_route_config_;
@@ -497,7 +509,7 @@ TEST_P(TimeoutTest, CdsSecondResourceNotPresentInRequest) {
497
509
balancer_->ads_service ()->SetRdsResource (route_config);
498
510
// New cluster times out.
499
511
// May need to wait a bit for the change to propagate to the client.
500
- gpr_timespec deadline = grpc_timeout_seconds_to_deadline (10 );
512
+ gpr_timespec deadline = grpc_timeout_seconds_to_deadline (30 );
501
513
bool error_seen = false ;
502
514
do {
503
515
auto status = SendRpc ();
@@ -511,20 +523,24 @@ TEST_P(TimeoutTest, CdsSecondResourceNotPresentInRequest) {
511
523
512
524
TEST_P (TimeoutTest, EdsServerIgnoresRequest) {
513
525
balancer_->ads_service ()->IgnoreResourceType (kEdsTypeUrl );
514
- CheckRpcSendFailure (DEBUG_LOCATION);
526
+ CheckRpcSendFailure (DEBUG_LOCATION,
527
+ CheckRpcSendFailureOptions ().set_rpc_options (
528
+ RpcOptions ().set_timeout_ms (4000 )));
515
529
}
516
530
517
531
TEST_P (TimeoutTest, EdsResourceNotPresentInRequest) {
518
532
// No need to remove EDS resource, since the test suite does not add it
519
533
// by default.
520
- CheckRpcSendFailure (DEBUG_LOCATION);
534
+ CheckRpcSendFailure (DEBUG_LOCATION,
535
+ CheckRpcSendFailureOptions ().set_rpc_options (
536
+ RpcOptions ().set_timeout_ms (4000 )));
521
537
}
522
538
523
539
TEST_P (TimeoutTest, EdsSecondResourceNotPresentInRequest) {
524
540
CreateAndStartBackends (1 );
525
541
EdsResourceArgs args ({{" locality0" , CreateEndpointsForBackends ()}});
526
542
balancer_->ads_service ()->SetEdsResource (BuildEdsResource (args));
527
- WaitForAllBackends (DEBUG_LOCATION);
543
+ CheckRpcSendOk (DEBUG_LOCATION, 1 , RpcOptions (). set_timeout_ms ( 4000 ) );
528
544
// New cluster that points to a non-existant EDS resource.
529
545
const char * kNewClusterName = " new_cluster_name" ;
530
546
Cluster cluster = default_cluster_;
@@ -541,7 +557,7 @@ TEST_P(TimeoutTest, EdsSecondResourceNotPresentInRequest) {
541
557
balancer_->ads_service ()->SetRdsResource (route_config);
542
558
// New EDS resource times out.
543
559
// May need to wait a bit for the RDS change to propagate to the client.
544
- gpr_timespec deadline = grpc_timeout_seconds_to_deadline (10 );
560
+ gpr_timespec deadline = grpc_timeout_seconds_to_deadline (30 );
545
561
bool error_seen = false ;
546
562
do {
547
563
auto status = SendRpc (RpcOptions ().set_rpc_method (METHOD_ECHO1));
@@ -557,7 +573,7 @@ TEST_P(TimeoutTest, ServerDoesNotResendAfterAdsStreamRestart) {
557
573
CreateAndStartBackends (1 );
558
574
EdsResourceArgs args ({{" locality0" , CreateEndpointsForBackends (0 , 1 )}});
559
575
balancer_->ads_service ()->SetEdsResource (BuildEdsResource (args));
560
- WaitForAllBackends (DEBUG_LOCATION);
576
+ CheckRpcSendOk (DEBUG_LOCATION, 1 , RpcOptions (). set_timeout_ms ( 4000 ) );
561
577
// Stop balancer.
562
578
balancer_->Shutdown ();
563
579
// Tell balancer to require minimum version 1 for all resource types
@@ -577,7 +593,7 @@ TEST_P(TimeoutTest, ServerDoesNotResendAfterAdsStreamRestart) {
577
593
// be sure that the channel continues to use the resources from before
578
594
// the restart.
579
595
absl::Time deadline =
580
- absl::Now () + (absl::Seconds (5 ) * grpc_test_slowdown_factor ());
596
+ absl::Now () + (absl::Seconds (30 ) * grpc_test_slowdown_factor ());
581
597
do {
582
598
CheckRpcSendOk (DEBUG_LOCATION);
583
599
} while (absl::Now () < deadline);
0 commit comments