Fixing some tests I broke during conversion

pull/1397/head
Craig Tiller 10 years ago
parent 48373dfab0
commit f107120907
  1. 2
      test/core/end2end/dualstack_socket_test.c
  2. 3
      test/core/end2end/tests/cancel_after_accept.c
  3. 6
      test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c
  4. 2
      test/core/end2end/tests/early_server_shutdown_finishes_tags.c
  5. 8
      test/core/end2end/tests/graceful_server_shutdown.c
  6. 25
      test/core/end2end/tests/max_concurrent_streams.c
  7. 6
      test/core/end2end/tests/ping_pong_streaming.c

@ -186,7 +186,7 @@ void test_connect(const char *server_host, const char *client_host, int port,
GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED);
GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(details, "xyz"));
GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo"));
GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr:1234")); GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr"));
GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(was_cancelled == 0);
grpc_call_destroy(s); grpc_call_destroy(s);

@ -177,6 +177,9 @@ static void test_cancel_after_accept(grpc_end2end_test_config config,
op->op = GRPC_OP_SEND_MESSAGE; op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message = response_payload; op->data.send_message = response_payload;
op++; op++;
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(3))); GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(3)));
GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c)); GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c));

@ -155,6 +155,12 @@ static void test_early_server_shutdown_finishes_inflight_calls(
cq_expect_completion(v_server, tag(101), GRPC_OP_OK); cq_expect_completion(v_server, tag(101), GRPC_OP_OK);
cq_verify(v_server); cq_verify(v_server);
op = ops;
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102)));
/* shutdown and destroy the server */ /* shutdown and destroy the server */
shutdown_server(&f); shutdown_server(&f);

@ -120,7 +120,7 @@ static void test_early_server_shutdown_finishes_tags(
&request_metadata_recv, &request_metadata_recv,
f.server_cq, tag(101))); f.server_cq, tag(101)));
grpc_server_shutdown(f.server); grpc_server_shutdown(f.server);
cq_expect_completion(v_server, tag(101), GRPC_OP_OK); cq_expect_completion(v_server, tag(101), GRPC_OP_ERROR);
cq_verify(v_server); cq_verify(v_server);
GPR_ASSERT(s == NULL); GPR_ASSERT(s == NULL);

@ -173,16 +173,19 @@ static void test_early_server_shutdown_finishes_inflight_calls(
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(s, ops, op - ops, tag(102))); 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_expect_completion(v_server, tag(102), GRPC_OP_OK);
cq_verify(v_server);
grpc_call_destroy(s);
cq_expect_server_shutdown(v_server, tag(0xdead)); cq_expect_server_shutdown(v_server, tag(0xdead));
cq_verify(v_server); cq_verify(v_server);
cq_expect_completion(v_client, tag(1), GRPC_OP_OK); cq_expect_completion(v_client, tag(1), GRPC_OP_OK);
cq_verify(v_client); cq_verify(v_client);
GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE); GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED);
GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo"));
GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr")); GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr"));
GPR_ASSERT(was_cancelled == 1); GPR_ASSERT(was_cancelled == 0);
gpr_free(details); gpr_free(details);
grpc_metadata_array_destroy(&initial_metadata_recv); grpc_metadata_array_destroy(&initial_metadata_recv);
@ -191,7 +194,6 @@ static void test_early_server_shutdown_finishes_inflight_calls(
grpc_call_details_destroy(&call_details); grpc_call_details_destroy(&call_details);
grpc_call_destroy(c); grpc_call_destroy(c);
grpc_call_destroy(s);
cq_verifier_destroy(v_client); cq_verifier_destroy(v_client);
cq_verifier_destroy(v_server); cq_verifier_destroy(v_server);

@ -232,6 +232,11 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
v_server = cq_verifier_create(f.server_cq); v_server = cq_verifier_create(f.server_cq);
grpc_metadata_array_init(&request_metadata_recv); grpc_metadata_array_init(&request_metadata_recv);
grpc_metadata_array_init(&initial_metadata_recv1);
grpc_metadata_array_init(&trailing_metadata_recv1);
grpc_metadata_array_init(&initial_metadata_recv2);
grpc_metadata_array_init(&trailing_metadata_recv2);
grpc_call_details_init(&call_details);
/* perform a ping-pong to ensure that settings have had a chance to round /* perform a ping-pong to ensure that settings have had a chance to round
trip */ trip */
@ -241,7 +246,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
/* start two requests - ensuring that the second is not accepted until /* start two requests - ensuring that the second is not accepted until
the first completes */ the first completes */
deadline = five_seconds_time(); deadline = n_seconds_time(10);
c1 = grpc_channel_create_call(f.client, f.client_cq, "/alpha", c1 = grpc_channel_create_call(f.client, f.client_cq, "/alpha",
"foo.test.google.fr:1234", deadline); "foo.test.google.fr:1234", deadline);
GPR_ASSERT(c1); GPR_ASSERT(c1);
@ -298,8 +303,8 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
GPR_ASSERT(GRPC_CALL_OK == GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_start_batch(c2, ops, op - ops, tag(402))); grpc_call_start_batch(c2, ops, op - ops, tag(402)));
ev = grpc_completion_queue_next( ev = grpc_completion_queue_next(f.client_cq,
f.client_cq, gpr_time_add(gpr_now(), gpr_time_from_seconds(10))); GRPC_TIMEOUT_SECONDS_TO_DEADLINE(3));
GPR_ASSERT(ev); GPR_ASSERT(ev);
GPR_ASSERT(ev->type == GRPC_OP_COMPLETE); GPR_ASSERT(ev->type == GRPC_OP_COMPLETE);
GPR_ASSERT(ev->data.op_complete == GRPC_OP_OK); GPR_ASSERT(ev->data.op_complete == GRPC_OP_OK);
@ -310,7 +315,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
live_call = ((int)(gpr_intptr)ev->tag) - 1; live_call = ((int)(gpr_intptr)ev->tag) - 1;
grpc_event_finish(ev); grpc_event_finish(ev);
cq_expect_completion(v_server, tag(100), GRPC_OP_OK); cq_expect_completion(v_server, tag(101), GRPC_OP_OK);
cq_verify(v_server); cq_verify(v_server);
op = ops; op = ops;
@ -323,7 +328,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
GPR_ASSERT(GRPC_CALL_OK == GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_start_batch(s1, ops, op - ops, tag(102))); grpc_call_start_batch(s1, ops, op - ops, tag(102)));
cq_expect_completion(v_client, tag(live_call + 1), GRPC_OP_OK); cq_expect_completion(v_client, tag(live_call + 2), GRPC_OP_OK);
cq_verify(v_client); cq_verify(v_client);
op = ops; op = ops;
@ -335,13 +340,13 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
GPR_ASSERT(GRPC_CALL_OK == GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_start_batch(s1, ops, op - ops, tag(103))); grpc_call_start_batch(s1, ops, op - ops, tag(103)));
cq_expect_completion(v_server, tag(102), GRPC_OP_OK);
cq_expect_completion(v_server, tag(103), GRPC_OP_OK); cq_expect_completion(v_server, tag(103), GRPC_OP_OK);
cq_verify(v_server); cq_verify(v_server);
/* first request is finished, we should be able to start the second */ /* first request is finished, we should be able to start the second */
cq_expect_completion(v_client, tag(live_call + 2), GRPC_OP_OK);
live_call = (live_call == 300) ? 400 : 300; live_call = (live_call == 300) ? 400 : 300;
cq_expect_completion(v_client, tag(live_call + 3), GRPC_OP_OK); cq_expect_completion(v_client, tag(live_call + 1), GRPC_OP_OK);
cq_verify(v_client); cq_verify(v_client);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, &s2, GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, &s2,
@ -361,7 +366,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
GPR_ASSERT(GRPC_CALL_OK == GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_start_batch(s2, ops, op - ops, tag(202))); grpc_call_start_batch(s2, ops, op - ops, tag(202)));
cq_expect_completion(v_client, tag(live_call + 1), GRPC_OP_OK); cq_expect_completion(v_client, tag(live_call + 2), GRPC_OP_OK);
cq_verify(v_client); cq_verify(v_client);
op = ops; op = ops;
@ -373,12 +378,10 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
GPR_ASSERT(GRPC_CALL_OK == GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_start_batch(s2, ops, op - ops, tag(203))); grpc_call_start_batch(s2, ops, op - ops, tag(203)));
cq_expect_completion(v_server, tag(202), GRPC_OP_OK);
cq_expect_completion(v_server, tag(203), GRPC_OP_OK); cq_expect_completion(v_server, tag(203), GRPC_OP_OK);
cq_verify(v_server); cq_verify(v_server);
cq_expect_completion(v_client, tag(live_call + 2), GRPC_OP_OK);
cq_verify(v_client);
cq_verifier_destroy(v_client); cq_verifier_destroy(v_client);
cq_verifier_destroy(v_server); cq_verifier_destroy(v_server);

@ -218,9 +218,6 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(3))); GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(c, ops, op - ops, tag(3)));
op = ops; op = ops;
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0; op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED;
@ -239,9 +236,6 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
grpc_call_destroy(c); grpc_call_destroy(c);
grpc_call_destroy(s); grpc_call_destroy(s);
end_test(&f);
config.tear_down_data(&f);
cq_verifier_destroy(v_client); cq_verifier_destroy(v_client);
cq_verifier_destroy(v_server); cq_verifier_destroy(v_server);

Loading…
Cancel
Save