Added another test case for status ordering

pull/17096/head
Vijay Pai 6 years ago
parent acd07f7f40
commit a3b803cfad
  1. 31
      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<size_t>(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) {}

Loading…
Cancel
Save