aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/end2end
diff options
context:
space:
mode:
authorGravatar Yuchen Zeng <zyc@google.com>2016-06-22 13:37:02 -0700
committerGravatar Yuchen Zeng <zyc@google.com>2016-06-22 13:37:02 -0700
commitf7c7f330a8efa7f264a52973a0c62dc1016f0648 (patch)
tree4d42ea9255bca92846987802214a2a01ed2a2331 /test/core/end2end
parentd9c6ac09625e548faf286b73f0b0d74fb1b3bb1d (diff)
Init grpc for each test
Diffstat (limited to 'test/core/end2end')
-rw-r--r--test/core/end2end/bad_server_response_test.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/core/end2end/bad_server_response_test.c b/test/core/end2end/bad_server_response_test.c
index ebf2caa070..878dfaed5a 100644
--- a/test/core/end2end/bad_server_response_test.c
+++ b/test/core/end2end/bad_server_response_test.c
@@ -270,11 +270,12 @@ static void run_test(const char *response_payload,
grpc_status_code expected_status,
const char *expected_detail) {
test_tcp_server test_server;
- server_port = grpc_pick_unused_port_or_die();
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
gpr_event ev;
- gpr_event_init(&ev);
+ grpc_init();
+ gpr_event_init(&ev);
+ server_port = grpc_pick_unused_port_or_die();
test_tcp_server_init(&test_server, on_connect, &test_server);
test_tcp_server_start(&test_server, server_port);
state.response_payload = response_payload;
@@ -291,11 +292,12 @@ static void run_test(const char *response_payload,
grpc_exec_ctx_finish(&exec_ctx);
cleanup_rpc();
test_tcp_server_destroy(&test_server);
+
+ grpc_shutdown();
}
int main(int argc, char **argv) {
grpc_test_init(argc, argv);
- grpc_init();
/* status defined in hpack static table */
run_test(HTTP2_RESP(204), sizeof(HTTP2_RESP(204)) - 1, GRPC_STATUS_CANCELLED,
@@ -334,6 +336,5 @@ int main(int argc, char **argv) {
run_test(HTTP1_RESP, sizeof(HTTP1_RESP) - 1, GRPC_STATUS_UNAVAILABLE,
HTTP1_DETAIL_MSG);
- grpc_shutdown();
return 0;
}