From 6d686451627122eeb5a07da2ede2cebc1c289acd Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 19 Sep 2016 16:48:36 -0700 Subject: Update unit tests and fixtures with AUTHORITY_HEADER support option --- test/core/end2end/end2end_tests.h | 4 ++++ test/core/end2end/fixtures/h2_census.c | 3 ++- test/core/end2end/fixtures/h2_compress.c | 3 ++- test/core/end2end/fixtures/h2_fakesec.c | 3 ++- test/core/end2end/fixtures/h2_fd.c | 6 +++--- test/core/end2end/fixtures/h2_full+pipe.c | 3 ++- test/core/end2end/fixtures/h2_full+trace.c | 3 ++- test/core/end2end/fixtures/h2_full.c | 3 ++- test/core/end2end/fixtures/h2_load_reporting.c | 2 +- test/core/end2end/fixtures/h2_oauth2.c | 3 ++- test/core/end2end/fixtures/h2_proxy.c | 6 ++++-- test/core/end2end/fixtures/h2_sockpair+trace.c | 2 +- test/core/end2end/fixtures/h2_sockpair.c | 3 ++- test/core/end2end/fixtures/h2_sockpair_1byte.c | 3 ++- test/core/end2end/fixtures/h2_ssl.c | 3 ++- test/core/end2end/fixtures/h2_ssl_proxy.c | 3 ++- test/core/end2end/fixtures/h2_uds.c | 4 +++- test/core/end2end/tests/call_creds.c | 11 ++++++++--- test/core/end2end/tests/cancel_after_accept.c | 5 ++++- test/core/end2end/tests/cancel_after_client_done.c | 5 ++++- test/core/end2end/tests/cancel_after_invoke.c | 5 ++++- test/core/end2end/tests/cancel_before_invoke.c | 5 ++++- test/core/end2end/tests/cancel_in_a_vacuum.c | 5 ++++- test/core/end2end/tests/cancel_with_status.c | 5 ++++- test/core/end2end/tests/compressed_payload.c | 15 +++++++++++---- test/core/end2end/tests/disappearing_server.c | 9 +++++++-- test/core/end2end/tests/empty_batch.c | 5 ++++- test/core/end2end/tests/filter_call_init_fails.c | 5 ++++- test/core/end2end/tests/filter_causes_close.c | 5 ++++- test/core/end2end/tests/graceful_server_shutdown.c | 9 +++++++-- test/core/end2end/tests/high_initial_seqno.c | 9 +++++++-- test/core/end2end/tests/hpack_size.c | 9 +++++++-- test/core/end2end/tests/idempotent_request.c | 9 +++++++-- test/core/end2end/tests/invoke_large_request.c | 9 +++++++-- test/core/end2end/tests/large_metadata.c | 9 +++++++-- test/core/end2end/tests/load_reporting_hook.c | 5 ++++- test/core/end2end/tests/max_concurrent_streams.c | 13 +++++++++---- test/core/end2end/tests/max_message_length.c | 9 +++++++-- test/core/end2end/tests/negative_deadline.c | 5 ++++- test/core/end2end/tests/network_status_change.c | 9 +++++++-- test/core/end2end/tests/no_logging.c | 9 +++++++-- test/core/end2end/tests/payload.c | 9 +++++++-- test/core/end2end/tests/ping_pong_streaming.c | 5 ++++- test/core/end2end/tests/registered_call.c | 11 ++++++++--- test/core/end2end/tests/request_with_flags.c | 5 ++++- test/core/end2end/tests/request_with_payload.c | 9 +++++++-- test/core/end2end/tests/server_finishes_request.c | 9 +++++++-- test/core/end2end/tests/shutdown_finishes_calls.c | 9 +++++++-- test/core/end2end/tests/simple_cacheable_request.c | 9 +++++++-- test/core/end2end/tests/simple_delayed_request.c | 9 +++++++-- test/core/end2end/tests/simple_metadata.c | 9 +++++++-- test/core/end2end/tests/simple_request.c | 10 +++++++--- test/core/end2end/tests/streaming_error_response.c | 9 +++++++-- test/core/end2end/tests/trailing_metadata.c | 9 +++++++-- 54 files changed, 266 insertions(+), 87 deletions(-) diff --git a/test/core/end2end/end2end_tests.h b/test/core/end2end/end2end_tests.h index 34af0936cd..6380b96f33 100644 --- a/test/core/end2end/end2end_tests.h +++ b/test/core/end2end/end2end_tests.h @@ -43,9 +43,13 @@ typedef struct grpc_end2end_test_config grpc_end2end_test_config; #define FEATURE_MASK_SUPPORTS_HOSTNAME_VERIFICATION 2 #define FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS 4 #define FEATURE_MASK_SUPPORTS_REQUEST_PROXYING 8 +#define FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER 16 #define FAIL_AUTH_CHECK_SERVER_ARG_NAME "fail_auth_check" +#define validate_host_override_string(str, config) \ + ((config).feature_mask & FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER ? (str) : NULL) + struct grpc_end2end_test_fixture { grpc_completion_queue *cq; grpc_server *server; diff --git a/test/core/end2end/fixtures/h2_census.c b/test/core/end2end/fixtures/h2_census.c index e46b39e476..e81cf82af1 100644 --- a/test/core/end2end/fixtures/h2_census.c +++ b/test/core/end2end/fixtures/h2_census.c @@ -111,7 +111,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, + {"chttp2/fullstack+census", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | 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 8f9b7c9cd9..41a48b920f 100644 --- a/test/core/end2end/fixtures/h2_compress.c +++ b/test/core/end2end/fixtures/h2_compress.c @@ -113,7 +113,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, + {"chttp2/fullstack_compression", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | 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 44408b28af..30da801dee 100644 --- a/test/core/end2end/fixtures/h2_fakesec.c +++ b/test/core/end2end/fixtures/h2_fakesec.c @@ -140,7 +140,8 @@ static void chttp2_init_server_fake_secure_fullstack( static grpc_end2end_test_config configs[] = { {"chttp2/fake_secure_fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS, + FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS | + 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 89fa02517d..ed71d72ef4 100644 --- a/test/core/end2end/fixtures/h2_fd.c +++ b/test/core/end2end/fixtures/h2_fd.c @@ -106,9 +106,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 e7dfc561a1..d67bf9f1bb 100644 --- a/test/core/end2end/fixtures/h2_full+pipe.c +++ b/test/core/end2end/fixtures/h2_full+pipe.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, + {"chttp2/fullstack", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | 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 c4dc5b9bc1..6f2b4e37db 100644 --- a/test/core/end2end/fixtures/h2_full+trace.c +++ b/test/core/end2end/fixtures/h2_full+trace.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, + {"chttp2/fullstack", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | 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 4a2f17eb91..d85669e021 100644 --- a/test/core/end2end/fixtures/h2_full.c +++ b/test/core/end2end/fixtures/h2_full.c @@ -96,7 +96,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, + {"chttp2/fullstack", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | 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 f6d3923db9..6965418eef 100644 --- a/test/core/end2end/fixtures/h2_load_reporting.c +++ b/test/core/end2end/fixtures/h2_load_reporting.c @@ -103,7 +103,7 @@ void chttp2_tear_down_load_reporting(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { {"chttp2/fullstack+load_reporting", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION, + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | 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 fc56998cdb..784836c2e0 100644 --- a/test/core/end2end/fixtures/h2_oauth2.c +++ b/test/core/end2end/fixtures/h2_oauth2.c @@ -216,7 +216,8 @@ static void chttp2_init_server_simple_ssl_secure_fullstack( 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_PER_CALL_CREDENTIALS | + 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 c7b99863f0..695d51a9c7 100644 --- a/test/core/end2end/fixtures/h2_proxy.c +++ b/test/core/end2end/fixtures/h2_proxy.c @@ -113,8 +113,10 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack+proxy", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_REQUEST_PROXYING, + {"chttp2/fullstack+proxy", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_REQUEST_PROXYING | + 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 b8a5257ab2..674aee5b78 100644 --- a/test/core/end2end/fixtures/h2_sockpair+trace.c +++ b/test/core/end2end/fixtures/h2_sockpair+trace.c @@ -134,7 +134,7 @@ 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/socketpair", FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_socketpair, chttp2_init_client_socketpair, chttp2_init_server_socketpair, chttp2_tear_down_socketpair}, }; diff --git a/test/core/end2end/fixtures/h2_sockpair.c b/test/core/end2end/fixtures/h2_sockpair.c index a57990d6e7..4164bc9cf3 100644 --- a/test/core/end2end/fixtures/h2_sockpair.c +++ b/test/core/end2end/fixtures/h2_sockpair.c @@ -133,7 +133,8 @@ 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/socketpair", FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + chttp2_create_fixture_socketpair, chttp2_init_client_socketpair, chttp2_init_server_socketpair, chttp2_tear_down_socketpair}, }; diff --git a/test/core/end2end/fixtures/h2_sockpair_1byte.c b/test/core/end2end/fixtures/h2_sockpair_1byte.c index 50aac8045a..e8a33bb2d4 100644 --- a/test/core/end2end/fixtures/h2_sockpair_1byte.c +++ b/test/core/end2end/fixtures/h2_sockpair_1byte.c @@ -133,7 +133,8 @@ 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/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}, }; diff --git a/test/core/end2end/fixtures/h2_ssl.c b/test/core/end2end/fixtures/h2_ssl.c index eb28623264..e2b9bb874b 100644 --- a/test/core/end2end/fixtures/h2_ssl.c +++ b/test/core/end2end/fixtures/h2_ssl.c @@ -151,7 +151,8 @@ static void chttp2_init_server_simple_ssl_secure_fullstack( static grpc_end2end_test_config configs[] = { {"chttp2/simple_ssl_fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS, + FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS | + 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 eeb54b8b88..5f131273f7 100644 --- a/test/core/end2end/fixtures/h2_ssl_proxy.c +++ b/test/core/end2end/fixtures/h2_ssl_proxy.c @@ -185,7 +185,8 @@ static grpc_end2end_test_config configs[] = { {"chttp2/simple_ssl_fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | FEATURE_MASK_SUPPORTS_REQUEST_PROXYING | - FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS, + FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS | + 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 cffbeaf045..d8892c0c88 100644 --- a/test/core/end2end/fixtures/h2_uds.c +++ b/test/core/end2end/fixtures/h2_uds.c @@ -101,7 +101,9 @@ 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, + {"chttp2/fullstack_uds", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + 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/call_creds.c b/test/core/end2end/tests/call_creds.c index 981c0fcc8c..ab8efa488b 100644 --- a/test/core/end2end/tests/call_creds.c +++ b/test/core/end2end/tests/call_creds.c @@ -51,6 +51,8 @@ static const char iam_selector[] = "selector"; static const char overridden_iam_token[] = "overridden_token"; static const char overridden_iam_selector[] = "overridden_selector"; +static char *authority; + typedef enum { NONE, OVERRIDE, DESTROY } override_mode; static void *tag(intptr_t t) { return (void *)t; } @@ -165,7 +167,7 @@ static void request_response_with_payload_and_call_creds( 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); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); creds = grpc_google_iam_credentials_create(iam_token, iam_selector, NULL); GPR_ASSERT(creds != NULL); @@ -294,7 +296,9 @@ 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } 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")); @@ -398,7 +402,7 @@ static void test_request_with_server_rejecting_client_creds( 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); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); creds = grpc_google_iam_credentials_create(iam_token, iam_selector, NULL); @@ -471,6 +475,7 @@ static void test_request_with_server_rejecting_client_creds( void call_creds(grpc_end2end_test_config config) { if (config.feature_mask & FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS) { + authority = validate_host_override_string("foo.test.google.fr", config); test_request_response_with_payload_and_call_creds(config); test_request_response_with_payload_and_overridden_call_creds(config); test_request_response_with_payload_and_deleted_call_creds(config); diff --git a/test/core/end2end/tests/cancel_after_accept.c b/test/core/end2end/tests/cancel_after_accept.c index b4ac3b3249..dd1d5bcf46 100644 --- a/test/core/end2end/tests/cancel_after_accept.c +++ b/test/core/end2end/tests/cancel_after_accept.c @@ -44,6 +44,8 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" +static void *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -126,7 +128,7 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -229,6 +231,7 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, void cancel_after_accept(grpc_end2end_test_config config) { unsigned i; + authority = validate_host_override_string("foo.test.google.fr", config); for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_after_accept(config, cancellation_modes[i]); } diff --git a/test/core/end2end/tests/cancel_after_client_done.c b/test/core/end2end/tests/cancel_after_client_done.c index 5adc71e255..90a84d1d0f 100644 --- a/test/core/end2end/tests/cancel_after_client_done.c +++ b/test/core/end2end/tests/cancel_after_client_done.c @@ -44,6 +44,8 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -126,7 +128,7 @@ static void test_cancel_after_accept_and_writes_closed( int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -233,6 +235,7 @@ static void test_cancel_after_accept_and_writes_closed( void cancel_after_client_done(grpc_end2end_test_config config) { unsigned i; + authority = validate_host_override_string("foo.test.google.fr", config); for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_after_accept_and_writes_closed(config, cancellation_modes[i]); } diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.c index 85d8799f36..346e41edae 100644 --- a/test/core/end2end/tests/cancel_after_invoke.c +++ b/test/core/end2end/tests/cancel_after_invoke.c @@ -44,6 +44,8 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -121,7 +123,7 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config, 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); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -192,6 +194,7 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config, void cancel_after_invoke(grpc_end2end_test_config config) { unsigned i, j; + authority = validate_host_override_string("foo.test.google.fr", config); for (j = 2; j < 6; j++) { for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_after_invoke(config, cancellation_modes[i], j); diff --git a/test/core/end2end/tests/cancel_before_invoke.c b/test/core/end2end/tests/cancel_before_invoke.c index c57091476e..b446264f9d 100644 --- a/test/core/end2end/tests/cancel_before_invoke.c +++ b/test/core/end2end/tests/cancel_before_invoke.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -119,7 +121,7 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config, 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); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); GPR_ASSERT(GRPC_CALL_OK == grpc_call_cancel(c, NULL)); @@ -189,6 +191,7 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config, void cancel_before_invoke(grpc_end2end_test_config config) { size_t i; + authority = validate_host_override_string("foo.test.google.fr", config); for (i = 1; i <= 6; i++) { test_cancel_before_invoke(config, i); } diff --git a/test/core/end2end/tests/cancel_in_a_vacuum.c b/test/core/end2end/tests/cancel_in_a_vacuum.c index 3b03616b3b..02e5fa555d 100644 --- a/test/core/end2end/tests/cancel_in_a_vacuum.c +++ b/test/core/end2end/tests/cancel_in_a_vacuum.c @@ -44,6 +44,8 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -106,7 +108,7 @@ static void test_cancel_in_a_vacuum(grpc_end2end_test_config config, 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); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, NULL)); @@ -121,6 +123,7 @@ static void test_cancel_in_a_vacuum(grpc_end2end_test_config config, void cancel_in_a_vacuum(grpc_end2end_test_config config) { unsigned i; + authority = validate_host_override_string("foo.test.google.fr", config); for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_in_a_vacuum(config, cancellation_modes[i]); } diff --git a/test/core/end2end/tests/cancel_with_status.c b/test/core/end2end/tests/cancel_with_status.c index e65390ac4a..b2da1099eb 100644 --- a/test/core/end2end/tests/cancel_with_status.c +++ b/test/core/end2end/tests/cancel_with_status.c @@ -45,6 +45,8 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -113,7 +115,7 @@ 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, + "/foo", authority, deadline, NULL); GPR_ASSERT(c); @@ -177,6 +179,7 @@ static void test_invoke_simple_request(grpc_end2end_test_config config, void cancel_with_status(grpc_end2end_test_config config) { size_t i; + authority = validate_host_override_string("foo.test.google.fr:1234", config); for (i = 1; i <= 4; i++) { test_invoke_simple_request(config, i); } diff --git a/test/core/end2end/tests/compressed_payload.c b/test/core/end2end/tests/compressed_payload.c index 1724da4d0c..7a9d9a706b 100644 --- a/test/core/end2end/tests/compressed_payload.c +++ b/test/core/end2end/tests/compressed_payload.c @@ -50,6 +50,8 @@ #include "src/core/lib/surface/call_test_only.h" #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -147,7 +149,7 @@ static void request_for_disabled_algorithm( 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); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -242,7 +244,9 @@ 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } gpr_free(details); grpc_metadata_array_destroy(&initial_metadata_recv); @@ -319,7 +323,7 @@ static void request_with_payload_template( 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); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -491,7 +495,9 @@ 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 0); gpr_free(details); @@ -594,6 +600,7 @@ static void test_invoke_request_with_disabled_algorithm( } void compressed_payload(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); test_invoke_request_with_exceptionally_uncompressed_payload(config); test_invoke_request_with_uncompressed_payload(config); test_invoke_request_with_compressed_payload(config); diff --git a/test/core/end2end/tests/disappearing_server.c b/test/core/end2end/tests/disappearing_server.c index a0059b9ad5..e761aa7d19 100644 --- a/test/core/end2end/tests/disappearing_server.c +++ b/test/core/end2end/tests/disappearing_server.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static gpr_timespec n_seconds_time(int n) { @@ -97,7 +99,7 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f, int was_cancelled = 2; c = grpc_channel_create_call(f->client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq, - "/foo", "foo.test.google.fr:1234", deadline, + "/foo", authority, deadline, NULL); GPR_ASSERT(c); @@ -174,7 +176,9 @@ 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -210,6 +214,7 @@ static void disappearing_server_test(grpc_end2end_test_config config) { } void disappearing_server(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr:1234", config); GPR_ASSERT(config.feature_mask & FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION); disappearing_server_test(config); } diff --git a/test/core/end2end/tests/empty_batch.c b/test/core/end2end/tests/empty_batch.c index ac53e1839b..230ee204f8 100644 --- a/test/core/end2end/tests/empty_batch.c +++ b/test/core/end2end/tests/empty_batch.c @@ -45,6 +45,8 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -105,7 +107,7 @@ static void empty_batch_body(grpc_end2end_test_fixture f) { grpc_op *op = NULL; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); error = grpc_call_start_batch(c, op, 0, tag(1), NULL); @@ -128,6 +130,7 @@ static void test_invoke_empty_body(grpc_end2end_test_config config) { } void empty_batch(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); test_invoke_empty_body(config); } diff --git a/test/core/end2end/tests/filter_call_init_fails.c b/test/core/end2end/tests/filter_call_init_fails.c index a70f50af98..6569110c67 100644 --- a/test/core/end2end/tests/filter_call_init_fails.c +++ b/test/core/end2end/tests/filter_call_init_fails.c @@ -49,6 +49,8 @@ enum { TIMEOUT = 200000 }; +static char *authority; + static bool g_enable_filter = false; static void *tag(intptr_t t) { return (void *)t; } @@ -128,7 +130,7 @@ static void test_request(grpc_end2end_test_config config) { 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); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -263,6 +265,7 @@ static void init_plugin(void) { static void destroy_plugin(void) {} void filter_call_init_fails(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); g_enable_filter = true; test_request(config); g_enable_filter = false; diff --git a/test/core/end2end/tests/filter_causes_close.c b/test/core/end2end/tests/filter_causes_close.c index cdf868377a..c8a94c440c 100644 --- a/test/core/end2end/tests/filter_causes_close.c +++ b/test/core/end2end/tests/filter_causes_close.c @@ -46,6 +46,8 @@ #include "src/core/lib/surface/channel_init.h" #include "test/core/end2end/cq_verifier.h" +static char *authority; + static bool g_enable_filter = false; static void *tag(intptr_t t) { return (void *)t; } @@ -124,7 +126,7 @@ static void test_request(grpc_end2end_test_config config) { 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); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -282,6 +284,7 @@ static void init_plugin(void) { static void destroy_plugin(void) {} void filter_causes_close(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); g_enable_filter = true; test_request(config); g_enable_filter = false; diff --git a/test/core/end2end/tests/graceful_server_shutdown.c b/test/core/end2end/tests/graceful_server_shutdown.c index 29347a068a..4c5ecb9f5c 100644 --- a/test/core/end2end/tests/graceful_server_shutdown.c +++ b/test/core/end2end/tests/graceful_server_shutdown.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -112,7 +114,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -190,7 +192,9 @@ 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -208,6 +212,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( } void graceful_server_shutdown(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); test_early_server_shutdown_finishes_inflight_calls(config); } diff --git a/test/core/end2end/tests/high_initial_seqno.c b/test/core/end2end/tests/high_initial_seqno.c index dab527005c..dbd99e8feb 100644 --- a/test/core/end2end/tests/high_initial_seqno.c +++ b/test/core/end2end/tests/high_initial_seqno.c @@ -47,6 +47,8 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -117,7 +119,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline, + "/foo", authority, deadline, NULL); GPR_ASSERT(c); @@ -189,7 +191,9 @@ 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -238,6 +242,7 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config, } void high_initial_seqno(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr:1234", config); test_invoke_10_simple_requests(config, 16777213); if (config.feature_mask & FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION) { test_invoke_10_simple_requests(config, 2147483645); diff --git a/test/core/end2end/tests/hpack_size.c b/test/core/end2end/tests/hpack_size.c index fb00ae4eaa..c207639f7b 100644 --- a/test/core/end2end/tests/hpack_size.c +++ b/test/core/end2end/tests/hpack_size.c @@ -47,6 +47,8 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } const char *hobbits[][2] = { @@ -269,7 +271,7 @@ static void simple_request_body(grpc_end2end_test_fixture f, size_t index) { 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, + "/foo", authority, deadline, NULL); GPR_ASSERT(c); @@ -342,7 +344,9 @@ 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -395,6 +399,7 @@ void hpack_size(grpc_end2end_test_config config) { 1000, 32768, 4 * 1024 * 1024}; size_t i, j; + authority = validate_host_override_string("foo.test.google.fr:1234", config); for (i = 0; i < GPR_ARRAY_SIZE(interesting_sizes); i++) { for (j = 0; j < GPR_ARRAY_SIZE(interesting_sizes); j++) { test_size(config, interesting_sizes[i], interesting_sizes[j]); diff --git a/test/core/end2end/tests/idempotent_request.c b/test/core/end2end/tests/idempotent_request.c index 65f6dd08c5..700cb21207 100644 --- a/test/core/end2end/tests/idempotent_request.c +++ b/test/core/end2end/tests/idempotent_request.c @@ -45,6 +45,8 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -116,7 +118,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { char *peer; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline, + "/foo", authority, deadline, NULL); GPR_ASSERT(c); @@ -202,7 +204,9 @@ 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST == call_details.flags); GPR_ASSERT(was_cancelled == 1); @@ -241,6 +245,7 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { void idempotent_request(grpc_end2end_test_config config) { int i; + authority = validate_host_override_string("foo.test.google.fr:1234", config); for (i = 0; i < 10; i++) { test_invoke_simple_request(config); } diff --git a/test/core/end2end/tests/invoke_large_request.c b/test/core/end2end/tests/invoke_large_request.c index 1df237cb6c..b807c94564 100644 --- a/test/core/end2end/tests/invoke_large_request.c +++ b/test/core/end2end/tests/invoke_large_request.c @@ -44,6 +44,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -145,7 +147,7 @@ static void test_invoke_large_request(grpc_end2end_test_config config, int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -244,7 +246,9 @@ 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -270,6 +274,7 @@ static void test_invoke_large_request(grpc_end2end_test_config config, } void invoke_large_request(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); test_invoke_large_request(config, 16384, 65536); test_invoke_large_request(config, 32768, 65536); diff --git a/test/core/end2end/tests/large_metadata.c b/test/core/end2end/tests/large_metadata.c index eb174a2dbb..c0819d090a 100644 --- a/test/core/end2end/tests/large_metadata.c +++ b/test/core/end2end/tests/large_metadata.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -126,7 +128,7 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); meta.key = "key"; @@ -227,7 +229,9 @@ 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } 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)); @@ -253,6 +257,7 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { } void large_metadata(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); test_request_with_large_metadata(config); } diff --git a/test/core/end2end/tests/load_reporting_hook.c b/test/core/end2end/tests/load_reporting_hook.c index 59d054cf87..62d0dad936 100644 --- a/test/core/end2end/tests/load_reporting_hook.c +++ b/test/core/end2end/tests/load_reporting_hook.c @@ -48,6 +48,8 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/transport/static_metadata.h" +static char *authority; + enum { TIMEOUT = 200000 }; static void *tag(intptr_t t) { return (void *)t; } @@ -152,7 +154,7 @@ static void request_response_with_payload(grpc_end2end_test_fixture f, int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - method_name, "foo.test.google.fr", deadline, + method_name, authority, deadline, NULL); GPR_ASSERT(c); @@ -315,6 +317,7 @@ static void test_load_reporting_hook(grpc_end2end_test_config config) { } void load_reporting_hook(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); test_load_reporting_hook(config); } diff --git a/test/core/end2end/tests/max_concurrent_streams.c b/test/core/end2end/tests/max_concurrent_streams.c index 65fa946838..925f45d42a 100644 --- a/test/core/end2end/tests/max_concurrent_streams.c +++ b/test/core/end2end/tests/max_concurrent_streams.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -113,7 +115,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline, + "/foo", authority, deadline, NULL); GPR_ASSERT(c); @@ -185,7 +187,9 @@ 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -258,11 +262,11 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { 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, + "/alpha", authority, 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, + "/beta", authority, deadline, NULL); GPR_ASSERT(c2); @@ -440,6 +444,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { } void max_concurrent_streams(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr:1234", config); test_max_concurrent_streams(config); } diff --git a/test/core/end2end/tests/max_message_length.c b/test/core/end2end/tests/max_message_length.c index cdca3e6748..6ce63bf0c6 100644 --- a/test/core/end2end/tests/max_message_length.c +++ b/test/core/end2end/tests/max_message_length.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -138,7 +140,7 @@ static void test_max_message_length(grpc_end2end_test_config config, cqv = cq_verifier_create(f.cq); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", + "/foo", authority, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); GPR_ASSERT(c); @@ -212,7 +214,9 @@ static void test_max_message_length(grpc_end2end_test_config config, cq_verify(cqv); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr:1234")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 1); done: @@ -240,6 +244,7 @@ done: } void max_message_length(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr:1234", config); test_max_message_length(config, true); test_max_message_length(config, false); } diff --git a/test/core/end2end/tests/negative_deadline.c b/test/core/end2end/tests/negative_deadline.c index c999ac116a..258d4a7168 100644 --- a/test/core/end2end/tests/negative_deadline.c +++ b/test/core/end2end/tests/negative_deadline.c @@ -45,6 +45,8 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -113,7 +115,7 @@ 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, + "/foo", authority, deadline, NULL); GPR_ASSERT(c); @@ -174,6 +176,7 @@ static void test_invoke_simple_request(grpc_end2end_test_config config, void negative_deadline(grpc_end2end_test_config config) { size_t i; + authority = validate_host_override_string("foo.test.google.fr:1234", config); for (i = 1; i <= 4; i++) { test_invoke_simple_request(config, i); } diff --git a/test/core/end2end/tests/network_status_change.c b/test/core/end2end/tests/network_status_change.c index 1d4b6dbb18..7bf003cb4a 100644 --- a/test/core/end2end/tests/network_status_change.c +++ b/test/core/end2end/tests/network_status_change.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + /* this is a private API but exposed here for testing*/ extern void grpc_network_status_shutdown_all_endpoints(); @@ -123,7 +125,7 @@ static void test_invoke_network_status_change(grpc_end2end_test_config config) { int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -212,7 +214,9 @@ 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 0); gpr_free(details); @@ -234,6 +238,7 @@ static void test_invoke_network_status_change(grpc_end2end_test_config config) { } void network_status_change(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); test_invoke_network_status_change(config); } diff --git a/test/core/end2end/tests/no_logging.c b/test/core/end2end/tests/no_logging.c index 3c40e5dbac..42fe5b70f7 100644 --- a/test/core/end2end/tests/no_logging.c +++ b/test/core/end2end/tests/no_logging.c @@ -47,6 +47,8 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" +static char *authority; + enum { TIMEOUT = 200000 }; static void *tag(intptr_t t) { return (void *)t; } @@ -137,7 +139,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { char *peer; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline, + "/foo", authority, deadline, NULL); GPR_ASSERT(c); @@ -220,7 +222,9 @@ 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 1); @@ -286,6 +290,7 @@ static void test_no_logging_in_one_request(grpc_end2end_test_config config) { } void no_logging(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr:1234", config); test_no_logging_in_one_request(config); test_no_error_logging_in_entire_process(config); } diff --git a/test/core/end2end/tests/payload.c b/test/core/end2end/tests/payload.c index c71704ff61..292a92eeb8 100644 --- a/test/core/end2end/tests/payload.c +++ b/test/core/end2end/tests/payload.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -121,7 +123,7 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) { int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -220,7 +222,9 @@ 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } 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")); @@ -266,6 +270,7 @@ static void test_invoke_10_request_response_with_payload( } void payload(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); test_invoke_request_response_with_payload(config); test_invoke_10_request_response_with_payload(config); } diff --git a/test/core/end2end/tests/ping_pong_streaming.c b/test/core/end2end/tests/ping_pong_streaming.c index 7e360c415b..372766f470 100644 --- a/test/core/end2end/tests/ping_pong_streaming.c +++ b/test/core/end2end/tests/ping_pong_streaming.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -124,7 +126,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, 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, + "/foo", authority, deadline, NULL); GPR_ASSERT(c); @@ -276,6 +278,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, void ping_pong_streaming(grpc_end2end_test_config config) { int i; + authority = validate_host_override_string("foo.test.google.fr:1234", config); for (i = 1; i < 10; i++) { test_pingpong_streaming(config, i); } diff --git a/test/core/end2end/tests/registered_call.c b/test/core/end2end/tests/registered_call.c index 9b2b42b558..1bbae56a0f 100644 --- a/test/core/end2end/tests/registered_call.c +++ b/test/core/end2end/tests/registered_call.c @@ -45,6 +45,8 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -186,7 +188,9 @@ 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -205,7 +209,7 @@ 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); + authority, NULL); simple_request_body(f, rc); end_test(&f); @@ -217,7 +221,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); void *rc = grpc_channel_register_call(f.client, "/foo", - "foo.test.google.fr:1234", NULL); + authority, NULL); for (i = 0; i < 10; i++) { simple_request_body(f, rc); @@ -228,6 +232,7 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { } void registered_call(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr:1234", config); test_invoke_simple_request(config); test_invoke_10_simple_requests(config); } diff --git a/test/core/end2end/tests/request_with_flags.c b/test/core/end2end/tests/request_with_flags.c index 25150e6f2d..623def9fd3 100644 --- a/test/core/end2end/tests/request_with_flags.c +++ b/test/core/end2end/tests/request_with_flags.c @@ -44,6 +44,8 @@ #include "src/core/lib/transport/byte_stream.h" #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -121,7 +123,7 @@ static void test_invoke_request_with_flags( grpc_call_error expectation; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -186,6 +188,7 @@ static void test_invoke_request_with_flags( void request_with_flags(grpc_end2end_test_config config) { size_t i; + authority = validate_host_override_string("foo.test.google.fr", config); uint32_t flags_for_op[GRPC_OP_RECV_CLOSE_ON_SERVER + 1]; { diff --git a/test/core/end2end/tests/request_with_payload.c b/test/core/end2end/tests/request_with_payload.c index 67208c050c..a0da85496d 100644 --- a/test/core/end2end/tests/request_with_payload.c +++ b/test/core/end2end/tests/request_with_payload.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -120,7 +122,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -208,7 +210,9 @@ 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); @@ -231,6 +235,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { } void request_with_payload(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); test_invoke_request_with_payload(config); } diff --git a/test/core/end2end/tests/server_finishes_request.c b/test/core/end2end/tests/server_finishes_request.c index 7fb9025aa3..ca8bf9278b 100644 --- a/test/core/end2end/tests/server_finishes_request.c +++ b/test/core/end2end/tests/server_finishes_request.c @@ -45,6 +45,8 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -115,7 +117,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline, + "/foo", authority, deadline, NULL); GPR_ASSERT(c); @@ -183,7 +185,9 @@ 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -208,6 +212,7 @@ static void test_invoke_simple_request(grpc_end2end_test_config config) { } void server_finishes_request(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr:1234", config); test_invoke_simple_request(config); } diff --git a/test/core/end2end/tests/shutdown_finishes_calls.c b/test/core/end2end/tests/shutdown_finishes_calls.c index dff2e6f280..f08d0f2e10 100644 --- a/test/core/end2end/tests/shutdown_finishes_calls.c +++ b/test/core/end2end/tests/shutdown_finishes_calls.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -105,7 +107,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -171,7 +173,9 @@ 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -190,6 +194,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( } void shutdown_finishes_calls(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); test_early_server_shutdown_finishes_inflight_calls(config); } diff --git a/test/core/end2end/tests/simple_cacheable_request.c b/test/core/end2end/tests/simple_cacheable_request.c index b52eb19315..997177cd4a 100644 --- a/test/core/end2end/tests/simple_cacheable_request.c +++ b/test/core/end2end/tests/simple_cacheable_request.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + enum { TIMEOUT = 200000 }; static void *tag(intptr_t t) { return (void *)t; } @@ -134,7 +136,7 @@ static void test_cacheable_request_response_with_metadata_and_payload( int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -235,7 +237,9 @@ 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } if (config.feature_mask & FEATURE_MASK_SUPPORTS_REQUEST_PROXYING) { // Our simple proxy does not support cacheable requests } else { @@ -270,6 +274,7 @@ static void test_cacheable_request_response_with_metadata_and_payload( } void simple_cacheable_request(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); test_cacheable_request_response_with_metadata_and_payload(config); } diff --git a/test/core/end2end/tests/simple_delayed_request.c b/test/core/end2end/tests/simple_delayed_request.c index 74f1232d78..7f1a284739 100644 --- a/test/core/end2end/tests/simple_delayed_request.c +++ b/test/core/end2end/tests/simple_delayed_request.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static gpr_timespec n_seconds_time(int n) { @@ -107,7 +109,7 @@ 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); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -180,7 +182,9 @@ 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -217,6 +221,7 @@ static void test_simple_delayed_request_long(grpc_end2end_test_config config) { } void simple_delayed_request(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); GPR_ASSERT(config.feature_mask & FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION); test_simple_delayed_request_short(config); test_simple_delayed_request_long(config); diff --git a/test/core/end2end/tests/simple_metadata.c b/test/core/end2end/tests/simple_metadata.c index 13c77c033e..a115ae665c 100644 --- a/test/core/end2end/tests/simple_metadata.c +++ b/test/core/end2end/tests/simple_metadata.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -131,7 +133,7 @@ static void test_request_response_with_metadata_and_payload( int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -232,7 +234,9 @@ 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } 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")); @@ -262,6 +266,7 @@ static void test_request_response_with_metadata_and_payload( } void simple_metadata(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); test_request_response_with_metadata_and_payload(config); } diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c index ed7b850808..8c311d3e7a 100644 --- a/test/core/end2end/tests/simple_request.c +++ b/test/core/end2end/tests/simple_request.c @@ -45,6 +45,8 @@ #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -116,8 +118,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { char *peer; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr:1234", deadline, - NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -202,7 +203,9 @@ 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr:1234")); + } GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 1); @@ -241,6 +244,7 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { void simple_request(grpc_end2end_test_config config) { int i; + authority = validate_host_override_string("foo.test.google.fr:1234", config); for (i = 0; i < 10; i++) { test_invoke_simple_request(config); } diff --git a/test/core/end2end/tests/streaming_error_response.c b/test/core/end2end/tests/streaming_error_response.c index 8285468321..13b7a372dd 100644 --- a/test/core/end2end/tests/streaming_error_response.c +++ b/test/core/end2end/tests/streaming_error_response.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -126,7 +128,7 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -245,7 +247,9 @@ 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -269,6 +273,7 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { } void streaming_error_response(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); test(config, false); test(config, true); } diff --git a/test/core/end2end/tests/trailing_metadata.c b/test/core/end2end/tests/trailing_metadata.c index d7093ae723..11af60ffdd 100644 --- a/test/core/end2end/tests/trailing_metadata.c +++ b/test/core/end2end/tests/trailing_metadata.c @@ -43,6 +43,8 @@ #include #include "test/core/end2end/cq_verifier.h" +static char *authority; + static void *tag(intptr_t t) { return (void *)t; } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, @@ -134,7 +136,7 @@ static void test_request_response_with_metadata_and_payload( int was_cancelled = 2; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - "/foo", "foo.test.google.fr", deadline, NULL); + "/foo", authority, deadline, NULL); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -236,7 +238,9 @@ 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")); + if (authority) { + GPR_ASSERT(0 == strcmp(call_details.host, authority)); + } 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")); @@ -267,6 +271,7 @@ static void test_request_response_with_metadata_and_payload( } void trailing_metadata(grpc_end2end_test_config config) { + authority = validate_host_override_string("foo.test.google.fr", config); test_request_response_with_metadata_and_payload(config); } -- cgit v1.2.3