aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/end2end/client_callback_end2end_test.cc
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2018-09-18 12:09:02 -0700
committerGravatar Vijay Pai <vpai@google.com>2018-09-18 12:09:02 -0700
commita1e87be37754afd0a6ec4f0319b2e452f8443cab (patch)
treeaec20d702d491ec767a71168a0e02e119c9dbbac /test/cpp/end2end/client_callback_end2end_test.cc
parent42a0ed43cba18b0c9dc1d181ad50b9f2e0b89e69 (diff)
parent0e5b2a7946a80e53bc43775f8a5edb7cfe0494b7 (diff)
Merge branch 'master' into callback_codegen_client_unary
Diffstat (limited to 'test/cpp/end2end/client_callback_end2end_test.cc')
-rw-r--r--test/cpp/end2end/client_callback_end2end_test.cc22
1 files changed, 19 insertions, 3 deletions
diff --git a/test/cpp/end2end/client_callback_end2end_test.cc b/test/cpp/end2end/client_callback_end2end_test.cc
index 29893b451c..77ff0a5c95 100644
--- a/test/cpp/end2end/client_callback_end2end_test.cc
+++ b/test/cpp/end2end/client_callback_end2end_test.cc
@@ -65,6 +65,7 @@ class ClientCallbackEnd2endTest : public ::testing::Test {
}
}
+<<<<<<< HEAD
void SendRpcs(int num_rpcs) {
grpc::string test_string("");
for (int i = 0; i < num_rpcs; i++) {
@@ -96,6 +97,9 @@ class ClientCallbackEnd2endTest : public ::testing::Test {
}
void SendRpcsGeneric(int num_rpcs) {
+=======
+ void SendRpcs(int num_rpcs, bool maybe_except) {
+>>>>>>> master
const grpc::string kMethodName("/grpc.testing.EchoTestService/Echo");
grpc::string test_string("");
for (int i = 0; i < num_rpcs; i++) {
@@ -113,7 +117,7 @@ class ClientCallbackEnd2endTest : public ::testing::Test {
bool done = false;
generic_stub_->experimental().UnaryCall(
&cli_ctx, kMethodName, send_buf.get(), &recv_buf,
- [&request, &recv_buf, &done, &mu, &cv](Status s) {
+ [&request, &recv_buf, &done, &mu, &cv, maybe_except](Status s) {
GPR_ASSERT(s.ok());
EchoResponse response;
@@ -122,6 +126,11 @@ class ClientCallbackEnd2endTest : public ::testing::Test {
std::lock_guard<std::mutex> l(mu);
done = true;
cv.notify_one();
+#if GRPC_ALLOW_EXCEPTIONS
+ if (maybe_except) {
+ throw - 1;
+ }
+#endif
});
std::unique_lock<std::mutex> l(mu);
while (!done) {
@@ -140,12 +149,12 @@ class ClientCallbackEnd2endTest : public ::testing::Test {
TEST_F(ClientCallbackEnd2endTest, SimpleRpc) {
ResetStub();
- SendRpcs(1);
+ SendRpcs(1, false);
}
TEST_F(ClientCallbackEnd2endTest, SequentialRpcs) {
ResetStub();
- SendRpcs(10);
+ SendRpcs(10, false);
}
TEST_F(ClientCallbackEnd2endTest, SequentialGenericRpcs) {
@@ -153,6 +162,13 @@ TEST_F(ClientCallbackEnd2endTest, SequentialGenericRpcs) {
SendRpcsGeneric(10);
}
+#if GRPC_ALLOW_EXCEPTIONS
+TEST_F(ClientCallbackEnd2endTest, ExceptingRpc) {
+ ResetStub();
+ SendRpcs(10, true);
+}
+#endif
+
} // namespace
} // namespace testing
} // namespace grpc