diff options
-rw-r--r-- | test/cpp/end2end/end2end_test.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 5b351c169e..f6e55f3cba 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -818,6 +818,27 @@ TEST_F(End2endTest, HugeResponse) { EXPECT_TRUE(s.ok()); } +namespace { +void ReaderThreadFunc(ClientReaderWriter<EchoRequest, EchoResponse>* stream) { + EchoResponse resp; + while (stream->Read(&resp)) { + gpr_log(GPR_INFO, "Read message"); + } +} +} // namespace + +// Run a Read and a WritesDone simultaneously. +TEST_F(End2endTest, SimuReadWritesDone) { + ResetStub(); + ClientContext context; + auto stream = stub_->BidiStream(&context); + std::thread reader_thread(ReaderThreadFunc, stream.get()); + stream->WritesDone(); + Status s = stream->Finish(); + EXPECT_TRUE(s.ok()); + reader_thread.join(); +} + } // namespace testing } // namespace grpc |