aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp
diff options
context:
space:
mode:
authorGravatar Yang Gao <yangg@google.com>2015-08-05 11:47:30 -0700
committerGravatar Yang Gao <yangg@google.com>2015-08-05 11:47:30 -0700
commitd2e9cb3b92623c059112668517593d096f28333f (patch)
treef36378df6efadab4046ac4a0adfd26adb30efdd1 /test/cpp
parent9f007f059764133a49fdf7210ce9881bc38e9c05 (diff)
parent220adcc745a9c60cf3bab00f020b2fce8c3b7c9d (diff)
Merge pull request #2765 from ctiller/the-test-be-sleepy
Fix edge cases in CHTTP2 resulting in lose of send close from clients
Diffstat (limited to 'test/cpp')
-rw-r--r--test/cpp/end2end/end2end_test.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc
index f39c6cf82a..3144ca4dc7 100644
--- a/test/cpp/end2end/end2end_test.cc
+++ b/test/cpp/end2end/end2end_test.cc
@@ -830,6 +830,31 @@ TEST_F(End2endTest, HugeResponse) {
EXPECT_TRUE(s.ok());
}
+namespace {
+void ReaderThreadFunc(ClientReaderWriter<EchoRequest, EchoResponse>* stream, gpr_event *ev) {
+ EchoResponse resp;
+ gpr_event_set(ev, (void*)1);
+ while (stream->Read(&resp)) {
+ gpr_log(GPR_INFO, "Read message");
+ }
+}
+} // namespace
+
+// Run a Read and a WritesDone simultaneously.
+TEST_F(End2endTest, SimultaneousReadWritesDone) {
+ ResetStub();
+ ClientContext context;
+ gpr_event ev;
+ gpr_event_init(&ev);
+ auto stream = stub_->BidiStream(&context);
+ std::thread reader_thread(ReaderThreadFunc, stream.get(), &ev);
+ gpr_event_wait(&ev, gpr_inf_future(GPR_CLOCK_REALTIME));
+ stream->WritesDone();
+ Status s = stream->Finish();
+ EXPECT_TRUE(s.ok());
+ reader_thread.join();
+}
+
TEST_F(End2endTest, Peer) {
ResetStub();
EchoRequest request;