diff options
Diffstat (limited to 'test/core/end2end/tests/simple_delayed_request.c')
-rw-r--r-- | test/core/end2end/tests/simple_delayed_request.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/test/core/end2end/tests/simple_delayed_request.c b/test/core/end2end/tests/simple_delayed_request.c index 414a03d98b..e3b6aee783 100644 --- a/test/core/end2end/tests/simple_delayed_request.c +++ b/test/core/end2end/tests/simple_delayed_request.c @@ -46,7 +46,7 @@ static void *tag(intptr_t t) { return (void *)t; } static gpr_timespec n_seconds_time(int n) { - return GRPC_TIMEOUT_SECONDS_TO_DEADLINE(n); + return grpc_timeout_seconds_to_deadline(n); } static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } @@ -62,7 +62,7 @@ static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -100,15 +100,16 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, grpc_call_details call_details; grpc_status_code status; grpc_call_error error; - char *details = NULL; - size_t details_capacity = 0; + grpc_slice details; int was_cancelled = 2; config.init_client(f, client_args); + config.init_server(f, server_args); c = grpc_channel_create_call( - f->client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq, "/foo", - get_host_override_string("foo.test.google.fr:1234", config), deadline, + f->client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq, + grpc_slice_from_static_string("/foo"), + get_host_override_slice("foo.test.google.fr:1234", config), deadline, NULL); GPR_ASSERT(c); @@ -129,7 +130,7 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, op->reserved = NULL; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; - op->data.recv_initial_metadata = &initial_metadata_recv; + op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; op->reserved = NULL; op++; @@ -137,15 +138,12 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; - op->data.recv_status_on_client.status_details_capacity = &details_capacity; op->flags = 0; op->reserved = NULL; op++; error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); GPR_ASSERT(GRPC_CALL_OK == error); - config.init_server(f, server_args); - error = grpc_server_request_call(f->server, &s, &call_details, &request_metadata_recv, f->cq, f->cq, tag(101)); @@ -163,7 +161,8 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; 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_details = "xyz"; + grpc_slice status_details = grpc_slice_from_static_string("xyz"); + op->data.send_status_from_server.status_details = &status_details; op->flags = 0; op->reserved = NULL; op++; @@ -180,13 +179,13 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, cq_verify(cqv); GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); - GPR_ASSERT(0 == strcmp(details, "xyz")); - GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); + GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); + GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); GPR_ASSERT(was_cancelled == 1); - gpr_free(details); + grpc_slice_unref(details); grpc_metadata_array_destroy(&initial_metadata_recv); grpc_metadata_array_destroy(&trailing_metadata_recv); grpc_metadata_array_destroy(&request_metadata_recv); @@ -208,7 +207,8 @@ static void test_simple_delayed_request_short(grpc_end2end_test_config config) { client_args.args = arg_array; client_args.num_args = 1; - gpr_log(GPR_INFO, "%s/%s", "test_simple_delayed_request_short", config.name); + gpr_log(GPR_INFO, "Running test: %s/%s", "test_simple_delayed_request_short", + config.name); f = config.create_fixture(NULL, NULL); simple_delayed_request_body(config, &f, &client_args, NULL, 100000); @@ -226,7 +226,8 @@ static void test_simple_delayed_request_long(grpc_end2end_test_config config) { client_args.args = arg_array; client_args.num_args = 1; - gpr_log(GPR_INFO, "%s/%s", "test_simple_delayed_request_long", config.name); + gpr_log(GPR_INFO, "Running test: %s/%s", "test_simple_delayed_request_long", + config.name); f = config.create_fixture(NULL, NULL); /* This timeout should be longer than a single retry */ simple_delayed_request_body(config, &f, &client_args, NULL, 1500000); |