diff options
author | Yang Gao <yangg@google.com> | 2015-04-30 16:07:06 -0700 |
---|---|---|
committer | Yang Gao <yangg@google.com> | 2015-04-30 16:07:06 -0700 |
commit | 3921c56bee2adff62cb0f9519114d2aa22a67410 (patch) | |
tree | 7fdd42a532ca2040b15441d92bcd0b66eccf0397 /test/cpp/end2end | |
parent | 6d42a73bb984e19eb1bf84e2a952eec861cea464 (diff) |
Expose max message size at the server side
Diffstat (limited to 'test/cpp/end2end')
-rw-r--r-- | test/cpp/end2end/end2end_test.cc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 5e89490ecb..77c45d0cf9 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -172,7 +172,7 @@ class TestServiceImplDupPkg class End2endTest : public ::testing::Test { protected: - End2endTest() : thread_pool_(2) {} + End2endTest() : kMaxMessageSize_(8192), thread_pool_(2) {} void SetUp() GRPC_OVERRIDE { int port = grpc_pick_unused_port_or_die(); @@ -182,6 +182,7 @@ class End2endTest : public ::testing::Test { builder.AddListeningPort(server_address_.str(), InsecureServerCredentials()); builder.RegisterService(&service_); + builder.SetMaxMessageSize(kMaxMessageSize_); // For testing max message size. builder.RegisterService(&dup_pkg_service_); builder.SetThreadPool(&thread_pool_); server_ = builder.BuildAndStart(); @@ -198,11 +199,13 @@ class End2endTest : public ::testing::Test { std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_; std::unique_ptr<Server> server_; std::ostringstream server_address_; + const int kMaxMessageSize_; TestServiceImpl service_; TestServiceImplDupPkg dup_pkg_service_; ThreadPool thread_pool_; }; +/* static void SendRpc(grpc::cpp::test::util::TestService::Stub* stub, int num_rpcs) { EchoRequest request; @@ -575,7 +578,18 @@ TEST_F(End2endTest, ClientCancelsBidi) { Status s = stream->Finish(); EXPECT_EQ(grpc::StatusCode::CANCELLED, s.code()); } +*/ + +TEST_F(End2endTest, RpcMaxMessageSize) { + ResetStub(); + EchoRequest request; + EchoResponse response; + request.set_message(string(kMaxMessageSize_*2, 'a')); + ClientContext context; + Status s = stub_->Echo(&context, request, &response); + EXPECT_FALSE(s.IsOk()); +} } // namespace testing } // namespace grpc |