diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index d8ccb5063d6..9e75ccdeb21 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -359,11 +359,6 @@ typedef struct { * The default is 15 seconds. */ #define GRPC_ARG_XDS_RESOURCE_DOES_NOT_EXIST_TIMEOUT_MS \ "grpc.xds_resource_does_not_exist_timeout_ms" -/* If set, enable xds routing policy. This boolean argument is currently - * disabled by default; however, it will be changed to enabled by default - * once the functionality proves stable. This arg will eventually - * be removed completely. */ -#define GRPC_ARG_XDS_ROUTING_ENABLED "grpc.xds_routing_enabled" /** If non-zero, grpc server's cronet compression workaround will be enabled */ #define GRPC_ARG_WORKAROUND_CRONET_COMPRESSION \ "grpc.workaround.cronet_compression" diff --git a/src/core/ext/filters/client_channel/xds/xds_api.cc b/src/core/ext/filters/client_channel/xds/xds_api.cc index b4186088496..1a30c43bc7b 100644 --- a/src/core/ext/filters/client_channel/xds/xds_api.cc +++ b/src/core/ext/filters/client_channel/xds/xds_api.cc @@ -31,6 +31,8 @@ #include #include "src/core/ext/filters/client_channel/xds/xds_api.h" +#include "src/core/lib/gpr/env.h" +#include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/useful.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/sockaddr_utils.h" @@ -127,10 +129,23 @@ const char* XdsApi::kCdsTypeUrl = "type.googleapis.com/envoy.api.v2.Cluster"; const char* XdsApi::kEdsTypeUrl = "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment"; +namespace { + +bool XdsRoutingEnabled() { + char* value = gpr_getenv("GRPC_XDS_EXPERIMENTAL_ROUTING"); + bool parsed_value; + bool parse_succeeded = gpr_parse_bool_value(value, &parsed_value); + gpr_free(value); + return parse_succeeded && parsed_value; +} + +} // namespace + XdsApi::XdsApi(XdsClient* client, TraceFlag* tracer, const XdsBootstrap::Node* node) : client_(client), tracer_(tracer), + xds_routing_enabled_(XdsRoutingEnabled()), node_(node), build_version_(absl::StrCat("gRPC C-core ", GPR_PLATFORM_STRING, " ", grpc_version_string())), @@ -1566,7 +1581,6 @@ grpc_error* EdsResponseParse( grpc_error* XdsApi::ParseAdsResponse( const grpc_slice& encoded_response, const std::string& expected_server_name, const std::string& expected_route_config_name, - const bool xds_routing_enabled, const std::set& expected_cluster_names, const std::set& expected_eds_service_names, absl::optional* lds_update, @@ -1598,10 +1612,10 @@ grpc_error* XdsApi::ParseAdsResponse( // Parse the response according to the resource type. if (*type_url == kLdsTypeUrl) { return LdsResponseParse(client_, tracer_, response, expected_server_name, - xds_routing_enabled, lds_update, arena.ptr()); + xds_routing_enabled_, lds_update, arena.ptr()); } else if (*type_url == kRdsTypeUrl) { return RdsResponseParse(client_, tracer_, response, expected_server_name, - expected_route_config_name, xds_routing_enabled, + expected_route_config_name, xds_routing_enabled_, rds_update, arena.ptr()); } else if (*type_url == kCdsTypeUrl) { return CdsResponseParse(client_, tracer_, response, expected_cluster_names, diff --git a/src/core/ext/filters/client_channel/xds/xds_api.h b/src/core/ext/filters/client_channel/xds/xds_api.h index cb77cb0bc45..4fa7b2bed31 100644 --- a/src/core/ext/filters/client_channel/xds/xds_api.h +++ b/src/core/ext/filters/client_channel/xds/xds_api.h @@ -271,7 +271,6 @@ class XdsApi { const grpc_slice& encoded_response, const std::string& expected_server_name, const std::string& expected_route_config_name, - const bool xds_routing_enabled, const std::set& expected_cluster_names, const std::set& expected_eds_service_names, absl::optional* lds_update, @@ -296,6 +295,7 @@ class XdsApi { private: XdsClient* client_; TraceFlag* tracer_; + const bool xds_routing_enabled_; const XdsBootstrap::Node* node_; const std::string build_version_; const std::string user_agent_name_; diff --git a/src/core/ext/filters/client_channel/xds/xds_client.cc b/src/core/ext/filters/client_channel/xds/xds_client.cc index 49537dab8a2..d6f519f7ba5 100644 --- a/src/core/ext/filters/client_channel/xds/xds_client.cc +++ b/src/core/ext/filters/client_channel/xds/xds_client.cc @@ -1245,9 +1245,9 @@ void XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked() { (xds_client()->lds_result_.has_value() ? xds_client()->lds_result_->route_config_name : ""), - xds_client()->xds_routing_enabled_, ClusterNamesForRequest(), - EdsServiceNamesForRequest(), &lds_update, &rds_update, &cds_update_map, - &eds_update_map, &version, &nonce, &type_url); + ClusterNamesForRequest(), EdsServiceNamesForRequest(), &lds_update, + &rds_update, &cds_update_map, &eds_update_map, &version, &nonce, + &type_url); grpc_slice_unref_internal(response_slice); if (type_url.empty()) { // Ignore unparsable response. @@ -1802,11 +1802,6 @@ grpc_millis GetRequestTimeout(const grpc_channel_args& args) { {15000, 0, INT_MAX}); } -bool GetXdsRoutingEnabled(const grpc_channel_args& args) { - return grpc_channel_args_find_bool(&args, GRPC_ARG_XDS_ROUTING_ENABLED, - false); -} - } // namespace XdsClient::XdsClient(std::shared_ptr work_serializer, @@ -1816,7 +1811,6 @@ XdsClient::XdsClient(std::shared_ptr work_serializer, const grpc_channel_args& channel_args, grpc_error** error) : InternallyRefCounted(&grpc_xds_client_trace), request_timeout_(GetRequestTimeout(channel_args)), - xds_routing_enabled_(GetXdsRoutingEnabled(channel_args)), work_serializer_(std::move(work_serializer)), interested_parties_(interested_parties), bootstrap_( diff --git a/src/core/ext/filters/client_channel/xds/xds_client.h b/src/core/ext/filters/client_channel/xds/xds_client.h index f5386e100dc..133e99c4918 100644 --- a/src/core/ext/filters/client_channel/xds/xds_client.h +++ b/src/core/ext/filters/client_channel/xds/xds_client.h @@ -258,8 +258,6 @@ class XdsClient : public InternallyRefCounted { const grpc_millis request_timeout_; - const bool xds_routing_enabled_; - std::shared_ptr work_serializer_; grpc_pollset_set* interested_parties_; diff --git a/test/cpp/end2end/xds_end2end_test.cc b/test/cpp/end2end/xds_end2end_test.cc index 4a1841976fe..5f245fffc87 100644 --- a/test/cpp/end2end/xds_end2end_test.cc +++ b/test/cpp/end2end/xds_end2end_test.cc @@ -1177,8 +1177,7 @@ class XdsEnd2endTest : public ::testing::TestWithParam { void ResetStub(int failover_timeout = 0, const grpc::string& expected_targets = "", - int xds_resource_does_not_exist_timeout = 0, - bool xds_routing_enabled = false) { + int xds_resource_does_not_exist_timeout = 0) { ChannelArguments args; if (failover_timeout > 0) { args.SetInt(GRPC_ARG_PRIORITY_FAILOVER_TIMEOUT_MS, failover_timeout); @@ -1187,9 +1186,6 @@ class XdsEnd2endTest : public ::testing::TestWithParam { args.SetInt(GRPC_ARG_XDS_RESOURCE_DOES_NOT_EXIST_TIMEOUT_MS, xds_resource_does_not_exist_timeout); } - if (xds_routing_enabled) { - args.SetInt(GRPC_ARG_XDS_ROUTING_ENABLED, 1); - } // If the parent channel is using the fake resolver, we inject the // response generator for the parent here, and then SetNextResolution() // will inject the xds channel's response generator via the parent's @@ -2372,10 +2368,7 @@ TEST_P(LdsRdsTest, RouteMatchHasNonemptyPrefix) { // Tests that LDS client should send a NACK if route match has a prefix // string with no "/". TEST_P(LdsRdsTest, RouteMatchHasInvalidPrefixNonEmptyNoSlash) { - ResetStub(/*failover_timeout=*/0, - /*expected_targets=*/"", - /*xds_resource_does_not_exist_timeout*/ 0, - /*xds_routing_enabled=*/true); + gpr_setenv("GRPC_XDS_EXPERIMENTAL_ROUTING", "true"); RouteConfiguration route_config = balancers_[0]->ads_service()->default_route_config(); auto* route1 = route_config.mutable_virtual_hosts(0)->mutable_routes(0); @@ -2390,15 +2383,13 @@ TEST_P(LdsRdsTest, RouteMatchHasInvalidPrefixNonEmptyNoSlash) { const auto& response_state = RouteConfigurationResponseState(0); EXPECT_EQ(response_state.state, AdsServiceImpl::ResponseState::NACKED); EXPECT_EQ(response_state.error_message, "Prefix does not start with a /"); + gpr_unsetenv("GRPC_XDS_EXPERIMENTAL_ROUTING"); } // Tests that LDS client should send a NACK if route match has a prefix // string does not end with "/". TEST_P(LdsRdsTest, RouteMatchHasInvalidPrefixNoEndingSlash) { - ResetStub(/*failover_timeout=*/0, - /*expected_targets=*/"", - /*xds_resource_does_not_exist_timeout*/ 0, - /*xds_routing_enabled=*/true); + gpr_setenv("GRPC_XDS_EXPERIMENTAL_ROUTING", "true"); RouteConfiguration route_config = balancers_[0]->ads_service()->default_route_config(); auto* route1 = route_config.mutable_virtual_hosts(0)->mutable_routes(0); @@ -2411,15 +2402,13 @@ TEST_P(LdsRdsTest, RouteMatchHasInvalidPrefixNoEndingSlash) { EXPECT_EQ(response_state.state, AdsServiceImpl::ResponseState::NACKED); EXPECT_EQ(response_state.error_message, "Prefix not in the required format of /service/"); + gpr_unsetenv("GRPC_XDS_EXPERIMENTAL_ROUTING"); } // Tests that LDS client should send a NACK if route match has a prefix // string does not start with "/". TEST_P(LdsRdsTest, RouteMatchHasInvalidPrefixNoLeadingSlash) { - ResetStub(/*failover_timeout=*/0, - /*expected_targets=*/"", - /*xds_resource_does_not_exist_timeout*/ 0, - /*xds_routing_enabled=*/true); + gpr_setenv("GRPC_XDS_EXPERIMENTAL_ROUTING", "true"); RouteConfiguration route_config = balancers_[0]->ads_service()->default_route_config(); auto* route1 = route_config.mutable_virtual_hosts(0)->mutable_routes(0); @@ -2431,15 +2420,13 @@ TEST_P(LdsRdsTest, RouteMatchHasInvalidPrefixNoLeadingSlash) { const auto& response_state = RouteConfigurationResponseState(0); EXPECT_EQ(response_state.state, AdsServiceImpl::ResponseState::NACKED); EXPECT_EQ(response_state.error_message, "Prefix does not start with a /"); + gpr_unsetenv("GRPC_XDS_EXPERIMENTAL_ROUTING"); } // Tests that LDS client should send a NACK if route match has a prefix // string with extra content outside of "/service/". TEST_P(LdsRdsTest, RouteMatchHasInvalidPrefixExtraContent) { - ResetStub(/*failover_timeout=*/0, - /*expected_targets=*/"", - /*xds_resource_does_not_exist_timeout*/ 0, - /*xds_routing_enabled=*/true); + gpr_setenv("GRPC_XDS_EXPERIMENTAL_ROUTING", "true"); RouteConfiguration route_config = balancers_[0]->ads_service()->default_route_config(); auto* route1 = route_config.mutable_virtual_hosts(0)->mutable_routes(0); @@ -2451,15 +2438,13 @@ TEST_P(LdsRdsTest, RouteMatchHasInvalidPrefixExtraContent) { const auto& response_state = RouteConfigurationResponseState(0); EXPECT_EQ(response_state.state, AdsServiceImpl::ResponseState::NACKED); EXPECT_EQ(response_state.error_message, "Prefix does not end with a /"); + gpr_unsetenv("GRPC_XDS_EXPERIMENTAL_ROUTING"); } // Tests that LDS client should send a NACK if route match has a prefix // string "//". TEST_P(LdsRdsTest, RouteMatchHasInvalidPrefixNoContent) { - ResetStub(/*failover_timeout=*/0, - /*expected_targets=*/"", - /*xds_resource_does_not_exist_timeout*/ 0, - /*xds_routing_enabled=*/true); + gpr_setenv("GRPC_XDS_EXPERIMENTAL_ROUTING", "true"); RouteConfiguration route_config = balancers_[0]->ads_service()->default_route_config(); auto* route1 = route_config.mutable_virtual_hosts(0)->mutable_routes(0); @@ -2471,15 +2456,13 @@ TEST_P(LdsRdsTest, RouteMatchHasInvalidPrefixNoContent) { const auto& response_state = RouteConfigurationResponseState(0); EXPECT_EQ(response_state.state, AdsServiceImpl::ResponseState::NACKED); EXPECT_EQ(response_state.error_message, "Prefix contains empty service name"); + gpr_unsetenv("GRPC_XDS_EXPERIMENTAL_ROUTING"); } // Tests that LDS client should send a NACK if route match has path // but it's empty. TEST_P(LdsRdsTest, RouteMatchHasInvalidPathEmptyPath) { - ResetStub(/*failover_timeout=*/0, - /*expected_targets=*/"", - /*xds_resource_does_not_exist_timeout*/ 0, - /*xds_routing_enabled=*/true); + gpr_setenv("GRPC_XDS_EXPERIMENTAL_ROUTING", "true"); RouteConfiguration route_config = balancers_[0]->ads_service()->default_route_config(); auto* route1 = route_config.mutable_virtual_hosts(0)->mutable_routes(0); @@ -2494,15 +2477,13 @@ TEST_P(LdsRdsTest, RouteMatchHasInvalidPathEmptyPath) { const auto& response_state = RouteConfigurationResponseState(0); EXPECT_EQ(response_state.state, AdsServiceImpl::ResponseState::NACKED); EXPECT_EQ(response_state.error_message, "Path if set cannot be empty"); + gpr_unsetenv("GRPC_XDS_EXPERIMENTAL_ROUTING"); } // Tests that LDS client should send a NACK if route match has path // string does not start with "/". TEST_P(LdsRdsTest, RouteMatchHasInvalidPathNoLeadingSlash) { - ResetStub(/*failover_timeout=*/0, - /*expected_targets=*/"", - /*xds_resource_does_not_exist_timeout*/ 0, - /*xds_routing_enabled=*/true); + gpr_setenv("GRPC_XDS_EXPERIMENTAL_ROUTING", "true"); RouteConfiguration route_config = balancers_[0]->ads_service()->default_route_config(); auto* route1 = route_config.mutable_virtual_hosts(0)->mutable_routes(0); @@ -2517,15 +2498,13 @@ TEST_P(LdsRdsTest, RouteMatchHasInvalidPathNoLeadingSlash) { const auto& response_state = RouteConfigurationResponseState(0); EXPECT_EQ(response_state.state, AdsServiceImpl::ResponseState::NACKED); EXPECT_EQ(response_state.error_message, "Path does not start with a /"); + gpr_unsetenv("GRPC_XDS_EXPERIMENTAL_ROUTING"); } // Tests that LDS client should send a NACK if route match has path // string that ends with "/". TEST_P(LdsRdsTest, RouteMatchHasInvalidPathEndsWithSlash) { - ResetStub(/*failover_timeout=*/0, - /*expected_targets=*/"", - /*xds_resource_does_not_exist_timeout*/ 0, - /*xds_routing_enabled=*/true); + gpr_setenv("GRPC_XDS_EXPERIMENTAL_ROUTING", "true"); RouteConfiguration route_config = balancers_[0]->ads_service()->default_route_config(); auto* route1 = route_config.mutable_virtual_hosts(0)->mutable_routes(0); @@ -2541,15 +2520,13 @@ TEST_P(LdsRdsTest, RouteMatchHasInvalidPathEndsWithSlash) { EXPECT_EQ(response_state.state, AdsServiceImpl::ResponseState::NACKED); EXPECT_EQ(response_state.error_message, "Path not in the required format of /service/method"); + gpr_unsetenv("GRPC_XDS_EXPERIMENTAL_ROUTING"); } // Tests that LDS client should send a NACK if route match has path // string that misses "/" between service and method. TEST_P(LdsRdsTest, RouteMatchHasInvalidPathMissingMiddleSlash) { - ResetStub(/*failover_timeout=*/0, - /*expected_targets=*/"", - /*xds_resource_does_not_exist_timeout*/ 0, - /*xds_routing_enabled=*/true); + gpr_setenv("GRPC_XDS_EXPERIMENTAL_ROUTING", "true"); RouteConfiguration route_config = balancers_[0]->ads_service()->default_route_config(); auto* route1 = route_config.mutable_virtual_hosts(0)->mutable_routes(0); @@ -2565,15 +2542,13 @@ TEST_P(LdsRdsTest, RouteMatchHasInvalidPathMissingMiddleSlash) { EXPECT_EQ(response_state.state, AdsServiceImpl::ResponseState::NACKED); EXPECT_EQ(response_state.error_message, "Path not in the required format of /service/method"); + gpr_unsetenv("GRPC_XDS_EXPERIMENTAL_ROUTING"); } // Tests that LDS client should send a NACK if route match has path // string that is missing service. TEST_P(LdsRdsTest, RouteMatchHasInvalidPathMissingService) { - ResetStub(/*failover_timeout=*/0, - /*expected_targets=*/"", - /*xds_resource_does_not_exist_timeout*/ 0, - /*xds_routing_enabled=*/true); + gpr_setenv("GRPC_XDS_EXPERIMENTAL_ROUTING", "true"); RouteConfiguration route_config = balancers_[0]->ads_service()->default_route_config(); auto* route1 = route_config.mutable_virtual_hosts(0)->mutable_routes(0); @@ -2588,15 +2563,13 @@ TEST_P(LdsRdsTest, RouteMatchHasInvalidPathMissingService) { const auto& response_state = RouteConfigurationResponseState(0); EXPECT_EQ(response_state.state, AdsServiceImpl::ResponseState::NACKED); EXPECT_EQ(response_state.error_message, "Path contains empty service name"); + gpr_unsetenv("GRPC_XDS_EXPERIMENTAL_ROUTING"); } // Tests that LDS client should send a NACK if route match has path // string that is missing method. TEST_P(LdsRdsTest, RouteMatchHasInvalidPathMissingMethod) { - ResetStub(/*failover_timeout=*/0, - /*expected_targets=*/"", - /*xds_resource_does_not_exist_timeout*/ 0, - /*xds_routing_enabled=*/true); + gpr_setenv("GRPC_XDS_EXPERIMENTAL_ROUTING", "true"); RouteConfiguration route_config = balancers_[0]->ads_service()->default_route_config(); auto* route1 = route_config.mutable_virtual_hosts(0)->mutable_routes(0); @@ -2611,6 +2584,7 @@ TEST_P(LdsRdsTest, RouteMatchHasInvalidPathMissingMethod) { const auto& response_state = RouteConfigurationResponseState(0); EXPECT_EQ(response_state.state, AdsServiceImpl::ResponseState::NACKED); EXPECT_EQ(response_state.error_message, "Path contains empty method name"); + gpr_unsetenv("GRPC_XDS_EXPERIMENTAL_ROUTING"); } // Tests that LDS client should send a NACK if route has an action other than @@ -2649,10 +2623,7 @@ TEST_P(LdsRdsTest, RouteActionUnsupportedClusterSpecifier) { } TEST_P(LdsRdsTest, RouteActionClusterHasEmptyClusterName) { - ResetStub(/*failover_timeout=*/0, - /*expected_targets=*/"", - /*xds_resource_does_not_exist_timeout*/ 0, - /*xds_routing_enabled=*/true); + gpr_setenv("GRPC_XDS_EXPERIMENTAL_ROUTING", "true"); RouteConfiguration route_config = balancers_[0]->ads_service()->default_route_config(); auto* route1 = route_config.mutable_virtual_hosts(0)->mutable_routes(0); @@ -2669,13 +2640,11 @@ TEST_P(LdsRdsTest, RouteActionClusterHasEmptyClusterName) { EXPECT_EQ(response_state.state, AdsServiceImpl::ResponseState::NACKED); EXPECT_EQ(response_state.error_message, "RouteAction cluster contains empty cluster name."); + gpr_unsetenv("GRPC_XDS_EXPERIMENTAL_ROUTING"); } TEST_P(LdsRdsTest, RouteActionWeightedTargetHasIncorrectTotalWeightSet) { - ResetStub(/*failover_timeout=*/0, - /*expected_targets=*/"", - /*xds_resource_does_not_exist_timeout*/ 0, - /*xds_routing_enabled=*/true); + gpr_setenv("GRPC_XDS_EXPERIMENTAL_ROUTING", "true"); const size_t kWeight75 = 75; const char* kNewCluster1Name = "new_cluster_1"; RouteConfiguration route_config = @@ -2701,13 +2670,11 @@ TEST_P(LdsRdsTest, RouteActionWeightedTargetHasIncorrectTotalWeightSet) { EXPECT_EQ(response_state.state, AdsServiceImpl::ResponseState::NACKED); EXPECT_EQ(response_state.error_message, "RouteAction weighted_cluster has incorrect total weight"); + gpr_unsetenv("GRPC_XDS_EXPERIMENTAL_ROUTING"); } TEST_P(LdsRdsTest, RouteActionWeightedTargetClusterHasEmptyClusterName) { - ResetStub(/*failover_timeout=*/0, - /*expected_targets=*/"", - /*xds_resource_does_not_exist_timeout*/ 0, - /*xds_routing_enabled=*/true); + gpr_setenv("GRPC_XDS_EXPERIMENTAL_ROUTING", "true"); const size_t kWeight75 = 75; RouteConfiguration route_config = balancers_[0]->ads_service()->default_route_config(); @@ -2733,13 +2700,11 @@ TEST_P(LdsRdsTest, RouteActionWeightedTargetClusterHasEmptyClusterName) { EXPECT_EQ( response_state.error_message, "RouteAction weighted_cluster cluster contains empty cluster name."); + gpr_unsetenv("GRPC_XDS_EXPERIMENTAL_ROUTING"); } TEST_P(LdsRdsTest, RouteActionWeightedTargetClusterHasNoWeight) { - ResetStub(/*failover_timeout=*/0, - /*expected_targets=*/"", - /*xds_resource_does_not_exist_timeout*/ 0, - /*xds_routing_enabled=*/true); + gpr_setenv("GRPC_XDS_EXPERIMENTAL_ROUTING", "true"); const size_t kWeight75 = 75; const char* kNewCluster1Name = "new_cluster_1"; RouteConfiguration route_config = @@ -2764,6 +2729,7 @@ TEST_P(LdsRdsTest, RouteActionWeightedTargetClusterHasNoWeight) { EXPECT_EQ(response_state.state, AdsServiceImpl::ResponseState::NACKED); EXPECT_EQ(response_state.error_message, "RouteAction weighted_cluster cluster missing weight"); + gpr_unsetenv("GRPC_XDS_EXPERIMENTAL_ROUTING"); } // Tests that LDS client times out when no response received. @@ -2782,10 +2748,7 @@ TEST_P(LdsRdsTest, Timeout) { // Tests that LDS client should choose the default route (with no matching // specified) after unable to find a match with previous routes. TEST_P(LdsRdsTest, XdsRoutingPathMatching) { - ResetStub(/*failover_timeout=*/0, - /*expected_targets=*/"", - /*xds_resource_does_not_exist_timeout*/ 0, - /*xds_routing_enabled=*/true); + gpr_setenv("GRPC_XDS_EXPERIMENTAL_ROUTING", "true"); const char* kNewCluster1Name = "new_cluster_1"; const char* kNewCluster2Name = "new_cluster_2"; const size_t kNumEcho1Rpcs = 10; @@ -2855,13 +2818,11 @@ TEST_P(LdsRdsTest, XdsRoutingPathMatching) { EXPECT_EQ(0, backends_[3]->backend_service()->request_count()); EXPECT_EQ(0, backends_[3]->backend_service1()->request_count()); EXPECT_EQ(kNumEcho2Rpcs, backends_[3]->backend_service2()->request_count()); + gpr_unsetenv("GRPC_XDS_EXPERIMENTAL_ROUTING"); } TEST_P(LdsRdsTest, XdsRoutingPrefixMatching) { - ResetStub(/*failover_timeout=*/0, - /*expected_targets=*/"", - /*xds_resource_does_not_exist_timeout*/ 0, - /*xds_routing_enabled=*/true); + gpr_setenv("GRPC_XDS_EXPERIMENTAL_ROUTING", "true"); const char* kNewCluster1Name = "new_cluster_1"; const char* kNewCluster2Name = "new_cluster_2"; const size_t kNumEcho1Rpcs = 10; @@ -2926,13 +2887,11 @@ TEST_P(LdsRdsTest, XdsRoutingPrefixMatching) { EXPECT_EQ(0, backends_[3]->backend_service()->request_count()); EXPECT_EQ(0, backends_[3]->backend_service1()->request_count()); EXPECT_EQ(kNumEcho2Rpcs, backends_[3]->backend_service2()->request_count()); + gpr_unsetenv("GRPC_XDS_EXPERIMENTAL_ROUTING"); } TEST_P(LdsRdsTest, XdsRoutingWeightedCluster) { - ResetStub(/*failover_timeout=*/0, - /*expected_targets=*/"", - /*xds_resource_does_not_exist_timeout*/ 0, - /*xds_routing_enabled=*/true); + gpr_setenv("GRPC_XDS_EXPERIMENTAL_ROUTING", "true"); const char* kNewCluster1Name = "new_cluster_1"; const char* kNewCluster2Name = "new_cluster_2"; const size_t kNumEcho1Rpcs = 1000; @@ -3009,13 +2968,11 @@ TEST_P(LdsRdsTest, XdsRoutingWeightedCluster) { (1 - kErrorTolerance)), ::testing::Le(kNumEcho1Rpcs * kWeight25 / 100 * (1 + kErrorTolerance)))); + gpr_unsetenv("GRPC_XDS_EXPERIMENTAL_ROUTING"); } TEST_P(LdsRdsTest, XdsRoutingWeightedClusterUpdateWeights) { - ResetStub(/*failover_timeout=*/0, - /*expected_targets=*/"", - /*xds_resource_does_not_exist_timeout*/ 0, - /*xds_routing_enabled=*/true); + gpr_setenv("GRPC_XDS_EXPERIMENTAL_ROUTING", "true"); const char* kNewCluster1Name = "new_cluster_1"; const char* kNewCluster2Name = "anew_cluster_2"; const char* kNewCluster3Name = "new_cluster_3"; @@ -3137,13 +3094,11 @@ TEST_P(LdsRdsTest, XdsRoutingWeightedClusterUpdateWeights) { (1 - kErrorTolerance)), ::testing::Le(kNumEcho1Rpcs * kWeight50 / 100 * (1 + kErrorTolerance)))); + gpr_unsetenv("GRPC_XDS_EXPERIMENTAL_ROUTING"); } TEST_P(LdsRdsTest, XdsRoutingWeightedClusterUpdateClusters) { - ResetStub(/*failover_timeout=*/0, - /*expected_targets=*/"", - /*xds_resource_does_not_exist_timeout*/ 0, - /*xds_routing_enabled=*/true); + gpr_setenv("GRPC_XDS_EXPERIMENTAL_ROUTING", "true"); const char* kNewCluster1Name = "new_cluster_1"; const char* kNewCluster2Name = "anew_cluster_2"; const char* kNewCluster3Name = "new_cluster_3"; @@ -3290,6 +3245,7 @@ TEST_P(LdsRdsTest, XdsRoutingWeightedClusterUpdateClusters) { (1 - kErrorTolerance)), ::testing::Le(kNumEcho1Rpcs * kWeight25 / 100 * (1 + kErrorTolerance)))); + gpr_unsetenv("GRPC_XDS_EXPERIMENTAL_ROUTING"); } using CdsTest = BasicTest;