Revert "Add dummy interceptors to end2end_test and async_end2end_test"

This reverts commit d075719477.
pull/16842/head
Yash Tibrewal 7 years ago
parent d075719477
commit d21a175b28
  1. 63
      test/cpp/end2end/async_end2end_test.cc
  2. 65
      test/cpp/end2end/end2end_test.cc

@ -246,53 +246,6 @@ void TestScenario::Log() const {
class HealthCheck : public health::v1::Health::Service {};
/* This interceptor does nothing. Just keeps a global count on the number of
* times it was invoked. */
class DummyInterceptor : public experimental::Interceptor {
public:
DummyInterceptor(experimental::ClientRpcInfo* info) {}
virtual void Intercept(experimental::InterceptorBatchMethods* methods) {
if (methods->QueryInterceptionHookPoint(
experimental::InterceptionHookPoints::PRE_SEND_INITIAL_METADATA)) {
num_times_run_++;
} else if (methods->QueryInterceptionHookPoint(
experimental::InterceptionHookPoints::
POST_RECV_INITIAL_METADATA)) {
num_times_run_reverse_++;
}
methods->Proceed();
}
static void Reset() {
num_times_run_.store(0);
num_times_run_reverse_.store(0);
}
static int GetNumTimesRun() {
EXPECT_EQ(num_times_run_.load(), num_times_run_reverse_.load());
return num_times_run_.load();
}
static const int kNumInterceptorsRegistered = 5;
private:
static std::atomic<int> num_times_run_;
static std::atomic<int> num_times_run_reverse_;
};
std::atomic<int> DummyInterceptor::num_times_run_;
std::atomic<int> DummyInterceptor::num_times_run_reverse_;
class DummyInterceptorFactory
: public experimental::ClientInterceptorFactoryInterface {
public:
virtual experimental::Interceptor* CreateClientInterceptor(
experimental::ClientRpcInfo* info) override {
return new DummyInterceptor(info);
}
};
class AsyncEnd2endTest : public ::testing::TestWithParam<TestScenario> {
protected:
AsyncEnd2endTest() { GetParam().Log(); }
@ -340,22 +293,10 @@ class AsyncEnd2endTest : public ::testing::TestWithParam<TestScenario> {
ChannelArguments args;
auto channel_creds = GetCredentialsProvider()->GetChannelCredentials(
GetParam().credentials_type, &args);
auto creators = std::unique_ptr<std::vector<
std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>>(
new std::vector<std::unique_ptr<
experimental::ClientInterceptorFactoryInterface>>());
// Add dummy interceptors
for (auto i = 0; i < DummyInterceptor::kNumInterceptorsRegistered; i++) {
creators->push_back(std::unique_ptr<DummyInterceptorFactory>(
new DummyInterceptorFactory()));
}
std::shared_ptr<Channel> channel =
!(GetParam().inproc)
? CreateCustomChannelWithInterceptors(server_address_.str(),
channel_creds, args,
std::move(creators))
: server_->experimental().InProcessChannelWithInterceptors(
args, std::move(creators));
? CreateCustomChannel(server_address_.str(), channel_creds, args)
: server_->InProcessChannel(args);
stub_ = grpc::testing::EchoTestService::NewStub(channel);
}

@ -179,7 +179,7 @@ class Proxy : public ::grpc::testing::EchoTestService::Service {
}
private:
std::unique_ptr<::grpc::testing::EchoTestService::Stub> stub_;
std::unique_ptr< ::grpc::testing::EchoTestService::Stub> stub_;
};
class TestServiceImplDupPkg
@ -216,53 +216,6 @@ void TestScenario::Log() const {
gpr_log(GPR_DEBUG, "%s", out.str().c_str());
}
/* This interceptor does nothing. Just keeps a global count on the number of
* times it was invoked. */
class DummyInterceptor : public experimental::Interceptor {
public:
DummyInterceptor(experimental::ClientRpcInfo* info) {}
virtual void Intercept(experimental::InterceptorBatchMethods* methods) {
if (methods->QueryInterceptionHookPoint(
experimental::InterceptionHookPoints::PRE_SEND_INITIAL_METADATA)) {
num_times_run_++;
} else if (methods->QueryInterceptionHookPoint(
experimental::InterceptionHookPoints::
POST_RECV_INITIAL_METADATA)) {
num_times_run_reverse_++;
}
methods->Proceed();
}
static void Reset() {
num_times_run_.store(0);
num_times_run_reverse_.store(0);
}
static int GetNumTimesRun() {
EXPECT_EQ(num_times_run_.load(), num_times_run_reverse_.load());
return num_times_run_.load();
}
static const int kNumInterceptorsRegistered = 5;
private:
static std::atomic<int> num_times_run_;
static std::atomic<int> num_times_run_reverse_;
};
std::atomic<int> DummyInterceptor::num_times_run_;
std::atomic<int> DummyInterceptor::num_times_run_reverse_;
class DummyInterceptorFactory
: public experimental::ClientInterceptorFactoryInterface {
public:
virtual experimental::Interceptor* CreateClientInterceptor(
experimental::ClientRpcInfo* info) override {
return new DummyInterceptor(info);
}
};
class End2endTest : public ::testing::TestWithParam<TestScenario> {
protected:
End2endTest()
@ -338,21 +291,11 @@ class End2endTest : public ::testing::TestWithParam<TestScenario> {
}
args.SetString(GRPC_ARG_SECONDARY_USER_AGENT_STRING, "end2end_test");
auto creators = std::unique_ptr<std::vector<
std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>>(
new std::vector<std::unique_ptr<
experimental::ClientInterceptorFactoryInterface>>());
// Add dummy interceptors
for (auto i = 0; i < DummyInterceptor::kNumInterceptorsRegistered; i++) {
creators->push_back(std::unique_ptr<DummyInterceptorFactory>(
new DummyInterceptorFactory()));
}
if (!GetParam().inproc) {
channel_ = CreateCustomChannelWithInterceptors(
server_address_.str(), channel_creds, args, std::move(creators));
channel_ =
CreateCustomChannel(server_address_.str(), channel_creds, args);
} else {
channel_ = server_->experimental().InProcessChannelWithInterceptors(
args, std::move(creators));
channel_ = server_->InProcessChannel(args);
}
}

Loading…
Cancel
Save