|
|
|
@ -52,7 +52,6 @@ |
|
|
|
|
#include "src/proto/grpc/testing/xds/v3/round_robin.pb.h" |
|
|
|
|
#include "src/proto/grpc/testing/xds/v3/typed_struct.pb.h" |
|
|
|
|
#include "src/proto/grpc/testing/xds/v3/wrr_locality.pb.h" |
|
|
|
|
#include "test/core/util/scoped_env_var.h" |
|
|
|
|
#include "test/core/util/test_config.h" |
|
|
|
|
|
|
|
|
|
namespace grpc_core { |
|
|
|
@ -131,7 +130,6 @@ TEST(RoundRobin, Basic) { |
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
TEST(ClientSideWeightedRoundRobinTest, DefaultConfig) { |
|
|
|
|
ScopedExperimentalEnvVar env_var("GRPC_EXPERIMENTAL_XDS_WRR_LB"); |
|
|
|
|
LoadBalancingPolicyProto policy; |
|
|
|
|
policy.add_policies() |
|
|
|
|
->mutable_typed_extension_config() |
|
|
|
@ -139,11 +137,10 @@ TEST(ClientSideWeightedRoundRobinTest, DefaultConfig) { |
|
|
|
|
->PackFrom(ClientSideWeightedRoundRobin()); |
|
|
|
|
auto result = ConvertXdsPolicy(policy); |
|
|
|
|
ASSERT_TRUE(result.ok()) << result.status(); |
|
|
|
|
EXPECT_EQ(*result, "{\"weighted_round_robin_experimental\":{}}"); |
|
|
|
|
EXPECT_EQ(*result, "{\"weighted_round_robin\":{}}"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST(ClientSideWeightedRoundRobinTest, FieldsExplicitlySet) { |
|
|
|
|
ScopedExperimentalEnvVar env_var("GRPC_EXPERIMENTAL_XDS_WRR_LB"); |
|
|
|
|
ClientSideWeightedRoundRobin wrr; |
|
|
|
|
wrr.mutable_enable_oob_load_report()->set_value(true); |
|
|
|
|
wrr.mutable_oob_reporting_period()->set_seconds(1); |
|
|
|
@ -159,7 +156,7 @@ TEST(ClientSideWeightedRoundRobinTest, FieldsExplicitlySet) { |
|
|
|
|
auto result = ConvertXdsPolicy(policy); |
|
|
|
|
ASSERT_TRUE(result.ok()) << result.status(); |
|
|
|
|
EXPECT_EQ(*result, |
|
|
|
|
"{\"weighted_round_robin_experimental\":{" |
|
|
|
|
"{\"weighted_round_robin\":{" |
|
|
|
|
"\"blackoutPeriod\":\"2.000000000s\"," |
|
|
|
|
"\"enableOobLoadReport\":true," |
|
|
|
|
"\"errorUtilizationPenalty\":5.000000," |
|
|
|
@ -170,7 +167,6 @@ TEST(ClientSideWeightedRoundRobinTest, FieldsExplicitlySet) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST(ClientSideWeightedRoundRobinTest, InvalidValues) { |
|
|
|
|
ScopedExperimentalEnvVar env_var("GRPC_EXPERIMENTAL_XDS_WRR_LB"); |
|
|
|
|
ClientSideWeightedRoundRobin wrr; |
|
|
|
|
wrr.mutable_oob_reporting_period()->set_seconds(-1); |
|
|
|
|
wrr.mutable_blackout_period()->set_seconds(-2); |
|
|
|
@ -213,20 +209,6 @@ TEST(ClientSideWeightedRoundRobinTest, InvalidValues) { |
|
|
|
|
<< result.status(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST(ClientSideWeightedRoundRobinTest, EnvVarNotEnabled) { |
|
|
|
|
LoadBalancingPolicyProto policy; |
|
|
|
|
policy.add_policies() |
|
|
|
|
->mutable_typed_extension_config() |
|
|
|
|
->mutable_typed_config() |
|
|
|
|
->PackFrom(ClientSideWeightedRoundRobin()); |
|
|
|
|
auto result = ConvertXdsPolicy(policy); |
|
|
|
|
EXPECT_EQ(result.status().code(), absl::StatusCode::kInvalidArgument); |
|
|
|
|
EXPECT_EQ(result.status().message(), |
|
|
|
|
"validation errors: [field:load_balancing_policy " |
|
|
|
|
"error:no supported load balancing policy config found]") |
|
|
|
|
<< result.status(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// RingHash
|
|
|
|
|
//
|
|
|
|
|