From a3b803cfad38ef128f587c3ceab7392b85489ff5 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Mon, 5 Nov 2018 10:19:58 -0800 Subject: Added another test case for status ordering --- .../core/end2end/tests/streaming_error_response.cc | 31 +++++++++++++++++----- 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'test/core/end2end') diff --git a/test/core/end2end/tests/streaming_error_response.cc b/test/core/end2end/tests/streaming_error_response.cc index 4c357e077e..713975a33f 100644 --- a/test/core/end2end/tests/streaming_error_response.cc +++ b/test/core/end2end/tests/streaming_error_response.cc @@ -89,7 +89,8 @@ static void end_test(grpc_end2end_test_fixture* f) { } /* Client sends a request with payload, server reads then returns status. */ -static void test(grpc_end2end_test_config config, bool request_status_early) { +static void test(grpc_end2end_test_config config, bool request_status_early, + bool recv_message_separately) { grpc_call* c; grpc_call* s; grpc_slice response_payload1_slice = grpc_slice_from_copied_string("hello"); @@ -116,6 +117,7 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { int was_cancelled = 2; gpr_timespec deadline = five_seconds_from_now(); + GPR_ASSERT(!recv_message_separately || request_status_early); c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), nullptr, deadline, nullptr); @@ -136,9 +138,11 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv; op++; - op->op = GRPC_OP_RECV_MESSAGE; - op->data.recv_message.recv_message = &response_payload1_recv; - op++; + if (!recv_message_separately) { + op->op = GRPC_OP_RECV_MESSAGE; + op->data.recv_message.recv_message = &response_payload1_recv; + op++; + } if (request_status_early) { op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; @@ -168,10 +172,24 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { nullptr); GPR_ASSERT(GRPC_CALL_OK == error); + if (recv_message_separately) { + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_RECV_MESSAGE; + op->data.recv_message.recv_message = &response_payload1_recv; + op++; + error = grpc_call_start_batch(c, ops, static_cast(op - ops), tag(4), + nullptr); + GPR_ASSERT(GRPC_CALL_OK == error); + } + CQ_EXPECT_COMPLETION(cqv, tag(102), 1); if (!request_status_early) { CQ_EXPECT_COMPLETION(cqv, tag(1), 1); } + if (recv_message_separately) { + CQ_EXPECT_COMPLETION(cqv, tag(4), 1); + } cq_verify(cqv); memset(ops, 0, sizeof(ops)); @@ -265,8 +283,9 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { } void streaming_error_response(grpc_end2end_test_config config) { - test(config, false); - test(config, true); + test(config, false, false); + test(config, true, false); + test(config, true, true); } void streaming_error_response_pre_init(void) {} -- cgit v1.2.3