Fix tests to use grpc namespace.

pull/18371/head
Karthik Ravi Shankar 6 years ago
parent a5814f89b6
commit 92bde3922f
  1. 9
      include/grpcpp/health_check_service_interface.h
  2. 8
      test/cpp/end2end/client_lb_end2end_test.cc
  3. 24
      test/cpp/end2end/health_service_end2end_test.cc

@ -28,6 +28,15 @@ const char kHealthCheckServiceInterfaceArg[] =
typedef ::grpc_impl::HealthCheckServiceInterface HealthCheckServiceInterface;
static inline void EnableDefaultHealthCheckService(bool enable) {
::grpc_impl::EnableDefaultHealthCheckService(enable);
}
static inline bool DefaultHealthCheckServiceEnabled() {
return ::grpc_impl::DefaultHealthCheckServiceEnabled();
}
} // namespace grpc
#endif // GRPCPP_HEALTH_CHECK_SERVICE_INTERFACE_H

@ -1242,7 +1242,7 @@ TEST_F(ClientLbEnd2endTest,
}
TEST_F(ClientLbEnd2endTest, RoundRobinWithHealthChecking) {
grpc_impl::EnableDefaultHealthCheckService(true);
EnableDefaultHealthCheckService(true);
// Start servers.
const int kNumServers = 3;
StartServers(kNumServers);
@ -1311,11 +1311,11 @@ TEST_F(ClientLbEnd2endTest, RoundRobinWithHealthChecking) {
EXPECT_TRUE(WaitForChannelNotReady(channel.get()));
CheckRpcSendFailure(stub);
// Clean up.
grpc_impl::EnableDefaultHealthCheckService(false);
EnableDefaultHealthCheckService(false);
}
TEST_F(ClientLbEnd2endTest, RoundRobinWithHealthCheckingInhibitPerChannel) {
grpc_impl::EnableDefaultHealthCheckService(true);
EnableDefaultHealthCheckService(true);
// Start server.
const int kNumServers = 1;
StartServers(kNumServers);
@ -1341,7 +1341,7 @@ TEST_F(ClientLbEnd2endTest, RoundRobinWithHealthCheckingInhibitPerChannel) {
EXPECT_TRUE(WaitForChannelReady(channel2.get(), 1));
CheckRpcSendOk(stub2, DEBUG_LOCATION);
// Clean up.
grpc_impl::EnableDefaultHealthCheckService(false);
EnableDefaultHealthCheckService(false);
}
class ClientLbInterceptTrailingMetadataTest : public ClientLbEnd2endTest {

@ -285,8 +285,8 @@ class HealthServiceEnd2endTest : public ::testing::Test {
};
TEST_F(HealthServiceEnd2endTest, DefaultHealthServiceDisabled) {
grpc_impl::EnableDefaultHealthCheckService(false);
EXPECT_FALSE(grpc_impl::DefaultHealthCheckServiceEnabled());
EnableDefaultHealthCheckService(false);
EXPECT_FALSE(DefaultHealthCheckServiceEnabled());
SetUpServer(true, false, false, nullptr);
HealthCheckServiceInterface* default_service =
server_->GetHealthCheckService();
@ -298,8 +298,8 @@ TEST_F(HealthServiceEnd2endTest, DefaultHealthServiceDisabled) {
}
TEST_F(HealthServiceEnd2endTest, DefaultHealthService) {
grpc_impl::EnableDefaultHealthCheckService(true);
EXPECT_TRUE(grpc_impl::DefaultHealthCheckServiceEnabled());
EnableDefaultHealthCheckService(true);
EXPECT_TRUE(DefaultHealthCheckServiceEnabled());
SetUpServer(true, false, false, nullptr);
VerifyHealthCheckService();
VerifyHealthCheckServiceStreaming();
@ -311,16 +311,16 @@ TEST_F(HealthServiceEnd2endTest, DefaultHealthService) {
}
TEST_F(HealthServiceEnd2endTest, DefaultHealthServiceShutdown) {
grpc_impl::EnableDefaultHealthCheckService(true);
EXPECT_TRUE(grpc_impl::DefaultHealthCheckServiceEnabled());
EnableDefaultHealthCheckService(true);
EXPECT_TRUE(DefaultHealthCheckServiceEnabled());
SetUpServer(true, false, false, nullptr);
VerifyHealthCheckServiceShutdown();
}
// Provide an empty service to disable the default service.
TEST_F(HealthServiceEnd2endTest, ExplicitlyDisableViaOverride) {
grpc_impl::EnableDefaultHealthCheckService(true);
EXPECT_TRUE(grpc_impl::DefaultHealthCheckServiceEnabled());
EnableDefaultHealthCheckService(true);
EXPECT_TRUE(DefaultHealthCheckServiceEnabled());
std::unique_ptr<HealthCheckServiceInterface> empty_service;
SetUpServer(true, false, true, std::move(empty_service));
grpc_impl::HealthCheckServiceInterface* service = server_->GetHealthCheckService();
@ -333,8 +333,8 @@ TEST_F(HealthServiceEnd2endTest, ExplicitlyDisableViaOverride) {
// Provide an explicit override of health checking service interface.
TEST_F(HealthServiceEnd2endTest, ExplicitlyOverride) {
grpc_impl::EnableDefaultHealthCheckService(true);
EXPECT_TRUE(grpc_impl::DefaultHealthCheckServiceEnabled());
EnableDefaultHealthCheckService(true);
EXPECT_TRUE(DefaultHealthCheckServiceEnabled());
std::unique_ptr<HealthCheckServiceInterface> override_service(
new CustomHealthCheckService(&health_check_service_impl_));
HealthCheckServiceInterface* underlying_service = override_service.get();
@ -349,8 +349,8 @@ TEST_F(HealthServiceEnd2endTest, ExplicitlyOverride) {
}
TEST_F(HealthServiceEnd2endTest, ExplicitlyHealthServiceShutdown) {
grpc_impl::EnableDefaultHealthCheckService(true);
EXPECT_TRUE(grpc_impl::DefaultHealthCheckServiceEnabled());
EnableDefaultHealthCheckService(true);
EXPECT_TRUE(DefaultHealthCheckServiceEnabled());
std::unique_ptr<HealthCheckServiceInterface> override_service(
new CustomHealthCheckService(&health_check_service_impl_));
HealthCheckServiceInterface* underlying_service = override_service.get();

Loading…
Cancel
Save