diff options
author | yang-g <yangg@google.com> | 2015-07-31 22:11:41 -0700 |
---|---|---|
committer | yang-g <yangg@google.com> | 2015-07-31 22:11:41 -0700 |
commit | 940d555a6380af61e44efd6701928fe51d23d9fa (patch) | |
tree | e5ffd8ed094b7a5d443238b4a066454d7f6859b4 /test/cpp/end2end | |
parent | 2f04c6e25849cc29e3427b37a2e3395c5d1f1a08 (diff) |
fix generic_end2end_test
Diffstat (limited to 'test/cpp/end2end')
-rw-r--r-- | test/cpp/end2end/generic_end2end_test.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc index 4951c82b9a..b53c32144b 100644 --- a/test/cpp/end2end/generic_end2end_test.cc +++ b/test/cpp/end2end/generic_end2end_test.cc @@ -100,11 +100,11 @@ std::unique_ptr<ByteBuffer> SerializeToByteBuffer( class GenericEnd2endTest : public ::testing::Test { protected: - GenericEnd2endTest() : generic_service_("*") {} + GenericEnd2endTest() : generic_service_("*"), server_host_("localhost") {} void SetUp() GRPC_OVERRIDE { int port = grpc_pick_unused_port_or_die(); - server_address_ << "localhost:" << port; + server_address_ << server_host_ << ":" << port; // Setup server ServerBuilder builder; builder.AddListeningPort(server_address_.str(), InsecureServerCredentials()); @@ -165,7 +165,7 @@ class GenericEnd2endTest : public ::testing::Test { srv_cq_.get(), tag(4)); verify_ok(srv_cq_.get(), 4, true); - EXPECT_EQ(server_address_.str(), srv_ctx.host()); + EXPECT_EQ(server_host_, srv_ctx.host()); EXPECT_EQ(kMethodName, srv_ctx.method()); ByteBuffer recv_buffer; stream.Read(&recv_buffer, tag(5)); @@ -200,6 +200,7 @@ class GenericEnd2endTest : public ::testing::Test { std::unique_ptr<grpc::GenericStub> generic_stub_; std::unique_ptr<Server> server_; AsyncGenericService generic_service_; + const grpc::string server_host_; std::ostringstream server_address_; }; @@ -237,7 +238,7 @@ TEST_F(GenericEnd2endTest, SimpleBidiStreaming) { srv_cq_.get(), tag(2)); verify_ok(srv_cq_.get(), 2, true); - EXPECT_EQ(server_address_.str(), srv_ctx.host()); + EXPECT_EQ(server_host_, srv_ctx.host()); EXPECT_EQ(kMethodName, srv_ctx.method()); std::unique_ptr<ByteBuffer> send_buffer = |