aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/end2end/end2end_test.cc
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2015-08-13 15:30:01 -0700
committerGravatar Vijay Pai <vpai@google.com>2015-08-13 15:30:01 -0700
commit8c0389d84e2df505d5fee065180a73e20f9db98f (patch)
tree4ca1c33b7872563a415e989071b64d9e4429df22 /test/cpp/end2end/end2end_test.cc
parentd9c1bc7281cac61472ba2cd6d39c1d5b878cc3bc (diff)
parent523201cee080457cb1386f729c2af4cff1477c92 (diff)
Merge pull request #2921 from yang-g/unknown_service
Use a sync service to handle requests to unknown services
Diffstat (limited to 'test/cpp/end2end/end2end_test.cc')
-rw-r--r--test/cpp/end2end/end2end_test.cc23
1 files changed, 22 insertions, 1 deletions
diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc
index 37669815c6..3827cdf730 100644
--- a/test/cpp/end2end/end2end_test.cc
+++ b/test/cpp/end2end/end2end_test.cc
@@ -290,13 +290,17 @@ class End2endTest : public ::testing::TestWithParam<bool> {
if (proxy_server_) proxy_server_->Shutdown();
}
- void ResetStub(bool use_proxy) {
+ void ResetChannel() {
SslCredentialsOptions ssl_opts = {test_root_cert, "", ""};
ChannelArguments args;
args.SetSslTargetNameOverride("foo.test.google.fr");
args.SetString(GRPC_ARG_SECONDARY_USER_AGENT_STRING, "end2end_test");
channel_ = CreateChannel(server_address_.str(), SslCredentials(ssl_opts),
args);
+ }
+
+ void ResetStub(bool use_proxy) {
+ ResetChannel();
if (use_proxy) {
proxy_service_.reset(new Proxy(channel_));
int port = grpc_pick_unused_port_or_die();
@@ -930,6 +934,23 @@ TEST_F(End2endTest, ChannelState) {
EXPECT_EQ(GRPC_CHANNEL_CONNECTING, channel_->GetState(false));
}
+// Talking to a non-existing service.
+TEST_F(End2endTest, NonExistingService) {
+ ResetChannel();
+ std::unique_ptr<grpc::cpp::test::util::UnimplementedService::Stub> stub;
+ stub =
+ std::move(grpc::cpp::test::util::UnimplementedService::NewStub(channel_));
+
+ EchoRequest request;
+ EchoResponse response;
+ request.set_message("Hello");
+
+ ClientContext context;
+ Status s = stub->Unimplemented(&context, request, &response);
+ EXPECT_EQ(StatusCode::UNIMPLEMENTED, s.error_code());
+ EXPECT_EQ("", s.error_message());
+}
+
INSTANTIATE_TEST_CASE_P(End2end, End2endTest, ::testing::Values(false, true));
} // namespace testing