aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/end2end/test_service_impl.cc
diff options
context:
space:
mode:
authorGravatar murgatroid99 <mlumish@google.com>2016-03-17 14:23:31 -0700
committerGravatar murgatroid99 <mlumish@google.com>2016-03-17 14:23:31 -0700
commit7ec0fa78b2eef5f0b4f32671cc78dccc4070fdb7 (patch)
tree549253f3d2da1810c84ee94eb75f2670ef218264 /test/cpp/end2end/test_service_impl.cc
parent3c49ade48500758abcd0e701a0c7c674356e889e (diff)
parent921f4b0a6e0c77f8c1d0f48b72d7087a21f5e311 (diff)
Merge branch 'master' into binary_logging
Diffstat (limited to 'test/cpp/end2end/test_service_impl.cc')
-rw-r--r--test/cpp/end2end/test_service_impl.cc21
1 files changed, 14 insertions, 7 deletions
diff --git a/test/cpp/end2end/test_service_impl.cc b/test/cpp/end2end/test_service_impl.cc
index 66d11d0dfc..fe29c4afe9 100644
--- a/test/cpp/end2end/test_service_impl.cc
+++ b/test/cpp/end2end/test_service_impl.cc
@@ -62,14 +62,16 @@ void MaybeEchoDeadline(ServerContext* context, const EchoRequest* request,
}
}
-void CheckServerAuthContext(const ServerContext* context,
- const grpc::string& expected_client_identity) {
+void CheckServerAuthContext(
+ const ServerContext* context,
+ const grpc::string& expected_transport_security_type,
+ const grpc::string& expected_client_identity) {
std::shared_ptr<const AuthContext> auth_ctx = context->auth_context();
- std::vector<grpc::string_ref> ssl =
+ std::vector<grpc::string_ref> tst =
auth_ctx->FindPropertyValues("transport_security_type");
- EXPECT_EQ(1u, ssl.size());
- EXPECT_EQ("ssl", ToString(ssl[0]));
- if (expected_client_identity.length() == 0) {
+ EXPECT_EQ(1u, tst.size());
+ EXPECT_EQ(expected_transport_security_type, ToString(tst[0]));
+ if (expected_client_identity.empty()) {
EXPECT_TRUE(auth_ctx->GetPeerIdentityPropertyName().empty());
EXPECT_TRUE(auth_ctx->GetPeerIdentity().empty());
EXPECT_FALSE(auth_ctx->IsPeerAuthenticated());
@@ -139,6 +141,7 @@ Status TestServiceImpl::Echo(ServerContext* context, const EchoRequest* request,
(request->param().expected_client_identity().length() > 0 ||
request->param().check_auth_context())) {
CheckServerAuthContext(context,
+ request->param().expected_transport_security_type(),
request->param().expected_client_identity());
}
if (request->has_param() && request->param().response_message_length() > 0) {
@@ -326,7 +329,11 @@ void TestServiceImpl::ServerTryCancel(ServerContext* context) {
EXPECT_FALSE(context->IsCancelled());
context->TryCancel();
gpr_log(GPR_INFO, "Server called TryCancel() to cancel the request");
- EXPECT_TRUE(context->IsCancelled());
+ // Now wait until it's really canceled
+ while (!context->IsCancelled()) {
+ gpr_sleep_until(gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
+ gpr_time_from_micros(1000, GPR_TIMESPAN)));
+ }
}
} // namespace testing