diff options
author | Yash Tibrewal <yashkt@google.com> | 2018-11-15 13:55:56 -0800 |
---|---|---|
committer | Yash Tibrewal <yashkt@google.com> | 2018-11-15 13:55:56 -0800 |
commit | 0911e489e3fe22e2ca5d7c927dac83358f2f05b7 (patch) | |
tree | f20fe0049cb0303e370e7a751416a8b2ea02521f /test | |
parent | ceeb28a360d48389edb8c1c91a1efac46e24a9b7 (diff) |
Add a method to check whether the message was received successfully
Diffstat (limited to 'test')
-rw-r--r-- | test/cpp/end2end/client_interceptors_end2end_test.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/cpp/end2end/client_interceptors_end2end_test.cc b/test/cpp/end2end/client_interceptors_end2end_test.cc index 459788ba51..4d4760a652 100644 --- a/test/cpp/end2end/client_interceptors_end2end_test.cc +++ b/test/cpp/end2end/client_interceptors_end2end_test.cc @@ -326,6 +326,12 @@ class ServerStreamingRpcHijackingInterceptor resp->set_message("Hello"); } if (methods->QueryInterceptionHookPoint( + experimental::InterceptionHookPoints::POST_RECV_MESSAGE)) { + // Only the last message will be a failure + EXPECT_FALSE(got_failed_message_); + got_failed_message_ = !methods->GetRecvMessageStatus(); + } + if (methods->QueryInterceptionHookPoint( experimental::InterceptionHookPoints::PRE_RECV_STATUS)) { auto* map = methods->GetRecvTrailingMetadata(); // insert the metadata that we want @@ -341,11 +347,16 @@ class ServerStreamingRpcHijackingInterceptor } } + static bool GotFailedMessage() { return got_failed_message_; } + private: experimental::ClientRpcInfo* info_; + static bool got_failed_message_; int count_ = 0; }; +bool ServerStreamingRpcHijackingInterceptor::got_failed_message_ = false; + class ServerStreamingRpcHijackingInterceptorFactory : public experimental::ClientInterceptorFactoryInterface { public: @@ -634,6 +645,7 @@ TEST_F(ClientInterceptorsStreamingEnd2endTest, ServerStreamingHijackingTest) { auto channel = experimental::CreateCustomChannelWithInterceptors( server_address_, InsecureChannelCredentials(), args, std::move(creators)); MakeServerStreamingCall(channel); + EXPECT_TRUE(ServerStreamingRpcHijackingInterceptor::GotFailedMessage()); } TEST_F(ClientInterceptorsStreamingEnd2endTest, BidiStreamingTest) { |