diff options
Diffstat (limited to 'test/core/end2end')
-rw-r--r-- | test/core/end2end/dualstack_socket_test.c | 51 | ||||
-rw-r--r-- | test/core/end2end/tests/max_concurrent_streams.c | 4 | ||||
-rw-r--r-- | test/core/end2end/tests/max_concurrent_streams_legacy.c | 4 | ||||
-rw-r--r-- | test/core/end2end/tests/simple_request.c | 4 |
4 files changed, 31 insertions, 32 deletions
diff --git a/test/core/end2end/dualstack_socket_test.c b/test/core/end2end/dualstack_socket_test.c index e7183cc7c6..66b76dc052 100644 --- a/test/core/end2end/dualstack_socket_test.c +++ b/test/core/end2end/dualstack_socket_test.c @@ -75,6 +75,10 @@ void test_connect(const char *server_host, const char *client_host, int port, gpr_timespec deadline; int got_port; + if (port == 0) { + port = grpc_pick_unused_port_or_die(); + } + gpr_join_host_port(&server_hostport, server_host, port); /* Create server. */ @@ -179,7 +183,6 @@ void test_connect(const char *server_host, const char *client_host, int port, int main(int argc, char **argv) { int do_ipv6 = 1; - int fixed_port; grpc_test_init(argc, argv); grpc_init(); @@ -189,32 +192,28 @@ int main(int argc, char **argv) { do_ipv6 = 0; } - for (fixed_port = 0; fixed_port <= 1; fixed_port++) { - int port = fixed_port ? grpc_pick_unused_port_or_die() : 0; - /* For coverage, test with and without dualstack sockets. */ - for (grpc_forbid_dualstack_sockets_for_testing = 0; - grpc_forbid_dualstack_sockets_for_testing <= 1; - grpc_forbid_dualstack_sockets_for_testing++) { - /* :: and 0.0.0.0 are handled identically. */ - test_connect("::", "127.0.0.1", port, 1); - test_connect("::", "::ffff:127.0.0.1", port, 1); - test_connect("::", "localhost", port, 1); - test_connect("0.0.0.0", "127.0.0.1", port, 1); - test_connect("0.0.0.0", "::ffff:127.0.0.1", port, 1); - test_connect("0.0.0.0", "localhost", port, 1); - if (do_ipv6) { - test_connect("::", "::1", port, 1); - test_connect("0.0.0.0", "::1", port, 1); - } - - /* These only work when the families agree. */ - test_connect("127.0.0.1", "127.0.0.1", port, 1); - if (do_ipv6) { - test_connect("::1", "::1", port, 1); - test_connect("::1", "127.0.0.1", port, 0); - test_connect("127.0.0.1", "::1", port, 0); - } + for (grpc_forbid_dualstack_sockets_for_testing = 0; + grpc_forbid_dualstack_sockets_for_testing <= 1; + grpc_forbid_dualstack_sockets_for_testing++) { + /* :: and 0.0.0.0 are handled identically. */ + test_connect("::", "127.0.0.1", 0, 1); + test_connect("::", "::ffff:127.0.0.1", 0, 1); + test_connect("::", "localhost", 0, 1); + test_connect("0.0.0.0", "127.0.0.1", 0, 1); + test_connect("0.0.0.0", "::ffff:127.0.0.1", 0, 1); + test_connect("0.0.0.0", "localhost", 0, 1); + if (do_ipv6) { + test_connect("::", "::1", 0, 1); + test_connect("0.0.0.0", "::1", 0, 1); + } + + /* These only work when the families agree. */ + test_connect("127.0.0.1", "127.0.0.1", 0, 1); + if (do_ipv6) { + test_connect("::1", "::1", 0, 1); + test_connect("::1", "127.0.0.1", 0, 0); + test_connect("127.0.0.1", "::1", 0, 0); } } diff --git a/test/core/end2end/tests/max_concurrent_streams.c b/test/core/end2end/tests/max_concurrent_streams.c index d85c9351ad..af29e172bb 100644 --- a/test/core/end2end/tests/max_concurrent_streams.c +++ b/test/core/end2end/tests/max_concurrent_streams.c @@ -196,7 +196,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { GPR_ASSERT(GRPC_CALL_OK == grpc_call_invoke_old(c2, f.client_cq, tag(401), tag(402), 0)); GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done_old(c1, tag(303))); - GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done_old(c2, tag(303))); + GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done_old(c2, tag(403))); ev = grpc_completion_queue_next( f.client_cq, gpr_time_add(gpr_now(), gpr_time_from_seconds(10))); @@ -230,8 +230,8 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { /* first request is finished, we should be able to start the second */ cq_expect_finished_with_status(v_client, tag(live_call + 2), GRPC_STATUS_UNIMPLEMENTED, "xyz", NULL); - cq_expect_finish_accepted(v_client, tag(live_call + 3), GRPC_OP_OK); live_call = (live_call == 300) ? 400 : 300; + cq_expect_finish_accepted(v_client, tag(live_call + 3), GRPC_OP_OK); cq_verify(v_client); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call_old(f.server, tag(200))); diff --git a/test/core/end2end/tests/max_concurrent_streams_legacy.c b/test/core/end2end/tests/max_concurrent_streams_legacy.c index d85c9351ad..af29e172bb 100644 --- a/test/core/end2end/tests/max_concurrent_streams_legacy.c +++ b/test/core/end2end/tests/max_concurrent_streams_legacy.c @@ -196,7 +196,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { GPR_ASSERT(GRPC_CALL_OK == grpc_call_invoke_old(c2, f.client_cq, tag(401), tag(402), 0)); GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done_old(c1, tag(303))); - GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done_old(c2, tag(303))); + GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done_old(c2, tag(403))); ev = grpc_completion_queue_next( f.client_cq, gpr_time_add(gpr_now(), gpr_time_from_seconds(10))); @@ -230,8 +230,8 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { /* first request is finished, we should be able to start the second */ cq_expect_finished_with_status(v_client, tag(live_call + 2), GRPC_STATUS_UNIMPLEMENTED, "xyz", NULL); - cq_expect_finish_accepted(v_client, tag(live_call + 3), GRPC_OP_OK); live_call = (live_call == 300) ? 400 : 300; + cq_expect_finish_accepted(v_client, tag(live_call + 3), GRPC_OP_OK); cq_verify(v_client); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call_old(f.server, tag(200))); diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c index 1263155f98..4d4d48a211 100644 --- a/test/core/end2end/tests/simple_request.c +++ b/test/core/end2end/tests/simple_request.c @@ -122,7 +122,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { int was_cancelled = 2; c = grpc_channel_create_call(f.client, f.client_cq, "/foo", - "foo.test.google.fr", deadline); + "foo.test.google.fr:1234", deadline); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -177,7 +177,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); 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:1234")); GPR_ASSERT(was_cancelled == 0); gpr_free(details); |