|
|
@ -233,9 +233,6 @@ class ClientLbEnd2endTest : public ::testing::Test { |
|
|
|
for (size_t i = 0; i < servers_.size(); ++i) { |
|
|
|
for (size_t i = 0; i < servers_.size(); ++i) { |
|
|
|
servers_[i]->Shutdown(); |
|
|
|
servers_[i]->Shutdown(); |
|
|
|
} |
|
|
|
} |
|
|
|
// Explicitly destroy all the members so that we can make sure grpc_shutdown
|
|
|
|
|
|
|
|
// has finished by the end of this function, and thus all the registered
|
|
|
|
|
|
|
|
// LB policy factories are removed.
|
|
|
|
|
|
|
|
servers_.clear(); |
|
|
|
servers_.clear(); |
|
|
|
creds_.reset(); |
|
|
|
creds_.reset(); |
|
|
|
grpc_shutdown_blocking(); |
|
|
|
grpc_shutdown_blocking(); |
|
|
@ -1639,12 +1636,19 @@ class ClientLbInterceptTrailingMetadataTest : public ClientLbEnd2endTest { |
|
|
|
protected: |
|
|
|
protected: |
|
|
|
void SetUp() override { |
|
|
|
void SetUp() override { |
|
|
|
ClientLbEnd2endTest::SetUp(); |
|
|
|
ClientLbEnd2endTest::SetUp(); |
|
|
|
grpc_core::RegisterInterceptRecvTrailingMetadataLoadBalancingPolicy( |
|
|
|
current_test_instance_ = this; |
|
|
|
ReportTrailerIntercepted, this); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void TearDown() override { ClientLbEnd2endTest::TearDown(); } |
|
|
|
void TearDown() override { ClientLbEnd2endTest::TearDown(); } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void SetUpTestCase() { |
|
|
|
|
|
|
|
grpc_init(); |
|
|
|
|
|
|
|
grpc_core::RegisterInterceptRecvTrailingMetadataLoadBalancingPolicy( |
|
|
|
|
|
|
|
ReportTrailerIntercepted, nullptr); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void TearDownTestCase() { grpc_shutdown_blocking(); } |
|
|
|
|
|
|
|
|
|
|
|
int trailers_intercepted() { |
|
|
|
int trailers_intercepted() { |
|
|
|
grpc::internal::MutexLock lock(&mu_); |
|
|
|
grpc::internal::MutexLock lock(&mu_); |
|
|
|
return trailers_intercepted_; |
|
|
|
return trailers_intercepted_; |
|
|
@ -1659,8 +1663,7 @@ class ClientLbInterceptTrailingMetadataTest : public ClientLbEnd2endTest { |
|
|
|
static void ReportTrailerIntercepted( |
|
|
|
static void ReportTrailerIntercepted( |
|
|
|
void* arg, const grpc_core::LoadBalancingPolicy::BackendMetricData* |
|
|
|
void* arg, const grpc_core::LoadBalancingPolicy::BackendMetricData* |
|
|
|
backend_metric_data) { |
|
|
|
backend_metric_data) { |
|
|
|
ClientLbInterceptTrailingMetadataTest* self = |
|
|
|
ClientLbInterceptTrailingMetadataTest* self = current_test_instance_; |
|
|
|
static_cast<ClientLbInterceptTrailingMetadataTest*>(arg); |
|
|
|
|
|
|
|
grpc::internal::MutexLock lock(&self->mu_); |
|
|
|
grpc::internal::MutexLock lock(&self->mu_); |
|
|
|
self->trailers_intercepted_++; |
|
|
|
self->trailers_intercepted_++; |
|
|
|
if (backend_metric_data != nullptr) { |
|
|
|
if (backend_metric_data != nullptr) { |
|
|
@ -1683,11 +1686,15 @@ class ClientLbInterceptTrailingMetadataTest : public ClientLbEnd2endTest { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static ClientLbInterceptTrailingMetadataTest* current_test_instance_; |
|
|
|
grpc::internal::Mutex mu_; |
|
|
|
grpc::internal::Mutex mu_; |
|
|
|
int trailers_intercepted_ = 0; |
|
|
|
int trailers_intercepted_ = 0; |
|
|
|
std::unique_ptr<udpa::data::orca::v1::OrcaLoadReport> load_report_; |
|
|
|
std::unique_ptr<udpa::data::orca::v1::OrcaLoadReport> load_report_; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ClientLbInterceptTrailingMetadataTest* |
|
|
|
|
|
|
|
ClientLbInterceptTrailingMetadataTest::current_test_instance_ = nullptr; |
|
|
|
|
|
|
|
|
|
|
|
TEST_F(ClientLbInterceptTrailingMetadataTest, InterceptsRetriesDisabled) { |
|
|
|
TEST_F(ClientLbInterceptTrailingMetadataTest, InterceptsRetriesDisabled) { |
|
|
|
const int kNumServers = 1; |
|
|
|
const int kNumServers = 1; |
|
|
|
const int kNumRpcs = 10; |
|
|
|
const int kNumRpcs = 10; |
|
|
|