|
|
|
@ -93,20 +93,16 @@ static void end_test(grpc_end2end_test_fixture *f) { |
|
|
|
|
shutdown_server(f); |
|
|
|
|
shutdown_client(f); |
|
|
|
|
|
|
|
|
|
grpc_completion_queue_shutdown(f->server_cq); |
|
|
|
|
drain_cq(f->server_cq); |
|
|
|
|
grpc_completion_queue_destroy(f->server_cq); |
|
|
|
|
grpc_completion_queue_shutdown(f->client_cq); |
|
|
|
|
drain_cq(f->client_cq); |
|
|
|
|
grpc_completion_queue_destroy(f->client_cq); |
|
|
|
|
grpc_completion_queue_shutdown(f->cq); |
|
|
|
|
drain_cq(f->cq); |
|
|
|
|
grpc_completion_queue_destroy(f->cq); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void simple_request_body(grpc_end2end_test_fixture f) { |
|
|
|
|
grpc_call *c; |
|
|
|
|
grpc_call *s; |
|
|
|
|
gpr_timespec deadline = five_seconds_time(); |
|
|
|
|
cq_verifier *v_client = cq_verifier_create(f.client_cq); |
|
|
|
|
cq_verifier *v_server = cq_verifier_create(f.server_cq); |
|
|
|
|
cq_verifier *cqv = cq_verifier_create(f.cq); |
|
|
|
|
grpc_op ops[6]; |
|
|
|
|
grpc_op *op; |
|
|
|
|
grpc_metadata_array initial_metadata_recv; |
|
|
|
@ -118,7 +114,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { |
|
|
|
|
size_t details_capacity = 0; |
|
|
|
|
int was_cancelled = 2; |
|
|
|
|
|
|
|
|
|
c = grpc_channel_create_call(f.client, f.client_cq, "/foo", |
|
|
|
|
c = grpc_channel_create_call(f.client, f.cq, "/foo", |
|
|
|
|
"foo.test.google.fr:1234", deadline); |
|
|
|
|
GPR_ASSERT(c); |
|
|
|
|
|
|
|
|
@ -146,10 +142,10 @@ static void simple_request_body(grpc_end2end_test_fixture f) { |
|
|
|
|
|
|
|
|
|
GPR_ASSERT(GRPC_CALL_OK == |
|
|
|
|
grpc_server_request_call(f.server, &s, &call_details, |
|
|
|
|
&request_metadata_recv, f.server_cq, |
|
|
|
|
f.server_cq, tag(101))); |
|
|
|
|
cq_expect_completion(v_server, tag(101), GRPC_OP_OK); |
|
|
|
|
cq_verify(v_server); |
|
|
|
|
&request_metadata_recv, f.cq, |
|
|
|
|
f.cq, tag(101))); |
|
|
|
|
cq_expect_completion(cqv, tag(101), GRPC_OP_OK); |
|
|
|
|
cq_verify(cqv); |
|
|
|
|
|
|
|
|
|
op = ops; |
|
|
|
|
op->op = GRPC_OP_SEND_INITIAL_METADATA; |
|
|
|
@ -165,11 +161,9 @@ static void simple_request_body(grpc_end2end_test_fixture f) { |
|
|
|
|
op++; |
|
|
|
|
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); |
|
|
|
|
|
|
|
|
|
cq_expect_completion(v_server, tag(102), GRPC_OP_OK); |
|
|
|
|
cq_verify(v_server); |
|
|
|
|
|
|
|
|
|
cq_expect_completion(v_client, tag(1), GRPC_OP_OK); |
|
|
|
|
cq_verify(v_client); |
|
|
|
|
cq_expect_completion(cqv, tag(102), GRPC_OP_OK); |
|
|
|
|
cq_expect_completion(cqv, tag(1), GRPC_OP_OK); |
|
|
|
|
cq_verify(cqv); |
|
|
|
|
|
|
|
|
|
GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); |
|
|
|
|
GPR_ASSERT(0 == strcmp(details, "xyz")); |
|
|
|
@ -186,8 +180,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { |
|
|
|
|
grpc_call_destroy(c); |
|
|
|
|
grpc_call_destroy(s); |
|
|
|
|
|
|
|
|
|
cq_verifier_destroy(v_client); |
|
|
|
|
cq_verifier_destroy(v_server); |
|
|
|
|
cq_verifier_destroy(cqv); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void test_max_concurrent_streams(grpc_end2end_test_config config) { |
|
|
|
@ -200,8 +193,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { |
|
|
|
|
grpc_call *s2; |
|
|
|
|
int live_call; |
|
|
|
|
gpr_timespec deadline; |
|
|
|
|
cq_verifier *v_client; |
|
|
|
|
cq_verifier *v_server; |
|
|
|
|
cq_verifier *cqv; |
|
|
|
|
grpc_event *ev; |
|
|
|
|
grpc_call_details call_details; |
|
|
|
|
grpc_metadata_array request_metadata_recv; |
|
|
|
@ -227,8 +219,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { |
|
|
|
|
server_args.args = &server_arg; |
|
|
|
|
|
|
|
|
|
f = begin_test(config, __FUNCTION__, NULL, &server_args); |
|
|
|
|
v_client = cq_verifier_create(f.client_cq); |
|
|
|
|
v_server = cq_verifier_create(f.server_cq); |
|
|
|
|
cqv = cq_verifier_create(f.cq); |
|
|
|
|
|
|
|
|
|
grpc_metadata_array_init(&request_metadata_recv); |
|
|
|
|
grpc_metadata_array_init(&initial_metadata_recv1); |
|
|
|
@ -246,17 +237,17 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { |
|
|
|
|
/* start two requests - ensuring that the second is not accepted until
|
|
|
|
|
the first completes */ |
|
|
|
|
deadline = n_seconds_time(10); |
|
|
|
|
c1 = grpc_channel_create_call(f.client, f.client_cq, "/alpha", |
|
|
|
|
c1 = grpc_channel_create_call(f.client, f.cq, "/alpha", |
|
|
|
|
"foo.test.google.fr:1234", deadline); |
|
|
|
|
GPR_ASSERT(c1); |
|
|
|
|
c2 = grpc_channel_create_call(f.client, f.client_cq, "/beta", |
|
|
|
|
c2 = grpc_channel_create_call(f.client, f.cq, "/beta", |
|
|
|
|
"foo.test.google.fr:1234", deadline); |
|
|
|
|
GPR_ASSERT(c2); |
|
|
|
|
|
|
|
|
|
GPR_ASSERT(GRPC_CALL_OK == |
|
|
|
|
grpc_server_request_call(f.server, &s1, &call_details, |
|
|
|
|
&request_metadata_recv, f.server_cq, |
|
|
|
|
f.server_cq, tag(101))); |
|
|
|
|
&request_metadata_recv, f.cq, |
|
|
|
|
f.cq, tag(101))); |
|
|
|
|
|
|
|
|
|
op = ops; |
|
|
|
|
op->op = GRPC_OP_SEND_INITIAL_METADATA; |
|
|
|
@ -302,10 +293,10 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { |
|
|
|
|
GPR_ASSERT(GRPC_CALL_OK == |
|
|
|
|
grpc_call_start_batch(c2, ops, op - ops, tag(402))); |
|
|
|
|
|
|
|
|
|
cq_expect_completion(v_server, tag(101), GRPC_OP_OK); |
|
|
|
|
cq_verify(v_server); |
|
|
|
|
cq_expect_completion(cqv, tag(101), GRPC_OP_OK); |
|
|
|
|
cq_verify(cqv); |
|
|
|
|
|
|
|
|
|
ev = grpc_completion_queue_next(f.client_cq, |
|
|
|
|
ev = grpc_completion_queue_next(f.cq, |
|
|
|
|
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(3)); |
|
|
|
|
GPR_ASSERT(ev); |
|
|
|
|
GPR_ASSERT(ev->type == GRPC_OP_COMPLETE); |
|
|
|
@ -332,21 +323,19 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { |
|
|
|
|
GPR_ASSERT(GRPC_CALL_OK == |
|
|
|
|
grpc_call_start_batch(s1, ops, op - ops, tag(102))); |
|
|
|
|
|
|
|
|
|
cq_expect_completion(v_server, tag(102), GRPC_OP_OK); |
|
|
|
|
cq_verify(v_server); |
|
|
|
|
|
|
|
|
|
cq_expect_completion(v_client, tag(live_call + 2), GRPC_OP_OK); |
|
|
|
|
cq_expect_completion(cqv, tag(102), GRPC_OP_OK); |
|
|
|
|
cq_expect_completion(cqv, tag(live_call + 2), GRPC_OP_OK); |
|
|
|
|
/* first request is finished, we should be able to start the second */ |
|
|
|
|
live_call = (live_call == 300) ? 400 : 300; |
|
|
|
|
cq_expect_completion(v_client, tag(live_call + 1), GRPC_OP_OK); |
|
|
|
|
cq_verify(v_client); |
|
|
|
|
cq_expect_completion(cqv, tag(live_call + 1), GRPC_OP_OK); |
|
|
|
|
cq_verify(cqv); |
|
|
|
|
|
|
|
|
|
GPR_ASSERT(GRPC_CALL_OK == |
|
|
|
|
grpc_server_request_call(f.server, &s2, &call_details, |
|
|
|
|
&request_metadata_recv, f.server_cq, |
|
|
|
|
f.server_cq, tag(201))); |
|
|
|
|
cq_expect_completion(v_server, tag(201), GRPC_OP_OK); |
|
|
|
|
cq_verify(v_server); |
|
|
|
|
&request_metadata_recv, f.cq, |
|
|
|
|
f.cq, tag(201))); |
|
|
|
|
cq_expect_completion(cqv, tag(201), GRPC_OP_OK); |
|
|
|
|
cq_verify(cqv); |
|
|
|
|
|
|
|
|
|
op = ops; |
|
|
|
|
op->op = GRPC_OP_SEND_INITIAL_METADATA; |
|
|
|
@ -363,14 +352,11 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { |
|
|
|
|
GPR_ASSERT(GRPC_CALL_OK == |
|
|
|
|
grpc_call_start_batch(s2, ops, op - ops, tag(202))); |
|
|
|
|
|
|
|
|
|
cq_expect_completion(v_client, tag(live_call + 2), GRPC_OP_OK); |
|
|
|
|
cq_verify(v_client); |
|
|
|
|
|
|
|
|
|
cq_expect_completion(v_server, tag(202), GRPC_OP_OK); |
|
|
|
|
cq_verify(v_server); |
|
|
|
|
cq_expect_completion(cqv, tag(live_call + 2), GRPC_OP_OK); |
|
|
|
|
cq_expect_completion(cqv, tag(202), GRPC_OP_OK); |
|
|
|
|
cq_verify(cqv); |
|
|
|
|
|
|
|
|
|
cq_verifier_destroy(v_client); |
|
|
|
|
cq_verifier_destroy(v_server); |
|
|
|
|
cq_verifier_destroy(cqv); |
|
|
|
|
|
|
|
|
|
grpc_call_destroy(c1); |
|
|
|
|
grpc_call_destroy(s1); |
|
|
|
|