diff options
58 files changed, 350 insertions, 197 deletions
diff --git a/test/core/end2end/end2end_nosec_tests.c b/test/core/end2end/end2end_nosec_tests.c index caaa97c215..7e9b6eb233 100644 --- a/test/core/end2end/end2end_nosec_tests.c +++ b/test/core/end2end/end2end_nosec_tests.c @@ -416,3 +416,16 @@ void grpc_end2end_tests(int argc, char **argv, abort(); } } + +const char *get_host_override_string(const char *str, + grpc_end2end_test_config config) { + return (config.feature_mask & FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER ? str + : NULL); +} + +void validate_host_override_string(const char *pattern, const char *str, + grpc_end2end_test_config config) { + if (config.feature_mask & FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER) { + GPR_ASSERT(0 == strcmp(str, pattern)); + } +} diff --git a/test/core/end2end/end2end_tests.c b/test/core/end2end/end2end_tests.c index 6d17e686e6..0fbad22641 100644 --- a/test/core/end2end/end2end_tests.c +++ b/test/core/end2end/end2end_tests.c @@ -424,3 +424,16 @@ void grpc_end2end_tests(int argc, char **argv, abort(); } } + +const char *get_host_override_string(const char *str, + grpc_end2end_test_config config) { + return (config.feature_mask & FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER ? str + : NULL); +} + +void validate_host_override_string(const char *pattern, const char *str, + grpc_end2end_test_config config) { + if (config.feature_mask & FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER) { + GPR_ASSERT(0 == strcmp(str, pattern)); + } +} diff --git a/test/core/end2end/end2end_tests.h b/test/core/end2end/end2end_tests.h index b56b595cc5..f25e90b5f6 100644 --- a/test/core/end2end/end2end_tests.h +++ b/test/core/end2end/end2end_tests.h @@ -44,6 +44,7 @@ typedef struct grpc_end2end_test_config grpc_end2end_test_config; #define FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS 4 #define FEATURE_MASK_SUPPORTS_REQUEST_PROXYING 8 #define FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL 16 +#define FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER 32 #define FAIL_AUTH_CHECK_SERVER_ARG_NAME "fail_auth_check" @@ -69,4 +70,10 @@ struct grpc_end2end_test_config { void grpc_end2end_tests_pre_init(void); void grpc_end2end_tests(int argc, char **argv, grpc_end2end_test_config config); +const char *get_host_override_string(const char *str, + grpc_end2end_test_config config); + +void validate_host_override_string(const char *pattern, const char *str, + grpc_end2end_test_config config); + #endif /* GRPC_TEST_CORE_END2END_END2END_TESTS_H */ diff --git a/test/core/end2end/fixtures/h2_census.c b/test/core/end2end/fixtures/h2_census.c index c8d1a90a97..c52d7660f5 100644 --- a/test/core/end2end/fixtures/h2_census.c +++ b/test/core/end2end/fixtures/h2_census.c @@ -112,7 +112,8 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { {"chttp2/fullstack+census", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL, + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_compress.c b/test/core/end2end/fixtures/h2_compress.c index b4a2b0ddd5..fedd2ebc46 100644 --- a/test/core/end2end/fixtures/h2_compress.c +++ b/test/core/end2end/fixtures/h2_compress.c @@ -114,7 +114,8 @@ void chttp2_tear_down_fullstack_compression(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { {"chttp2/fullstack_compression", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL, + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack_compression, chttp2_init_client_fullstack_compression, chttp2_init_server_fullstack_compression, diff --git a/test/core/end2end/fixtures/h2_fakesec.c b/test/core/end2end/fixtures/h2_fakesec.c index 9a8739a1de..c9747913c2 100644 --- a/test/core/end2end/fixtures/h2_fakesec.c +++ b/test/core/end2end/fixtures/h2_fakesec.c @@ -141,7 +141,8 @@ static grpc_end2end_test_config configs[] = { {"chttp2/fake_secure_fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL, + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_secure_fullstack, chttp2_init_client_fake_secure_fullstack, chttp2_init_server_fake_secure_fullstack, diff --git a/test/core/end2end/fixtures/h2_fd.c b/test/core/end2end/fixtures/h2_fd.c index e9fd6668ed..223fadc386 100644 --- a/test/core/end2end/fixtures/h2_fd.c +++ b/test/core/end2end/fixtures/h2_fd.c @@ -111,9 +111,9 @@ static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fd", 0, chttp2_create_fixture_socketpair, - chttp2_init_client_socketpair, chttp2_init_server_socketpair, - chttp2_tear_down_socketpair}, + {"chttp2/fd", FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + chttp2_create_fixture_socketpair, chttp2_init_client_socketpair, + chttp2_init_server_socketpair, chttp2_tear_down_socketpair}, }; int main(int argc, char **argv) { diff --git a/test/core/end2end/fixtures/h2_full+pipe.c b/test/core/end2end/fixtures/h2_full+pipe.c index 74ed021ce8..c6013f3040 100644 --- a/test/core/end2end/fixtures/h2_full+pipe.c +++ b/test/core/end2end/fixtures/h2_full+pipe.c @@ -103,7 +103,8 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL, + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_full+trace.c b/test/core/end2end/fixtures/h2_full+trace.c index b2fd490df2..11a102a576 100644 --- a/test/core/end2end/fixtures/h2_full+trace.c +++ b/test/core/end2end/fixtures/h2_full+trace.c @@ -103,7 +103,8 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL, + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_full.c b/test/core/end2end/fixtures/h2_full.c index e87382edae..3399f1981e 100644 --- a/test/core/end2end/fixtures/h2_full.c +++ b/test/core/end2end/fixtures/h2_full.c @@ -97,7 +97,8 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL, + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_http_proxy.c b/test/core/end2end/fixtures/h2_http_proxy.c index f0720c4f51..44b223664a 100644 --- a/test/core/end2end/fixtures/h2_http_proxy.c +++ b/test/core/end2end/fixtures/h2_http_proxy.c @@ -108,7 +108,8 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL, + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_load_reporting.c b/test/core/end2end/fixtures/h2_load_reporting.c index 3b3a1449bc..7a76489b44 100644 --- a/test/core/end2end/fixtures/h2_load_reporting.c +++ b/test/core/end2end/fixtures/h2_load_reporting.c @@ -104,7 +104,8 @@ void chttp2_tear_down_load_reporting(grpc_end2end_test_fixture *f) { static grpc_end2end_test_config configs[] = { {"chttp2/fullstack+load_reporting", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL, + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_load_reporting, chttp2_init_client_load_reporting, chttp2_init_server_load_reporting, chttp2_tear_down_load_reporting}, }; diff --git a/test/core/end2end/fixtures/h2_oauth2.c b/test/core/end2end/fixtures/h2_oauth2.c index eca866f93b..6122f4f2f9 100644 --- a/test/core/end2end/fixtures/h2_oauth2.c +++ b/test/core/end2end/fixtures/h2_oauth2.c @@ -217,7 +217,8 @@ static grpc_end2end_test_config configs[] = { {"chttp2/simple_ssl_with_oauth2_fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL, + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_secure_fullstack, chttp2_init_client_simple_ssl_with_oauth2_secure_fullstack, chttp2_init_server_simple_ssl_secure_fullstack, diff --git a/test/core/end2end/fixtures/h2_proxy.c b/test/core/end2end/fixtures/h2_proxy.c index 65469b73c5..9e37ed4db3 100644 --- a/test/core/end2end/fixtures/h2_proxy.c +++ b/test/core/end2end/fixtures/h2_proxy.c @@ -115,7 +115,8 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { static grpc_end2end_test_config configs[] = { {"chttp2/fullstack+proxy", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | FEATURE_MASK_SUPPORTS_REQUEST_PROXYING | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL, + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_sockpair+trace.c b/test/core/end2end/fixtures/h2_sockpair+trace.c index 164828cb57..726ed8735c 100644 --- a/test/core/end2end/fixtures/h2_sockpair+trace.c +++ b/test/core/end2end/fixtures/h2_sockpair+trace.c @@ -141,9 +141,9 @@ static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/socketpair", 0, chttp2_create_fixture_socketpair, - chttp2_init_client_socketpair, chttp2_init_server_socketpair, - chttp2_tear_down_socketpair}, + {"chttp2/socketpair", FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + chttp2_create_fixture_socketpair, chttp2_init_client_socketpair, + chttp2_init_server_socketpair, chttp2_tear_down_socketpair}, }; int main(int argc, char **argv) { diff --git a/test/core/end2end/fixtures/h2_sockpair.c b/test/core/end2end/fixtures/h2_sockpair.c index 182583ce05..94b2623b3e 100644 --- a/test/core/end2end/fixtures/h2_sockpair.c +++ b/test/core/end2end/fixtures/h2_sockpair.c @@ -135,9 +135,9 @@ static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/socketpair", 0, chttp2_create_fixture_socketpair, - chttp2_init_client_socketpair, chttp2_init_server_socketpair, - chttp2_tear_down_socketpair}, + {"chttp2/socketpair", FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + chttp2_create_fixture_socketpair, chttp2_init_client_socketpair, + chttp2_init_server_socketpair, chttp2_tear_down_socketpair}, }; int main(int argc, char **argv) { diff --git a/test/core/end2end/fixtures/h2_sockpair_1byte.c b/test/core/end2end/fixtures/h2_sockpair_1byte.c index 218d5f2cb4..0a45f76395 100644 --- a/test/core/end2end/fixtures/h2_sockpair_1byte.c +++ b/test/core/end2end/fixtures/h2_sockpair_1byte.c @@ -135,9 +135,10 @@ static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/socketpair_one_byte_at_a_time", 0, - chttp2_create_fixture_socketpair, chttp2_init_client_socketpair, - chttp2_init_server_socketpair, chttp2_tear_down_socketpair}, + {"chttp2/socketpair_one_byte_at_a_time", + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_socketpair, + chttp2_init_client_socketpair, chttp2_init_server_socketpair, + chttp2_tear_down_socketpair}, }; int main(int argc, char **argv) { diff --git a/test/core/end2end/fixtures/h2_ssl.c b/test/core/end2end/fixtures/h2_ssl.c index 23b6f9f73a..bbd522cf30 100644 --- a/test/core/end2end/fixtures/h2_ssl.c +++ b/test/core/end2end/fixtures/h2_ssl.c @@ -152,7 +152,8 @@ static grpc_end2end_test_config configs[] = { {"chttp2/simple_ssl_fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL, + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_secure_fullstack, chttp2_init_client_simple_ssl_secure_fullstack, chttp2_init_server_simple_ssl_secure_fullstack, diff --git a/test/core/end2end/fixtures/h2_ssl_proxy.c b/test/core/end2end/fixtures/h2_ssl_proxy.c index a7490d13ec..27cf3ebf32 100644 --- a/test/core/end2end/fixtures/h2_ssl_proxy.c +++ b/test/core/end2end/fixtures/h2_ssl_proxy.c @@ -186,7 +186,8 @@ static grpc_end2end_test_config configs[] = { FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | FEATURE_MASK_SUPPORTS_REQUEST_PROXYING | FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL, + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_secure_fullstack, chttp2_init_client_simple_ssl_secure_fullstack, chttp2_init_server_simple_ssl_secure_fullstack, diff --git a/test/core/end2end/fixtures/h2_uds.c b/test/core/end2end/fixtures/h2_uds.c index 0a17ff5860..bc973ea8e3 100644 --- a/test/core/end2end/fixtures/h2_uds.c +++ b/test/core/end2end/fixtures/h2_uds.c @@ -102,7 +102,8 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { {"chttp2/fullstack_uds", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL, + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/tests/binary_metadata.c b/test/core/end2end/tests/binary_metadata.c index 6b105def33..f1ebbbb66f 100644 --- a/test/core/end2end/tests/binary_metadata.c +++ b/test/core/end2end/tests/binary_metadata.c @@ -146,8 +146,10 @@ static void test_request_response_with_metadata_and_payload( size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + 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, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -248,7 +250,8 @@ static void test_request_response_with_metadata_and_payload( GPR_ASSERT(status == GRPC_STATUS_OK); 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")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you")); diff --git a/test/core/end2end/tests/call_creds.c b/test/core/end2end/tests/call_creds.c index 981c0fcc8c..8bde79c400 100644 --- a/test/core/end2end/tests/call_creds.c +++ b/test/core/end2end/tests/call_creds.c @@ -164,8 +164,10 @@ static void request_response_with_payload_and_call_creds( f = begin_test(config, test_name, 0); cqv = cq_verifier_create(f.cq); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + 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, + NULL); GPR_ASSERT(c); creds = grpc_google_iam_credentials_create(iam_token, iam_selector, NULL); GPR_ASSERT(creds != NULL); @@ -294,7 +296,8 @@ static void request_response_with_payload_and_call_creds( GPR_ASSERT(status == GRPC_STATUS_OK); 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")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you")); @@ -397,8 +400,10 @@ static void test_request_with_server_rejecting_client_creds( f = begin_test(config, "test_request_with_server_rejecting_client_creds", 1); cqv = cq_verifier_create(f.cq); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + 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, + NULL); GPR_ASSERT(c); creds = grpc_google_iam_credentials_create(iam_token, iam_selector, NULL); diff --git a/test/core/end2end/tests/cancel_after_accept.c b/test/core/end2end/tests/cancel_after_accept.c index 768416a108..fd03432ff5 100644 --- a/test/core/end2end/tests/cancel_after_accept.c +++ b/test/core/end2end/tests/cancel_after_accept.c @@ -151,9 +151,10 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, begin_test(config, "cancel_after_accept", args, NULL); cq_verifier *cqv = cq_verifier_create(f.cq); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/service/method", "foo.test.google.fr", - deadline, NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/service/method", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/cancel_after_client_done.c b/test/core/end2end/tests/cancel_after_client_done.c index 5adc71e255..26de66eba7 100644 --- a/test/core/end2end/tests/cancel_after_client_done.c +++ b/test/core/end2end/tests/cancel_after_client_done.c @@ -125,8 +125,10 @@ static void test_cancel_after_accept_and_writes_closed( grpc_raw_byte_buffer_create(&response_payload_slice, 1); int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + 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, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.c index 85d8799f36..afbfb02a39 100644 --- a/test/core/end2end/tests/cancel_after_invoke.c +++ b/test/core/end2end/tests/cancel_after_invoke.c @@ -120,8 +120,10 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config, grpc_byte_buffer *request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + 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, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/cancel_before_invoke.c b/test/core/end2end/tests/cancel_before_invoke.c index c57091476e..d0eeed8ab8 100644 --- a/test/core/end2end/tests/cancel_before_invoke.c +++ b/test/core/end2end/tests/cancel_before_invoke.c @@ -118,8 +118,10 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config, grpc_byte_buffer *request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + 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, + NULL); GPR_ASSERT(c); GPR_ASSERT(GRPC_CALL_OK == grpc_call_cancel(c, NULL)); diff --git a/test/core/end2end/tests/cancel_in_a_vacuum.c b/test/core/end2end/tests/cancel_in_a_vacuum.c index 3b03616b3b..5be850b6ea 100644 --- a/test/core/end2end/tests/cancel_in_a_vacuum.c +++ b/test/core/end2end/tests/cancel_in_a_vacuum.c @@ -105,8 +105,10 @@ static void test_cancel_in_a_vacuum(grpc_end2end_test_config config, gpr_timespec deadline = five_seconds_time(); cq_verifier *v_client = cq_verifier_create(f.cq); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + 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, + NULL); GPR_ASSERT(c); GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, NULL)); diff --git a/test/core/end2end/tests/cancel_with_status.c b/test/core/end2end/tests/cancel_with_status.c index e65390ac4a..3aecaf7159 100644 --- a/test/core/end2end/tests/cancel_with_status.c +++ b/test/core/end2end/tests/cancel_with_status.c @@ -97,7 +97,8 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void simple_request_body(grpc_end2end_test_fixture f, size_t num_ops) { +static void simple_request_body(grpc_end2end_test_config config, + grpc_end2end_test_fixture f, size_t num_ops) { grpc_call *c; gpr_timespec deadline = five_seconds_time(); cq_verifier *cqv = cq_verifier_create(f.cq); @@ -112,9 +113,10 @@ static void simple_request_body(grpc_end2end_test_fixture f, size_t num_ops) { gpr_log(GPR_DEBUG, "test with %" PRIuPTR " ops", num_ops); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline, - NULL); + 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, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -170,7 +172,7 @@ static void test_invoke_simple_request(grpc_end2end_test_config config, grpc_end2end_test_fixture f; f = begin_test(config, "test_invoke_simple_request", NULL, NULL); - simple_request_body(f, num_ops); + simple_request_body(config, f, num_ops); end_test(&f); config.tear_down_data(&f); } diff --git a/test/core/end2end/tests/compressed_payload.c b/test/core/end2end/tests/compressed_payload.c index 1724da4d0c..166e8efe37 100644 --- a/test/core/end2end/tests/compressed_payload.c +++ b/test/core/end2end/tests/compressed_payload.c @@ -146,8 +146,10 @@ static void request_for_disabled_algorithm( f = begin_test(config, test_name, client_args, server_args); cqv = cq_verifier_create(f.cq); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + 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, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -242,7 +244,8 @@ static void request_for_disabled_algorithm( GPR_ASSERT(0 == strcmp(details, expected_details)); gpr_free(expected_details); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); gpr_free(details); grpc_metadata_array_destroy(&initial_metadata_recv); @@ -318,8 +321,10 @@ static void request_with_payload_template( f = begin_test(config, test_name, client_args, server_args); cqv = cq_verifier_create(f.cq); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + 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, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -491,7 +496,8 @@ static void request_with_payload_template( GPR_ASSERT(status == GRPC_STATUS_OK); 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")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 0); gpr_free(details); diff --git a/test/core/end2end/tests/disappearing_server.c b/test/core/end2end/tests/disappearing_server.c index a0059b9ad5..8ebf7e643e 100644 --- a/test/core/end2end/tests/disappearing_server.c +++ b/test/core/end2end/tests/disappearing_server.c @@ -79,7 +79,8 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f, +static void do_request_and_shutdown_server(grpc_end2end_test_config config, + grpc_end2end_test_fixture *f, cq_verifier *cqv) { grpc_call *c; grpc_call *s; @@ -96,9 +97,10 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f, size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f->client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq, - "/foo", "foo.test.google.fr:1234", deadline, - NULL); + 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, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -174,7 +176,8 @@ static void do_request_and_shutdown_server(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:1234")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -196,12 +199,12 @@ static void disappearing_server_test(grpc_end2end_test_config config) { config.init_client(&f, NULL); config.init_server(&f, NULL); - do_request_and_shutdown_server(&f, cqv); + do_request_and_shutdown_server(config, &f, cqv); /* now destroy and recreate the server */ config.init_server(&f, NULL); - do_request_and_shutdown_server(&f, cqv); + do_request_and_shutdown_server(config, &f, cqv); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/tests/empty_batch.c b/test/core/end2end/tests/empty_batch.c index ac53e1839b..dc8e52a60f 100644 --- a/test/core/end2end/tests/empty_batch.c +++ b/test/core/end2end/tests/empty_batch.c @@ -97,15 +97,18 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void empty_batch_body(grpc_end2end_test_fixture f) { +static void empty_batch_body(grpc_end2end_test_config config, + grpc_end2end_test_fixture f) { grpc_call *c; gpr_timespec deadline = five_seconds_time(); cq_verifier *cqv = cq_verifier_create(f.cq); grpc_call_error error; grpc_op *op = NULL; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + 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, + NULL); GPR_ASSERT(c); error = grpc_call_start_batch(c, op, 0, tag(1), NULL); @@ -122,7 +125,7 @@ static void test_invoke_empty_body(grpc_end2end_test_config config) { grpc_end2end_test_fixture f; f = begin_test(config, "test_invoke_empty_body", NULL, NULL); - empty_batch_body(f); + empty_batch_body(config, f); end_test(&f); config.tear_down_data(&f); } diff --git a/test/core/end2end/tests/filter_call_init_fails.c b/test/core/end2end/tests/filter_call_init_fails.c index a70f50af98..84d95b20b8 100644 --- a/test/core/end2end/tests/filter_call_init_fails.c +++ b/test/core/end2end/tests/filter_call_init_fails.c @@ -127,8 +127,10 @@ static void test_request(grpc_end2end_test_config config) { char *details = NULL; size_t details_capacity = 0; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + 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, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/filter_causes_close.c b/test/core/end2end/tests/filter_causes_close.c index f14bb323f2..51e56d74a3 100644 --- a/test/core/end2end/tests/filter_causes_close.c +++ b/test/core/end2end/tests/filter_causes_close.c @@ -123,8 +123,10 @@ static void test_request(grpc_end2end_test_config config) { char *details = NULL; size_t details_capacity = 0; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + 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, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/graceful_server_shutdown.c b/test/core/end2end/tests/graceful_server_shutdown.c index 29347a068a..5fecadbe44 100644 --- a/test/core/end2end/tests/graceful_server_shutdown.c +++ b/test/core/end2end/tests/graceful_server_shutdown.c @@ -111,8 +111,10 @@ static void test_early_server_shutdown_finishes_inflight_calls( size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + 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, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -190,7 +192,8 @@ static void test_early_server_shutdown_finishes_inflight_calls( GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); diff --git a/test/core/end2end/tests/high_initial_seqno.c b/test/core/end2end/tests/high_initial_seqno.c index dab527005c..01a4909ccd 100644 --- a/test/core/end2end/tests/high_initial_seqno.c +++ b/test/core/end2end/tests/high_initial_seqno.c @@ -99,7 +99,8 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void simple_request_body(grpc_end2end_test_fixture f) { +static void simple_request_body(grpc_end2end_test_config config, + grpc_end2end_test_fixture f) { grpc_call *c; grpc_call *s; gpr_timespec deadline = five_seconds_time(); @@ -116,9 +117,10 @@ 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, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline, - NULL); + 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, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -189,7 +191,8 @@ 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:1234")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -229,7 +232,7 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config, initial_sequence_number); f = begin_test(config, name, &client_args, NULL); for (i = 0; i < 10; i++) { - simple_request_body(f); + simple_request_body(config, f); gpr_log(GPR_INFO, "Passed simple request %d", i); } end_test(&f); diff --git a/test/core/end2end/tests/hpack_size.c b/test/core/end2end/tests/hpack_size.c index fb00ae4eaa..cec8b2faae 100644 --- a/test/core/end2end/tests/hpack_size.c +++ b/test/core/end2end/tests/hpack_size.c @@ -239,7 +239,8 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void simple_request_body(grpc_end2end_test_fixture f, size_t index) { +static void simple_request_body(grpc_end2end_test_config config, + grpc_end2end_test_fixture f, size_t index) { grpc_call *c; grpc_call *s; gpr_timespec deadline = five_seconds_time(); @@ -268,9 +269,10 @@ static void simple_request_body(grpc_end2end_test_fixture f, size_t index) { extra_metadata[2].value = dragons[index % GPR_ARRAY_SIZE(dragons)]; extra_metadata[2].value_length = strlen(extra_metadata[2].value); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline, - NULL); + 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, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -342,7 +344,8 @@ static void simple_request_body(grpc_end2end_test_fixture f, size_t index) { 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:1234")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -383,7 +386,7 @@ static void test_size(grpc_end2end_test_config config, int encode_size, f = begin_test(config, name, encode_size != 4096 ? &client_args : NULL, decode_size != 4096 ? &server_args : NULL); for (i = 0; i < 4 * GPR_ARRAY_SIZE(hobbits); i++) { - simple_request_body(f, i); + simple_request_body(config, f, i); } end_test(&f); config.tear_down_data(&f); diff --git a/test/core/end2end/tests/idempotent_request.c b/test/core/end2end/tests/idempotent_request.c index 65f6dd08c5..4f6d3bb808 100644 --- a/test/core/end2end/tests/idempotent_request.c +++ b/test/core/end2end/tests/idempotent_request.c @@ -97,7 +97,8 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void simple_request_body(grpc_end2end_test_fixture f) { +static void simple_request_body(grpc_end2end_test_config config, + grpc_end2end_test_fixture f) { grpc_call *c; grpc_call *s; gpr_timespec deadline = five_seconds_time(); @@ -115,9 +116,10 @@ static void simple_request_body(grpc_end2end_test_fixture f) { int was_cancelled = 2; char *peer; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline, - NULL); + 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, + NULL); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -202,7 +204,8 @@ 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:1234")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST == call_details.flags); GPR_ASSERT(was_cancelled == 1); @@ -222,7 +225,7 @@ static void test_invoke_simple_request(grpc_end2end_test_config config) { grpc_end2end_test_fixture f; f = begin_test(config, "test_invoke_simple_request", NULL, NULL); - simple_request_body(f); + simple_request_body(config, f); end_test(&f); config.tear_down_data(&f); } @@ -232,7 +235,7 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { grpc_end2end_test_fixture f = begin_test(config, "test_invoke_10_simple_requests", NULL, NULL); for (i = 0; i < 10; i++) { - simple_request_body(f); + simple_request_body(config, f); gpr_log(GPR_INFO, "Passed simple request %d", i); } end_test(&f); diff --git a/test/core/end2end/tests/invoke_large_request.c b/test/core/end2end/tests/invoke_large_request.c index 1df237cb6c..edb655fea5 100644 --- a/test/core/end2end/tests/invoke_large_request.c +++ b/test/core/end2end/tests/invoke_large_request.c @@ -144,8 +144,10 @@ static void test_invoke_large_request(grpc_end2end_test_config config, size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + 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, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -244,7 +246,8 @@ static void test_invoke_large_request(grpc_end2end_test_config config, 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")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); diff --git a/test/core/end2end/tests/large_metadata.c b/test/core/end2end/tests/large_metadata.c index eb174a2dbb..499c56413b 100644 --- a/test/core/end2end/tests/large_metadata.c +++ b/test/core/end2end/tests/large_metadata.c @@ -125,8 +125,10 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + 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, + NULL); GPR_ASSERT(c); meta.key = "key"; @@ -227,7 +229,8 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { GPR_ASSERT(status == GRPC_STATUS_OK); 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")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(contains_metadata(&request_metadata_recv, "key", meta.value)); diff --git a/test/core/end2end/tests/load_reporting_hook.c b/test/core/end2end/tests/load_reporting_hook.c index 7f95dfd949..ca4e2709a9 100644 --- a/test/core/end2end/tests/load_reporting_hook.c +++ b/test/core/end2end/tests/load_reporting_hook.c @@ -121,12 +121,10 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void request_response_with_payload(grpc_end2end_test_fixture f, - const char *method_name, - const char *request_msg, - const char *response_msg, - grpc_metadata *initial_lr_metadata, - grpc_metadata *trailing_lr_metadata) { +static void request_response_with_payload( + grpc_end2end_test_config config, grpc_end2end_test_fixture f, + const char *method_name, const char *request_msg, const char *response_msg, + grpc_metadata *initial_lr_metadata, grpc_metadata *trailing_lr_metadata) { gpr_slice request_payload_slice = gpr_slice_from_static_string(request_msg); gpr_slice response_payload_slice = gpr_slice_from_static_string(response_msg); grpc_call *c; @@ -151,9 +149,10 @@ static void request_response_with_payload(grpc_end2end_test_fixture f, size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - method_name, "foo.test.google.fr", deadline, - NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, method_name, + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -307,8 +306,9 @@ static void test_load_reporting_hook(grpc_end2end_test_config config) { memset(&trailing_lr_metadata.internal_data, 0, sizeof(trailing_lr_metadata.internal_data)); - request_response_with_payload(f, method_name, request_msg, response_msg, - &initial_lr_metadata, &trailing_lr_metadata); + request_response_with_payload(config, f, method_name, request_msg, + response_msg, &initial_lr_metadata, + &trailing_lr_metadata); end_test(&f); grpc_channel_args_destroy(lr_server_args); config.tear_down_data(&f); diff --git a/test/core/end2end/tests/max_concurrent_streams.c b/test/core/end2end/tests/max_concurrent_streams.c index 65fa946838..9338bc5f0d 100644 --- a/test/core/end2end/tests/max_concurrent_streams.c +++ b/test/core/end2end/tests/max_concurrent_streams.c @@ -95,7 +95,8 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void simple_request_body(grpc_end2end_test_fixture f) { +static void simple_request_body(grpc_end2end_test_config config, + grpc_end2end_test_fixture f) { grpc_call *c; grpc_call *s; gpr_timespec deadline = five_seconds_time(); @@ -112,9 +113,10 @@ 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, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline, - NULL); + 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, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -185,7 +187,8 @@ 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:1234")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -250,20 +253,22 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { /* perform a ping-pong to ensure that settings have had a chance to round trip */ - simple_request_body(f); + simple_request_body(config, f); /* perform another one to make sure that the one stream case still works */ - simple_request_body(f); + simple_request_body(config, f); /* start two requests - ensuring that the second is not accepted until the first completes */ deadline = n_seconds_time(1000); - c1 = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/alpha", "foo.test.google.fr:1234", deadline, - NULL); + c1 = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/alpha", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c1); - c2 = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/beta", "foo.test.google.fr:1234", deadline, - NULL); + c2 = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/beta", + get_host_override_string("foo.test.google.fr:1234", config), deadline, + NULL); GPR_ASSERT(c2); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( diff --git a/test/core/end2end/tests/max_message_length.c b/test/core/end2end/tests/max_message_length.c index 3a927ddcbc..b416627bfd 100644 --- a/test/core/end2end/tests/max_message_length.c +++ b/test/core/end2end/tests/max_message_length.c @@ -172,9 +172,10 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config, cqv = cq_verifier_create(f.cq); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/service/method", "foo.test.google.fr:1234", - gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/service/method", + get_host_override_string("foo.test.google.fr:1234", config), + gpr_inf_future(GPR_CLOCK_REALTIME), NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -247,7 +248,8 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config, cq_verify(cqv); GPR_ASSERT(0 == strcmp(call_details.method, "/service/method")); - GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr:1234")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 1); done: diff --git a/test/core/end2end/tests/negative_deadline.c b/test/core/end2end/tests/negative_deadline.c index c999ac116a..929777d39e 100644 --- a/test/core/end2end/tests/negative_deadline.c +++ b/test/core/end2end/tests/negative_deadline.c @@ -97,7 +97,8 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void simple_request_body(grpc_end2end_test_fixture f, size_t num_ops) { +static void simple_request_body(grpc_end2end_test_config config, + grpc_end2end_test_fixture f, size_t num_ops) { grpc_call *c; gpr_timespec deadline = gpr_inf_past(GPR_CLOCK_REALTIME); cq_verifier *cqv = cq_verifier_create(f.cq); @@ -112,9 +113,10 @@ static void simple_request_body(grpc_end2end_test_fixture f, size_t num_ops) { gpr_log(GPR_DEBUG, "test with %" PRIuPTR " ops", num_ops); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline, - NULL); + 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, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -167,7 +169,7 @@ static void test_invoke_simple_request(grpc_end2end_test_config config, grpc_end2end_test_fixture f; f = begin_test(config, "test_invoke_simple_request", NULL, NULL); - simple_request_body(f, num_ops); + simple_request_body(config, f, num_ops); end_test(&f); config.tear_down_data(&f); } diff --git a/test/core/end2end/tests/network_status_change.c b/test/core/end2end/tests/network_status_change.c index fe9c45f273..96e909e463 100644 --- a/test/core/end2end/tests/network_status_change.c +++ b/test/core/end2end/tests/network_status_change.c @@ -122,8 +122,10 @@ static void test_invoke_network_status_change(grpc_end2end_test_config config) { size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + 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, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -212,7 +214,8 @@ static void test_invoke_network_status_change(grpc_end2end_test_config config) { // Expected behavior of a RPC when network is lost. GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); gpr_free(details); grpc_metadata_array_destroy(&initial_metadata_recv); diff --git a/test/core/end2end/tests/no_logging.c b/test/core/end2end/tests/no_logging.c index 1d3cfda6e5..54614cb029 100644 --- a/test/core/end2end/tests/no_logging.c +++ b/test/core/end2end/tests/no_logging.c @@ -125,7 +125,8 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void simple_request_body(grpc_end2end_test_fixture f) { +static void simple_request_body(grpc_end2end_test_config config, + grpc_end2end_test_fixture f) { grpc_call *c; grpc_call *s; gpr_timespec deadline = five_seconds_time(); @@ -143,9 +144,10 @@ static void simple_request_body(grpc_end2end_test_fixture f) { int was_cancelled = 2; char *peer; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline, - NULL); + 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, + NULL); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -227,7 +229,8 @@ 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:1234")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 1); @@ -248,7 +251,7 @@ static void test_invoke_simple_request(grpc_end2end_test_config config) { f = begin_test(config, "test_invoke_simple_request_with_no_error_logging", NULL, NULL); - simple_request_body(f); + simple_request_body(config, f); end_test(&f); config.tear_down_data(&f); } @@ -259,10 +262,10 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { begin_test(config, "test_invoke_10_simple_requests_with_no_error_logging", NULL, NULL); for (i = 0; i < 10; i++) { - simple_request_body(f); + simple_request_body(config, f); gpr_log(GPR_INFO, "Passed simple request %d", i); } - simple_request_body(f); + simple_request_body(config, f); end_test(&f); config.tear_down_data(&f); } @@ -283,10 +286,10 @@ static void test_no_logging_in_one_request(grpc_end2end_test_config config) { grpc_end2end_test_fixture f = begin_test(config, "test_no_logging_in_last_request", NULL, NULL); for (i = 0; i < 10; i++) { - simple_request_body(f); + simple_request_body(config, f); } gpr_atm_no_barrier_store(&g_log_func, (gpr_atm)test_no_log); - simple_request_body(f); + simple_request_body(config, f); gpr_atm_no_barrier_store(&g_log_func, (gpr_atm)gpr_default_log); end_test(&f); config.tear_down_data(&f); diff --git a/test/core/end2end/tests/payload.c b/test/core/end2end/tests/payload.c index 40696d088f..17cea48f03 100644 --- a/test/core/end2end/tests/payload.c +++ b/test/core/end2end/tests/payload.c @@ -111,7 +111,8 @@ static gpr_slice generate_random_slice() { return out; } -static void request_response_with_payload(grpc_end2end_test_fixture f) { +static void request_response_with_payload(grpc_end2end_test_config config, + grpc_end2end_test_fixture f) { /* Create large request and response bodies. These are big enough to require * multiple round trips to deliver to the peer, and their exact contents of * will be verified on completion. */ @@ -140,8 +141,10 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) { size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + 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, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -240,7 +243,8 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) { GPR_ASSERT(status == GRPC_STATUS_OK); 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")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_slice(request_payload_recv, request_payload_slice)); GPR_ASSERT( @@ -269,7 +273,7 @@ static void test_invoke_request_response_with_payload( grpc_end2end_test_config config) { grpc_end2end_test_fixture f = begin_test( config, "test_invoke_request_response_with_payload", NULL, NULL); - request_response_with_payload(f); + request_response_with_payload(config, f); end_test(&f); config.tear_down_data(&f); } @@ -280,7 +284,7 @@ static void test_invoke_10_request_response_with_payload( grpc_end2end_test_fixture f = begin_test( config, "test_invoke_10_request_response_with_payload", NULL, NULL); for (i = 0; i < 10; i++) { - request_response_with_payload(f); + request_response_with_payload(config, f); } end_test(&f); config.tear_down_data(&f); diff --git a/test/core/end2end/tests/ping_pong_streaming.c b/test/core/end2end/tests/ping_pong_streaming.c index 7e360c415b..52f0d70a44 100644 --- a/test/core/end2end/tests/ping_pong_streaming.c +++ b/test/core/end2end/tests/ping_pong_streaming.c @@ -123,9 +123,10 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world"); gpr_slice response_payload_slice = gpr_slice_from_copied_string("hello you"); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline, - NULL); + 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, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/registered_call.c b/test/core/end2end/tests/registered_call.c index 9b2b42b558..6594b420b9 100644 --- a/test/core/end2end/tests/registered_call.c +++ b/test/core/end2end/tests/registered_call.c @@ -97,7 +97,8 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void simple_request_body(grpc_end2end_test_fixture f, void *rc) { +static void simple_request_body(grpc_end2end_test_config config, + grpc_end2end_test_fixture f, void *rc) { grpc_call *c; grpc_call *s; gpr_timespec deadline = five_seconds_time(); @@ -186,7 +187,8 @@ static void simple_request_body(grpc_end2end_test_fixture f, void *rc) { 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:1234")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -204,10 +206,11 @@ static void simple_request_body(grpc_end2end_test_fixture f, void *rc) { static void test_invoke_simple_request(grpc_end2end_test_config config) { grpc_end2end_test_fixture f = begin_test(config, "test_invoke_simple_request", NULL, NULL); - void *rc = grpc_channel_register_call(f.client, "/foo", - "foo.test.google.fr:1234", NULL); + void *rc = grpc_channel_register_call( + f.client, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), NULL); - simple_request_body(f, rc); + simple_request_body(config, f, rc); end_test(&f); config.tear_down_data(&f); } @@ -216,11 +219,12 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { int i; grpc_end2end_test_fixture f = begin_test(config, "test_invoke_10_simple_requests", NULL, NULL); - void *rc = grpc_channel_register_call(f.client, "/foo", - "foo.test.google.fr:1234", NULL); + void *rc = grpc_channel_register_call( + f.client, "/foo", + get_host_override_string("foo.test.google.fr:1234", config), NULL); for (i = 0; i < 10; i++) { - simple_request_body(f, rc); + simple_request_body(config, f, rc); gpr_log(GPR_INFO, "Passed simple request %d", i); } end_test(&f); diff --git a/test/core/end2end/tests/request_with_flags.c b/test/core/end2end/tests/request_with_flags.c index 25150e6f2d..f96ef6aa94 100644 --- a/test/core/end2end/tests/request_with_flags.c +++ b/test/core/end2end/tests/request_with_flags.c @@ -120,8 +120,10 @@ static void test_invoke_request_with_flags( size_t details_capacity = 0; grpc_call_error expectation; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + 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, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/request_with_payload.c b/test/core/end2end/tests/request_with_payload.c index 67208c050c..359f4e9fd2 100644 --- a/test/core/end2end/tests/request_with_payload.c +++ b/test/core/end2end/tests/request_with_payload.c @@ -119,8 +119,10 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + 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, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -208,7 +210,8 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { GPR_ASSERT(status == GRPC_STATUS_OK); 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")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); diff --git a/test/core/end2end/tests/server_finishes_request.c b/test/core/end2end/tests/server_finishes_request.c index 7fb9025aa3..3bb25fd924 100644 --- a/test/core/end2end/tests/server_finishes_request.c +++ b/test/core/end2end/tests/server_finishes_request.c @@ -97,7 +97,8 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void simple_request_body(grpc_end2end_test_fixture f) { +static void simple_request_body(grpc_end2end_test_config config, + grpc_end2end_test_fixture f) { grpc_call *c; grpc_call *s; gpr_timespec deadline = five_seconds_time(); @@ -114,9 +115,10 @@ 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, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline, - NULL); + 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, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -183,7 +185,8 @@ 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:1234")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -202,7 +205,7 @@ static void test_invoke_simple_request(grpc_end2end_test_config config) { grpc_end2end_test_fixture f; f = begin_test(config, "test_invoke_simple_request", NULL, NULL); - simple_request_body(f); + simple_request_body(config, f); end_test(&f); config.tear_down_data(&f); } diff --git a/test/core/end2end/tests/shutdown_finishes_calls.c b/test/core/end2end/tests/shutdown_finishes_calls.c index dff2e6f280..b80a2e35f2 100644 --- a/test/core/end2end/tests/shutdown_finishes_calls.c +++ b/test/core/end2end/tests/shutdown_finishes_calls.c @@ -104,8 +104,10 @@ static void test_early_server_shutdown_finishes_inflight_calls( size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + 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, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -171,7 +173,8 @@ static void test_early_server_shutdown_finishes_inflight_calls( GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); diff --git a/test/core/end2end/tests/simple_cacheable_request.c b/test/core/end2end/tests/simple_cacheable_request.c index b52eb19315..9f6a6a08a0 100644 --- a/test/core/end2end/tests/simple_cacheable_request.c +++ b/test/core/end2end/tests/simple_cacheable_request.c @@ -133,8 +133,10 @@ static void test_cacheable_request_response_with_metadata_and_payload( size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + 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, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -235,7 +237,8 @@ static void test_cacheable_request_response_with_metadata_and_payload( GPR_ASSERT(status == GRPC_STATUS_OK); 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")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); if (config.feature_mask & FEATURE_MASK_SUPPORTS_REQUEST_PROXYING) { // Our simple proxy does not support cacheable requests } else { diff --git a/test/core/end2end/tests/simple_delayed_request.c b/test/core/end2end/tests/simple_delayed_request.c index 50d1975c8d..ec40c8f22d 100644 --- a/test/core/end2end/tests/simple_delayed_request.c +++ b/test/core/end2end/tests/simple_delayed_request.c @@ -106,8 +106,10 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, config.init_client(f, client_args); - c = grpc_channel_create_call(f->client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq, - "/foo", "foo.test.google.fr", deadline, NULL); + 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, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -180,7 +182,8 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, 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")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); diff --git a/test/core/end2end/tests/simple_metadata.c b/test/core/end2end/tests/simple_metadata.c index 13c77c033e..7b8adb1f32 100644 --- a/test/core/end2end/tests/simple_metadata.c +++ b/test/core/end2end/tests/simple_metadata.c @@ -130,8 +130,10 @@ static void test_request_response_with_metadata_and_payload( size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + 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, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -232,7 +234,8 @@ static void test_request_response_with_metadata_and_payload( GPR_ASSERT(status == GRPC_STATUS_OK); 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")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you")); diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c index ed7b850808..2dea5d6af2 100644 --- a/test/core/end2end/tests/simple_request.c +++ b/test/core/end2end/tests/simple_request.c @@ -97,7 +97,8 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -static void simple_request_body(grpc_end2end_test_fixture f) { +static void simple_request_body(grpc_end2end_test_config config, + grpc_end2end_test_fixture f) { grpc_call *c; grpc_call *s; gpr_timespec deadline = five_seconds_time(); @@ -115,9 +116,10 @@ static void simple_request_body(grpc_end2end_test_fixture f) { int was_cancelled = 2; char *peer; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline, - NULL); + 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, + NULL); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -202,7 +204,8 @@ 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:1234")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 1); @@ -222,7 +225,7 @@ static void test_invoke_simple_request(grpc_end2end_test_config config) { grpc_end2end_test_fixture f; f = begin_test(config, "test_invoke_simple_request", NULL, NULL); - simple_request_body(f); + simple_request_body(config, f); end_test(&f); config.tear_down_data(&f); } @@ -232,7 +235,7 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { grpc_end2end_test_fixture f = begin_test(config, "test_invoke_10_simple_requests", NULL, NULL); for (i = 0; i < 10; i++) { - simple_request_body(f); + simple_request_body(config, f); gpr_log(GPR_INFO, "Passed simple request %d", i); } end_test(&f); diff --git a/test/core/end2end/tests/streaming_error_response.c b/test/core/end2end/tests/streaming_error_response.c index 8285468321..7b5315d667 100644 --- a/test/core/end2end/tests/streaming_error_response.c +++ b/test/core/end2end/tests/streaming_error_response.c @@ -125,8 +125,10 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + 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, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -245,7 +247,8 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { GPR_ASSERT(status == GRPC_STATUS_FAILED_PRECONDITION); 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")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(was_cancelled == 1); gpr_free(details); diff --git a/test/core/end2end/tests/trailing_metadata.c b/test/core/end2end/tests/trailing_metadata.c index d7093ae723..87e29a934f 100644 --- a/test/core/end2end/tests/trailing_metadata.c +++ b/test/core/end2end/tests/trailing_metadata.c @@ -133,8 +133,10 @@ static void test_request_response_with_metadata_and_payload( size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + 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, + NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -236,7 +238,8 @@ static void test_request_response_with_metadata_and_payload( GPR_ASSERT(status == GRPC_STATUS_OK); 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")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you")); GPR_ASSERT(contains_metadata(&request_metadata_recv, "key1", "val1")); |