|
|
|
@ -4679,72 +4679,6 @@ TEST_P(LdsRdsTest, XdsRoutingPathRegexMatching) { |
|
|
|
|
EXPECT_EQ(kNumEcho2Rpcs, backends_[3]->backend_service2()->request_count()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_P(LdsRdsTest, XdsRoutingPathRegexMatchingCaseInsensitive) { |
|
|
|
|
const char* kNewCluster1Name = "new_cluster_1"; |
|
|
|
|
const char* kNewEdsService1Name = "new_eds_service_name_1"; |
|
|
|
|
const char* kNewCluster2Name = "new_cluster_2"; |
|
|
|
|
const char* kNewEdsService2Name = "new_eds_service_name_2"; |
|
|
|
|
const size_t kNumEcho1Rpcs = 10; |
|
|
|
|
const size_t kNumEchoRpcs = 30; |
|
|
|
|
SetNextResolution({}); |
|
|
|
|
SetNextResolutionForLbChannelAllBalancers(); |
|
|
|
|
// Populate new EDS resources.
|
|
|
|
|
AdsServiceImpl::EdsResourceArgs args({ |
|
|
|
|
{"locality0", CreateEndpointsForBackends(0, 1)}, |
|
|
|
|
}); |
|
|
|
|
AdsServiceImpl::EdsResourceArgs args1({ |
|
|
|
|
{"locality0", CreateEndpointsForBackends(1, 2)}, |
|
|
|
|
}); |
|
|
|
|
AdsServiceImpl::EdsResourceArgs args2({ |
|
|
|
|
{"locality0", CreateEndpointsForBackends(2, 3)}, |
|
|
|
|
}); |
|
|
|
|
balancers_[0]->ads_service()->SetEdsResource(BuildEdsResource(args)); |
|
|
|
|
balancers_[0]->ads_service()->SetEdsResource( |
|
|
|
|
BuildEdsResource(args1, kNewEdsService1Name)); |
|
|
|
|
balancers_[0]->ads_service()->SetEdsResource( |
|
|
|
|
BuildEdsResource(args2, kNewEdsService2Name)); |
|
|
|
|
// Populate new CDS resources.
|
|
|
|
|
Cluster new_cluster1 = default_cluster_; |
|
|
|
|
new_cluster1.set_name(kNewCluster1Name); |
|
|
|
|
new_cluster1.mutable_eds_cluster_config()->set_service_name( |
|
|
|
|
kNewEdsService1Name); |
|
|
|
|
balancers_[0]->ads_service()->SetCdsResource(new_cluster1); |
|
|
|
|
Cluster new_cluster2 = default_cluster_; |
|
|
|
|
new_cluster2.set_name(kNewCluster2Name); |
|
|
|
|
new_cluster2.mutable_eds_cluster_config()->set_service_name( |
|
|
|
|
kNewEdsService2Name); |
|
|
|
|
balancers_[0]->ads_service()->SetCdsResource(new_cluster2); |
|
|
|
|
// Populating Route Configurations for LDS.
|
|
|
|
|
RouteConfiguration new_route_config = default_route_config_; |
|
|
|
|
// First route will not match, since it's case-sensitive.
|
|
|
|
|
// Second route will match with same path.
|
|
|
|
|
auto* route1 = new_route_config.mutable_virtual_hosts(0)->mutable_routes(0); |
|
|
|
|
route1->mutable_match()->mutable_safe_regex()->set_regex( |
|
|
|
|
".*EcHoTeSt1SErViCe.*"); |
|
|
|
|
route1->mutable_route()->set_cluster(kNewCluster1Name); |
|
|
|
|
auto* route2 = new_route_config.mutable_virtual_hosts(0)->add_routes(); |
|
|
|
|
route2->mutable_match()->mutable_safe_regex()->set_regex( |
|
|
|
|
".*EcHoTeSt1SErViCe.*"); |
|
|
|
|
route2->mutable_match()->mutable_case_sensitive()->set_value(false); |
|
|
|
|
route2->mutable_route()->set_cluster(kNewCluster2Name); |
|
|
|
|
auto* default_route = new_route_config.mutable_virtual_hosts(0)->add_routes(); |
|
|
|
|
default_route->mutable_match()->set_prefix(""); |
|
|
|
|
default_route->mutable_route()->set_cluster(kDefaultClusterName); |
|
|
|
|
SetRouteConfiguration(0, new_route_config); |
|
|
|
|
CheckRpcSendOk(kNumEchoRpcs, RpcOptions().set_wait_for_ready(true)); |
|
|
|
|
CheckRpcSendOk(kNumEcho1Rpcs, RpcOptions() |
|
|
|
|
.set_rpc_service(SERVICE_ECHO1) |
|
|
|
|
.set_rpc_method(METHOD_ECHO1) |
|
|
|
|
.set_wait_for_ready(true)); |
|
|
|
|
// Make sure RPCs all go to the correct backend.
|
|
|
|
|
EXPECT_EQ(kNumEchoRpcs, backends_[0]->backend_service()->request_count()); |
|
|
|
|
EXPECT_EQ(0, backends_[0]->backend_service1()->request_count()); |
|
|
|
|
EXPECT_EQ(0, backends_[1]->backend_service()->request_count()); |
|
|
|
|
EXPECT_EQ(0, backends_[1]->backend_service1()->request_count()); |
|
|
|
|
EXPECT_EQ(0, backends_[2]->backend_service()->request_count()); |
|
|
|
|
EXPECT_EQ(kNumEcho1Rpcs, backends_[2]->backend_service1()->request_count()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_P(LdsRdsTest, XdsRoutingWeightedCluster) { |
|
|
|
|
const char* kNewCluster1Name = "new_cluster_1"; |
|
|
|
|
const char* kNewEdsService1Name = "new_eds_service_name_1"; |
|
|
|
|