diff options
author | Craig Tiller <craig.tiller@gmail.com> | 2015-08-06 08:32:35 -0700 |
---|---|---|
committer | Craig Tiller <craig.tiller@gmail.com> | 2015-08-06 08:32:35 -0700 |
commit | 69f90e6382b64ee96b5b1a223bf834194698632d (patch) | |
tree | 16b0b10571299b6eb5a33154c27059591647d94c /test/cpp | |
parent | 5148694b2249e21468191657f004c47e2e69ed22 (diff) |
Working towards a non-blocking API test
Diffstat (limited to 'test/cpp')
-rw-r--r-- | test/cpp/end2end/async_end2end_test.cc | 221 |
1 files changed, 146 insertions, 75 deletions
diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 9b53bdc999..266c3622ea 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -56,6 +56,10 @@ #include <grpc/support/thd.h> #include <grpc/support/time.h> +#ifdef GPR_POSIX_SOCKET +#include "src/core/iomgr/pollset_posix.h" +#endif + using grpc::cpp::test::util::EchoRequest; using grpc::cpp::test::util::EchoResponse; using std::chrono::system_clock; @@ -67,18 +71,64 @@ namespace { void* tag(int i) { return (void*)(gpr_intptr) i; } -class Verifier { +#ifdef GPR_POSIX_SOCKET +static int assert_non_blocking_poll( + struct pollfd *pfds, nfds_t nfds, int timeout) { + GPR_ASSERT(timeout == 0); + return poll(pfds, nfds, timeout); +} + +class PollOverride { public: + PollOverride(grpc_poll_function_type f) { + prev_ = grpc_poll_function; + grpc_poll_function = f; + } + + ~PollOverride() { + grpc_poll_function = prev_; + } + + private: + grpc_poll_function_type prev_; +}; + +class PollingCheckRegion : public PollOverride { + public: + explicit PollingCheckRegion(bool allow_blocking) + : PollOverride(allow_blocking ? poll : assert_non_blocking_poll) {} +}; +#else +class PollingCheckRegion { + public: + explicit PollingCheckRegion(bool allow_blocking) {} +}; +#endif + +class Verifier : public PollingCheckRegion { + public: + explicit Verifier(bool spin) : PollingCheckRegion(!spin), spin_(spin) {} Verifier& Expect(int i, bool expect_ok) { expectations_[tag(i)] = expect_ok; return *this; } void Verify(CompletionQueue *cq) { + if (spin_) gpr_log(GPR_DEBUG, "spin"); GPR_ASSERT(!expectations_.empty()); while (!expectations_.empty()) { bool ok; void* got_tag; - EXPECT_TRUE(cq->Next(&got_tag, &ok)); + if (spin_) { + for (;;) { + auto r = cq->AsyncNext(&got_tag, &ok, gpr_time_0(GPR_CLOCK_REALTIME)); + if (r == CompletionQueue::TIMEOUT) continue; + if (r == CompletionQueue::GOT_EVENT) break; + gpr_log(GPR_ERROR, "unexpected result from AsyncNext"); + abort(); + } + } else { + EXPECT_TRUE(cq->Next(&got_tag, &ok)); + } auto it = expectations_.find(got_tag); EXPECT_TRUE(it != expectations_.end()); EXPECT_EQ(it->second, ok); @@ -86,15 +136,33 @@ class Verifier { } } void Verify(CompletionQueue *cq, std::chrono::system_clock::time_point deadline) { + if (spin_) gpr_log(GPR_DEBUG, "spin"); if (expectations_.empty()) { bool ok; void *got_tag; - EXPECT_EQ(cq->AsyncNext(&got_tag, &ok, deadline), CompletionQueue::TIMEOUT); + if (spin_) { + while (std::chrono::system_clock::now() < deadline) { + EXPECT_EQ(cq->AsyncNext(&got_tag, &ok, gpr_time_0(GPR_CLOCK_REALTIME)), CompletionQueue::TIMEOUT); + } + } else { + EXPECT_EQ(cq->AsyncNext(&got_tag, &ok, deadline), CompletionQueue::TIMEOUT); + } } else { while (!expectations_.empty()) { bool ok; void *got_tag; - EXPECT_EQ(cq->AsyncNext(&got_tag, &ok, deadline), CompletionQueue::GOT_EVENT); + if (spin_) { + for (;;) { + GPR_ASSERT(std::chrono::system_clock::now() < deadline); + auto r = cq->AsyncNext(&got_tag, &ok, gpr_time_0(GPR_CLOCK_REALTIME)); + if (r == CompletionQueue::TIMEOUT) continue; + if (r == CompletionQueue::GOT_EVENT) break; + gpr_log(GPR_ERROR, "unexpected result from AsyncNext"); + abort(); + } + } else { + EXPECT_EQ(cq->AsyncNext(&got_tag, &ok, deadline), CompletionQueue::GOT_EVENT); + } auto it = expectations_.find(got_tag); EXPECT_TRUE(it != expectations_.end()); EXPECT_EQ(it->second, ok); @@ -105,9 +173,10 @@ class Verifier { private: std::map<void*, bool> expectations_; + bool spin_; }; -class AsyncEnd2endTest : public ::testing::Test { +class AsyncEnd2endTest : public ::testing::TestWithParam<bool> { protected: AsyncEnd2endTest() {} @@ -156,15 +225,15 @@ class AsyncEnd2endTest : public ::testing::Test { service_.RequestEcho(&srv_ctx, &recv_request, &response_writer, cq_.get(), cq_.get(), tag(2)); - Verifier().Expect(2, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(2, true).Verify(cq_.get()); EXPECT_EQ(send_request.message(), recv_request.message()); send_response.set_message(recv_request.message()); response_writer.Finish(send_response, Status::OK, tag(3)); - Verifier().Expect(3, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(3, true).Verify(cq_.get()); response_reader->Finish(&recv_response, &recv_status, tag(4)); - Verifier().Expect(4, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(4, true).Verify(cq_.get()); EXPECT_EQ(send_response.message(), recv_response.message()); EXPECT_TRUE(recv_status.ok()); @@ -178,18 +247,18 @@ class AsyncEnd2endTest : public ::testing::Test { std::ostringstream server_address_; }; -TEST_F(AsyncEnd2endTest, SimpleRpc) { +TEST_P(AsyncEnd2endTest, SimpleRpc) { ResetStub(); SendRpc(1); } -TEST_F(AsyncEnd2endTest, SequentialRpcs) { +TEST_P(AsyncEnd2endTest, SequentialRpcs) { ResetStub(); SendRpc(10); } // Test a simple RPC using the async version of Next -TEST_F(AsyncEnd2endTest, AsyncNextRpc) { +TEST_P(AsyncEnd2endTest, AsyncNextRpc) { ResetStub(); EchoRequest send_request; @@ -210,28 +279,28 @@ TEST_F(AsyncEnd2endTest, AsyncNextRpc) { std::chrono::system_clock::now()); std::chrono::system_clock::time_point time_limit( std::chrono::system_clock::now() + std::chrono::seconds(10)); - Verifier().Verify(cq_.get(), time_now); - Verifier().Verify(cq_.get(), time_now); + Verifier(GetParam()).Verify(cq_.get(), time_now); + Verifier(GetParam()).Verify(cq_.get(), time_now); service_.RequestEcho(&srv_ctx, &recv_request, &response_writer, cq_.get(), cq_.get(), tag(2)); - Verifier().Expect(2, true).Verify(cq_.get(), time_limit); + Verifier(GetParam()).Expect(2, true).Verify(cq_.get(), time_limit); EXPECT_EQ(send_request.message(), recv_request.message()); send_response.set_message(recv_request.message()); response_writer.Finish(send_response, Status::OK, tag(3)); - Verifier().Expect(3, true).Verify(cq_.get(), std::chrono::system_clock::time_point::max()); + Verifier(GetParam()).Expect(3, true).Verify(cq_.get(), std::chrono::system_clock::time_point::max()); response_reader->Finish(&recv_response, &recv_status, tag(4)); - Verifier().Expect(4, true).Verify(cq_.get(), std::chrono::system_clock::time_point::max()); + Verifier(GetParam()).Expect(4, true).Verify(cq_.get(), std::chrono::system_clock::time_point::max()); EXPECT_EQ(send_response.message(), recv_response.message()); EXPECT_TRUE(recv_status.ok()); } // Two pings and a final pong. -TEST_F(AsyncEnd2endTest, SimpleClientStreaming) { +TEST_P(AsyncEnd2endTest, SimpleClientStreaming) { ResetStub(); EchoRequest send_request; @@ -250,41 +319,41 @@ TEST_F(AsyncEnd2endTest, SimpleClientStreaming) { service_.RequestRequestStream(&srv_ctx, &srv_stream, cq_.get(), cq_.get(), tag(2)); - Verifier().Expect(2, true).Expect(1, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(2, true).Expect(1, true).Verify(cq_.get()); cli_stream->Write(send_request, tag(3)); - Verifier().Expect(3, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(3, true).Verify(cq_.get()); srv_stream.Read(&recv_request, tag(4)); - Verifier().Expect(4, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(4, true).Verify(cq_.get()); EXPECT_EQ(send_request.message(), recv_request.message()); cli_stream->Write(send_request, tag(5)); - Verifier().Expect(5, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(5, true).Verify(cq_.get()); srv_stream.Read(&recv_request, tag(6)); - Verifier().Expect(6, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(6, true).Verify(cq_.get()); EXPECT_EQ(send_request.message(), recv_request.message()); cli_stream->WritesDone(tag(7)); - Verifier().Expect(7, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(7, true).Verify(cq_.get()); srv_stream.Read(&recv_request, tag(8)); - Verifier().Expect(8, false).Verify(cq_.get()); + Verifier(GetParam()).Expect(8, false).Verify(cq_.get()); send_response.set_message(recv_request.message()); srv_stream.Finish(send_response, Status::OK, tag(9)); - Verifier().Expect(9, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(9, true).Verify(cq_.get()); cli_stream->Finish(&recv_status, tag(10)); - Verifier().Expect(10, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(10, true).Verify(cq_.get()); EXPECT_EQ(send_response.message(), recv_response.message()); EXPECT_TRUE(recv_status.ok()); } // One ping, two pongs. -TEST_F(AsyncEnd2endTest, SimpleServerStreaming) { +TEST_P(AsyncEnd2endTest, SimpleServerStreaming) { ResetStub(); EchoRequest send_request; @@ -303,38 +372,38 @@ TEST_F(AsyncEnd2endTest, SimpleServerStreaming) { service_.RequestResponseStream(&srv_ctx, &recv_request, &srv_stream, cq_.get(), cq_.get(), tag(2)); - Verifier().Expect(1, true).Expect(2, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(1, true).Expect(2, true).Verify(cq_.get()); EXPECT_EQ(send_request.message(), recv_request.message()); send_response.set_message(recv_request.message()); srv_stream.Write(send_response, tag(3)); - Verifier().Expect(3, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(3, true).Verify(cq_.get()); cli_stream->Read(&recv_response, tag(4)); - Verifier().Expect(4, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(4, true).Verify(cq_.get()); EXPECT_EQ(send_response.message(), recv_response.message()); srv_stream.Write(send_response, tag(5)); - Verifier().Expect(5, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(5, true).Verify(cq_.get()); cli_stream->Read(&recv_response, tag(6)); - Verifier().Expect(6, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(6, true).Verify(cq_.get()); EXPECT_EQ(send_response.message(), recv_response.message()); srv_stream.Finish(Status::OK, tag(7)); - Verifier().Expect(7, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(7, true).Verify(cq_.get()); cli_stream->Read(&recv_response, tag(8)); - Verifier().Expect(8, false).Verify(cq_.get()); + Verifier(GetParam()).Expect(8, false).Verify(cq_.get()); cli_stream->Finish(&recv_status, tag(9)); - Verifier().Expect(9, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(9, true).Verify(cq_.get()); EXPECT_TRUE(recv_status.ok()); } // One ping, one pong. -TEST_F(AsyncEnd2endTest, SimpleBidiStreaming) { +TEST_P(AsyncEnd2endTest, SimpleBidiStreaming) { ResetStub(); EchoRequest send_request; @@ -353,40 +422,40 @@ TEST_F(AsyncEnd2endTest, SimpleBidiStreaming) { service_.RequestBidiStream(&srv_ctx, &srv_stream, cq_.get(), cq_.get(), tag(2)); - Verifier().Expect(1, true).Expect(2, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(1, true).Expect(2, true).Verify(cq_.get()); cli_stream->Write(send_request, tag(3)); - Verifier().Expect(3, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(3, true).Verify(cq_.get()); srv_stream.Read(&recv_request, tag(4)); - Verifier().Expect(4, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(4, true).Verify(cq_.get()); EXPECT_EQ(send_request.message(), recv_request.message()); send_response.set_message(recv_request.message()); srv_stream.Write(send_response, tag(5)); - Verifier().Expect(5, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(5, true).Verify(cq_.get()); cli_stream->Read(&recv_response, tag(6)); - Verifier().Expect(6, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(6, true).Verify(cq_.get()); EXPECT_EQ(send_response.message(), recv_response.message()); cli_stream->WritesDone(tag(7)); - Verifier().Expect(7, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(7, true).Verify(cq_.get()); srv_stream.Read(&recv_request, tag(8)); - Verifier().Expect(8, false).Verify(cq_.get()); + Verifier(GetParam()).Expect(8, false).Verify(cq_.get()); srv_stream.Finish(Status::OK, tag(9)); - Verifier().Expect(9, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(9, true).Verify(cq_.get()); cli_stream->Finish(&recv_status, tag(10)); - Verifier().Expect(10, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(10, true).Verify(cq_.get()); EXPECT_TRUE(recv_status.ok()); } // Metadata tests -TEST_F(AsyncEnd2endTest, ClientInitialMetadataRpc) { +TEST_P(AsyncEnd2endTest, ClientInitialMetadataRpc) { ResetStub(); EchoRequest send_request; @@ -410,7 +479,7 @@ TEST_F(AsyncEnd2endTest, ClientInitialMetadataRpc) { service_.RequestEcho(&srv_ctx, &recv_request, &response_writer, cq_.get(), cq_.get(), tag(2)); - Verifier().Expect(2, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(2, true).Verify(cq_.get()); EXPECT_EQ(send_request.message(), recv_request.message()); auto client_initial_metadata = srv_ctx.client_metadata(); EXPECT_EQ(meta1.second, client_initial_metadata.find(meta1.first)->second); @@ -420,16 +489,16 @@ TEST_F(AsyncEnd2endTest, ClientInitialMetadataRpc) { send_response.set_message(recv_request.message()); response_writer.Finish(send_response, Status::OK, tag(3)); - Verifier().Expect(3, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(3, true).Verify(cq_.get()); response_reader->Finish(&recv_response, &recv_status, tag(4)); - Verifier().Expect(4, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(4, true).Verify(cq_.get()); EXPECT_EQ(send_response.message(), recv_response.message()); EXPECT_TRUE(recv_status.ok()); } -TEST_F(AsyncEnd2endTest, ServerInitialMetadataRpc) { +TEST_P(AsyncEnd2endTest, ServerInitialMetadataRpc) { ResetStub(); EchoRequest send_request; @@ -451,15 +520,15 @@ TEST_F(AsyncEnd2endTest, ServerInitialMetadataRpc) { service_.RequestEcho(&srv_ctx, &recv_request, &response_writer, cq_.get(), cq_.get(), tag(2)); - Verifier().Expect(2, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(2, true).Verify(cq_.get()); EXPECT_EQ(send_request.message(), recv_request.message()); srv_ctx.AddInitialMetadata(meta1.first, meta1.second); srv_ctx.AddInitialMetadata(meta2.first, meta2.second); response_writer.SendInitialMetadata(tag(3)); - Verifier().Expect(3, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(3, true).Verify(cq_.get()); response_reader->ReadInitialMetadata(tag(4)); - Verifier().Expect(4, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(4, true).Verify(cq_.get()); auto server_initial_metadata = cli_ctx.GetServerInitialMetadata(); EXPECT_EQ(meta1.second, server_initial_metadata.find(meta1.first)->second); EXPECT_EQ(meta2.second, server_initial_metadata.find(meta2.first)->second); @@ -467,16 +536,16 @@ TEST_F(AsyncEnd2endTest, ServerInitialMetadataRpc) { send_response.set_message(recv_request.message()); response_writer.Finish(send_response, Status::OK, tag(5)); - Verifier().Expect(5, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(5, true).Verify(cq_.get()); response_reader->Finish(&recv_response, &recv_status, tag(6)); - Verifier().Expect(6, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(6, true).Verify(cq_.get()); EXPECT_EQ(send_response.message(), recv_response.message()); EXPECT_TRUE(recv_status.ok()); } -TEST_F(AsyncEnd2endTest, ServerTrailingMetadataRpc) { +TEST_P(AsyncEnd2endTest, ServerTrailingMetadataRpc) { ResetStub(); EchoRequest send_request; @@ -498,20 +567,20 @@ TEST_F(AsyncEnd2endTest, ServerTrailingMetadataRpc) { service_.RequestEcho(&srv_ctx, &recv_request, &response_writer, cq_.get(), cq_.get(), tag(2)); - Verifier().Expect(2, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(2, true).Verify(cq_.get()); EXPECT_EQ(send_request.message(), recv_request.message()); response_writer.SendInitialMetadata(tag(3)); - Verifier().Expect(3, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(3, true).Verify(cq_.get()); send_response.set_message(recv_request.message()); srv_ctx.AddTrailingMetadata(meta1.first, meta1.second); srv_ctx.AddTrailingMetadata(meta2.first, meta2.second); response_writer.Finish(send_response, Status::OK, tag(4)); - Verifier().Expect(4, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(4, true).Verify(cq_.get()); response_reader->Finish(&recv_response, &recv_status, tag(5)); - Verifier().Expect(5, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(5, true).Verify(cq_.get()); EXPECT_EQ(send_response.message(), recv_response.message()); EXPECT_TRUE(recv_status.ok()); auto server_trailing_metadata = cli_ctx.GetServerTrailingMetadata(); @@ -520,7 +589,7 @@ TEST_F(AsyncEnd2endTest, ServerTrailingMetadataRpc) { EXPECT_EQ(static_cast<size_t>(2), server_trailing_metadata.size()); } -TEST_F(AsyncEnd2endTest, MetadataRpc) { +TEST_P(AsyncEnd2endTest, MetadataRpc) { ResetStub(); EchoRequest send_request; @@ -558,7 +627,7 @@ TEST_F(AsyncEnd2endTest, MetadataRpc) { service_.RequestEcho(&srv_ctx, &recv_request, &response_writer, cq_.get(), cq_.get(), tag(2)); - Verifier().Expect(2, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(2, true).Verify(cq_.get()); EXPECT_EQ(send_request.message(), recv_request.message()); auto client_initial_metadata = srv_ctx.client_metadata(); EXPECT_EQ(meta1.second, client_initial_metadata.find(meta1.first)->second); @@ -568,9 +637,9 @@ TEST_F(AsyncEnd2endTest, MetadataRpc) { srv_ctx.AddInitialMetadata(meta3.first, meta3.second); srv_ctx.AddInitialMetadata(meta4.first, meta4.second); response_writer.SendInitialMetadata(tag(3)); - Verifier().Expect(3, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(3, true).Verify(cq_.get()); response_reader->ReadInitialMetadata(tag(4)); - Verifier().Expect(4, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(4, true).Verify(cq_.get()); auto server_initial_metadata = cli_ctx.GetServerInitialMetadata(); EXPECT_EQ(meta3.second, server_initial_metadata.find(meta3.first)->second); EXPECT_EQ(meta4.second, server_initial_metadata.find(meta4.first)->second); @@ -581,10 +650,10 @@ TEST_F(AsyncEnd2endTest, MetadataRpc) { srv_ctx.AddTrailingMetadata(meta6.first, meta6.second); response_writer.Finish(send_response, Status::OK, tag(5)); - Verifier().Expect(5, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(5, true).Verify(cq_.get()); response_reader->Finish(&recv_response, &recv_status, tag(6)); - Verifier().Expect(6, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(6, true).Verify(cq_.get()); EXPECT_EQ(send_response.message(), recv_response.message()); EXPECT_TRUE(recv_status.ok()); auto server_trailing_metadata = cli_ctx.GetServerTrailingMetadata(); @@ -594,7 +663,7 @@ TEST_F(AsyncEnd2endTest, MetadataRpc) { } // Server uses AsyncNotifyWhenDone API to check for cancellation -TEST_F(AsyncEnd2endTest, ServerCheckCancellation) { +TEST_P(AsyncEnd2endTest, ServerCheckCancellation) { ResetStub(); EchoRequest send_request; @@ -615,21 +684,21 @@ TEST_F(AsyncEnd2endTest, ServerCheckCancellation) { service_.RequestEcho(&srv_ctx, &recv_request, &response_writer, cq_.get(), cq_.get(), tag(2)); - Verifier().Expect(2, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(2, true).Verify(cq_.get()); EXPECT_EQ(send_request.message(), recv_request.message()); cli_ctx.TryCancel(); - Verifier().Expect(5, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(5, true).Verify(cq_.get()); EXPECT_TRUE(srv_ctx.IsCancelled()); response_reader->Finish(&recv_response, &recv_status, tag(4)); - Verifier().Expect(4, false).Verify(cq_.get()); + Verifier(GetParam()).Expect(4, false).Verify(cq_.get()); EXPECT_EQ(StatusCode::CANCELLED, recv_status.error_code()); } // Server uses AsyncNotifyWhenDone API to check for normal finish -TEST_F(AsyncEnd2endTest, ServerCheckDone) { +TEST_P(AsyncEnd2endTest, ServerCheckDone) { ResetStub(); EchoRequest send_request; @@ -650,22 +719,24 @@ TEST_F(AsyncEnd2endTest, ServerCheckDone) { service_.RequestEcho(&srv_ctx, &recv_request, &response_writer, cq_.get(), cq_.get(), tag(2)); - Verifier().Expect(2, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(2, true).Verify(cq_.get()); EXPECT_EQ(send_request.message(), recv_request.message()); send_response.set_message(recv_request.message()); response_writer.Finish(send_response, Status::OK, tag(3)); - Verifier().Expect(3, true).Verify(cq_.get()); - Verifier().Expect(5, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(3, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(5, true).Verify(cq_.get()); EXPECT_FALSE(srv_ctx.IsCancelled()); response_reader->Finish(&recv_response, &recv_status, tag(4)); - Verifier().Expect(4, true).Verify(cq_.get()); + Verifier(GetParam()).Expect(4, true).Verify(cq_.get()); EXPECT_EQ(send_response.message(), recv_response.message()); EXPECT_TRUE(recv_status.ok()); } +INSTANTIATE_TEST_CASE_P(AsyncEnd2end, AsyncEnd2endTest, ::testing::Values(false, true)); + } // namespace } // namespace testing } // namespace grpc |