Skip to content
Snippets Groups Projects
Commit 8ab38368 authored by yang-g's avatar yang-g
Browse files

add a test where a read and a writesdone happen at the same time

parent 5f8d05bb
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment