aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core
diff options
context:
space:
mode:
Diffstat (limited to 'test/core')
-rw-r--r--test/core/channel/BUILD29
-rw-r--r--test/core/channel/channel_trace_test.cc240
-rw-r--r--test/core/channel/minimal_stack_is_minimal_test.cc26
-rw-r--r--test/core/channel/status_util_test.cc (renamed from test/core/client_channel/status_util_test.cc)2
-rw-r--r--test/core/client_channel/BUILD13
-rw-r--r--test/core/client_channel/parse_address_test.cc27
-rw-r--r--test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc5
-rw-r--r--test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc140
-rw-r--r--test/core/client_channel/resolvers/dns_resolver_test.cc7
-rw-r--r--test/core/client_channel/retry_throttle_test.cc142
-rw-r--r--test/core/compression/algorithm_test.cc1
-rw-r--r--test/core/debug/stats_test.cc12
-rw-r--r--test/core/end2end/BUILD17
-rw-r--r--test/core/end2end/connection_refused_test.cc1
-rw-r--r--test/core/end2end/cq_verifier.cc1
-rw-r--r--test/core/end2end/end2end_nosec_tests.cc16
-rw-r--r--test/core/end2end/end2end_tests.cc16
-rw-r--r--test/core/end2end/end2end_tests.h5
-rw-r--r--test/core/end2end/fixtures/h2_census.cc2
-rw-r--r--test/core/end2end/fixtures/h2_compress.cc2
-rw-r--r--test/core/end2end/fixtures/h2_fakesec.cc3
-rw-r--r--test/core/end2end/fixtures/h2_fd.cc2
-rw-r--r--test/core/end2end/fixtures/h2_full+pipe.cc2
-rw-r--r--test/core/end2end/fixtures/h2_full+trace.cc2
-rw-r--r--test/core/end2end/fixtures/h2_full+workarounds.cc2
-rw-r--r--test/core/end2end/fixtures/h2_full.cc2
-rw-r--r--test/core/end2end/fixtures/h2_http_proxy.cc2
-rw-r--r--test/core/end2end/fixtures/h2_load_reporting.cc5
-rw-r--r--test/core/end2end/fixtures/h2_oauth2.cc2
-rw-r--r--test/core/end2end/fixtures/h2_proxy.cc2
-rw-r--r--test/core/end2end/fixtures/h2_sockpair+trace.cc11
-rw-r--r--test/core/end2end/fixtures/h2_sockpair.cc10
-rw-r--r--test/core/end2end/fixtures/h2_sockpair_1byte.cc14
-rw-r--r--test/core/end2end/fixtures/h2_ssl.cc7
-rw-r--r--test/core/end2end/fixtures/h2_ssl_proxy.cc2
-rw-r--r--test/core/end2end/fixtures/h2_uds.cc2
-rw-r--r--test/core/end2end/fixtures/http_proxy_fixture.cc6
-rw-r--r--test/core/end2end/fixtures/inproc.cc5
-rw-r--r--test/core/end2end/fuzzers/BUILD2
-rw-r--r--test/core/end2end/fuzzers/api_fuzzer.cc154
-rw-r--r--test/core/end2end/fuzzers/api_fuzzer_corpus/clusterfuzz-testcase-api_fuzzer-5406804084260864bin0 -> 44 bytes
-rw-r--r--test/core/end2end/fuzzers/api_fuzzer_corpus/clusterfuzz-testcase-api_fuzzer-5471994809155584bin0 -> 287 bytes
-rw-r--r--test/core/end2end/fuzzers/api_fuzzer_corpus/clusterfuzz-testcase-api_fuzzer-6609852341157888bin0 -> 1125 bytes
-rw-r--r--test/core/end2end/fuzzers/client_fuzzer.cc9
-rwxr-xr-xtest/core/end2end/gen_build_yaml.py5
-rwxr-xr-xtest/core/end2end/generate_tests.bzl4
-rw-r--r--test/core/end2end/goaway_server_test.cc48
-rw-r--r--test/core/end2end/h2_ssl_cert_test.cc31
-rw-r--r--test/core/end2end/h2_ssl_session_reuse_test.cc280
-rw-r--r--test/core/end2end/no_server_test.cc70
-rw-r--r--test/core/end2end/tests/bad_ping.cc184
-rw-r--r--test/core/end2end/tests/binary_metadata.cc10
-rw-r--r--test/core/end2end/tests/call_creds.cc18
-rw-r--r--test/core/end2end/tests/call_host_override.cc230
-rw-r--r--test/core/end2end/tests/cancel_after_accept.cc9
-rw-r--r--test/core/end2end/tests/cancel_after_client_done.cc8
-rw-r--r--test/core/end2end/tests/cancel_after_invoke.cc9
-rw-r--r--test/core/end2end/tests/cancel_after_round_trip.cc9
-rw-r--r--test/core/end2end/tests/cancel_before_invoke.cc9
-rw-r--r--test/core/end2end/tests/cancel_in_a_vacuum.cc8
-rw-r--r--test/core/end2end/tests/cancel_with_status.cc9
-rw-r--r--test/core/end2end/tests/compressed_payload.cc20
-rw-r--r--test/core/end2end/tests/default_host.cc23
-rw-r--r--test/core/end2end/tests/disappearing_server.cc10
-rw-r--r--test/core/end2end/tests/empty_batch.cc8
-rw-r--r--test/core/end2end/tests/filter_call_init_fails.cc32
-rw-r--r--test/core/end2end/tests/filter_causes_close.cc8
-rw-r--r--test/core/end2end/tests/filter_latency.cc7
-rw-r--r--test/core/end2end/tests/filter_status_code.cc7
-rw-r--r--test/core/end2end/tests/graceful_server_shutdown.cc10
-rw-r--r--test/core/end2end/tests/high_initial_seqno.cc10
-rw-r--r--test/core/end2end/tests/hpack_size.cc10
-rw-r--r--test/core/end2end/tests/idempotent_request.cc10
-rw-r--r--test/core/end2end/tests/invoke_large_request.cc10
-rw-r--r--test/core/end2end/tests/keepalive_timeout.cc12
-rw-r--r--test/core/end2end/tests/large_metadata.cc10
-rw-r--r--test/core/end2end/tests/load_reporting_hook.cc8
-rw-r--r--test/core/end2end/tests/max_concurrent_streams.cc58
-rw-r--r--test/core/end2end/tests/max_connection_age.cc20
-rw-r--r--test/core/end2end/tests/max_connection_idle.cc10
-rw-r--r--test/core/end2end/tests/max_message_length.cc24
-rw-r--r--test/core/end2end/tests/negative_deadline.cc9
-rw-r--r--test/core/end2end/tests/network_status_change.cc10
-rw-r--r--test/core/end2end/tests/no_logging.cc10
-rw-r--r--test/core/end2end/tests/payload.cc10
-rw-r--r--test/core/end2end/tests/ping_pong_streaming.cc8
-rw-r--r--test/core/end2end/tests/proxy_auth.cc10
-rw-r--r--test/core/end2end/tests/registered_call.cc10
-rw-r--r--test/core/end2end/tests/request_with_flags.cc16
-rw-r--r--test/core/end2end/tests/request_with_payload.cc10
-rw-r--r--test/core/end2end/tests/resource_quota_server.cc9
-rw-r--r--test/core/end2end/tests/retry.cc10
-rw-r--r--test/core/end2end/tests/retry_cancellation.cc8
-rw-r--r--test/core/end2end/tests/retry_disabled.cc10
-rw-r--r--test/core/end2end/tests/retry_exceeds_buffer_size_in_initial_batch.cc10
-rw-r--r--test/core/end2end/tests/retry_exceeds_buffer_size_in_subsequent_batch.cc10
-rw-r--r--test/core/end2end/tests/retry_non_retriable_status.cc10
-rw-r--r--test/core/end2end/tests/retry_non_retriable_status_before_recv_trailing_metadata_started.cc266
-rw-r--r--test/core/end2end/tests/retry_recv_initial_metadata.cc10
-rw-r--r--test/core/end2end/tests/retry_recv_message.cc10
-rw-r--r--test/core/end2end/tests/retry_server_pushback_delay.cc10
-rw-r--r--test/core/end2end/tests/retry_server_pushback_disabled.cc10
-rw-r--r--test/core/end2end/tests/retry_streaming.cc10
-rw-r--r--test/core/end2end/tests/retry_streaming_after_commit.cc10
-rw-r--r--test/core/end2end/tests/retry_streaming_succeeds_before_replay_finished.cc10
-rw-r--r--test/core/end2end/tests/retry_throttled.cc10
-rw-r--r--test/core/end2end/tests/retry_too_many_attempts.cc10
-rw-r--r--test/core/end2end/tests/server_finishes_request.cc10
-rw-r--r--test/core/end2end/tests/shutdown_finishes_calls.cc17
-rw-r--r--test/core/end2end/tests/simple_cacheable_request.cc10
-rw-r--r--test/core/end2end/tests/simple_delayed_request.cc10
-rw-r--r--test/core/end2end/tests/simple_metadata.cc10
-rw-r--r--test/core/end2end/tests/simple_request.cc10
-rw-r--r--test/core/end2end/tests/stream_compression_compressed_payload.cc20
-rw-r--r--test/core/end2end/tests/stream_compression_payload.cc10
-rw-r--r--test/core/end2end/tests/stream_compression_ping_pong_streaming.cc8
-rw-r--r--test/core/end2end/tests/streaming_error_response.cc10
-rw-r--r--test/core/end2end/tests/trailing_metadata.cc10
-rw-r--r--test/core/end2end/tests/workaround_cronet_compression.cc10
-rw-r--r--test/core/end2end/tests/write_buffering.cc10
-rw-r--r--test/core/end2end/tests/write_buffering_at_end.cc10
-rw-r--r--test/core/gpr/mpscq_test.cc1
-rw-r--r--test/core/gpr/time_test.cc1
-rw-r--r--test/core/gprpp/inlined_vector_test.cc8
-rw-r--r--test/core/gprpp/ref_counted_ptr_test.cc2
-rw-r--r--test/core/handshake/readahead_handshaker_server_ssl.cc2
-rw-r--r--test/core/http/httpcli_test.cc1
-rw-r--r--test/core/http/httpscli_test.cc1
-rw-r--r--test/core/iomgr/resource_quota_test.cc1
-rw-r--r--test/core/iomgr/sockaddr_utils_test.cc46
-rw-r--r--test/core/iomgr/tcp_client_posix_test.cc6
-rw-r--r--test/core/iomgr/tcp_server_posix_test.cc14
-rw-r--r--test/core/iomgr/timer_heap_test.cc9
-rw-r--r--test/core/iomgr/timer_list_test.cc11
-rw-r--r--test/core/iomgr/udp_server_test.cc37
-rw-r--r--test/core/iomgr/wakeup_fd_cv_test.cc2
-rw-r--r--test/core/security/BUILD25
-rw-r--r--test/core/security/alts_credentials_fuzzer.cc120
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/0149b46b88d583e05be0fb1423d10f2a14d36c48bin0 -> 9 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/047fc351e73f760d329d5a8845944720be9ce773bin0 -> 685 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/04ef96c66d8222d1a2c07e6b2a6548e6a527042bbin0 -> 12 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/05a7e16c1d7f92111f43e9c777421879920e79a4bin0 -> 219 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/063eb46f202fdfe7935c30ca38d7eb81c82db419bin0 -> 10 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/064773597c295fa871c184fc12d17b6de8aab31bbin0 -> 91 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/087449740758b114d16790067707934479946bd6bin0 -> 7 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/0a5d068feb57a2782c6eba57b637abe8668ac82fbin0 -> 271 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/0b81e6d89bf7df80e87e5ee7c49f7cc1431f77e8bin0 -> 130 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/11409339cec708a5e353893101bfe76364337d5cbin0 -> 4 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/147696a264cd6f197adb7c68aff834c30b1b77f81
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/160e5cac38c5c9e919ed6e4fbafee76907d63044bin0 -> 7 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/173d02167db431040b0540d98f6fc5e8b456587d1
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/18a3fe239806b3c7d1af24bcd2bd23aeeb072d5cbin0 -> 542 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/195abd83b2e9d32b1b5b854fe33da44b6db408801
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/19af2509c7d84334b9ec64de4767a07d5294fd72bin0 -> 7 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/1b9864b948fcf08b062fd4401ef55b214c259535bin0 -> 642 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/1edddfa67de854d7faaba41418fda845e9c6a89dbin0 -> 385 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/20031bb00e6608e1b570aa96e6afb9de06d42167bin0 -> 49 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/22b4c7ce7db99b0df63c9eae9265de484b695922bin0 -> 15 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/27416437ad287bd3cc1c5efdecebc39f20df73c11
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/27e8cd785c2b9346f68dba75761b52fbabaf2b72bin0 -> 348 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/28236f860d3d8e5ea11176746cb4c1c5c4f1f6c0bin0 -> 28 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/29e15b492c5a409938092a30c003c5c34df7e283bin0 -> 4 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/2a47864d77749aa042b772895dbdf46f608ccc6dbin0 -> 745 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/2cca5cb1b135c35f6e5e1ec4c37deb9e12d37dc02
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/2df27b6c42dbaee382a29a87338d64ee87354acbbin0 -> 760 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/2e9ddd1339d8e599cef658a08965985c4f45e4282
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/31a2d12a84a7a56ace831a9668d6ab48473906792
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/33cb9ec0ce3538ed6079b5fcb127649a5d05955bbin0 -> 244 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/348d9ae6eebb2e1644addf7f07231d108cf6f3b81
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/359f76f3c802292e92b0640de2bfe051e780a3b6bin0 -> 4 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/35a479988e965a6e3e75138b64b0bd1f45073e2fbin0 -> 244 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/362b00d713686ff70cb0199f3d7d0058e5a1a27abin0 -> 4 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/3849c1625071791ceae709b9c6c705b28d099d67bin0 -> 32 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/39ef03c66ee2d4bcfb6c8da50486dcd40f02fb12bin0 -> 28 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/3a3ca061863499ebc171a4f910fa1b49523baad41
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/3a890f3fd01b048ac9db65a9a9b4f4443268b91abin0 -> 690 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/3b9554038a425bd1fae057ba41f9366bb467e9461
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/3ce0ae4aa226f205a3a4e66bbb253419d9d754bfbin0 -> 326 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/3dccc5523986c37e27684659bba8a1037e7a92e8bin0 -> 697 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/3e0908c15b1cede4541d25f388b1345e8641e221bin0 -> 140 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/3fcb181ff6a8c8e2ba38ed34cf78f7482eb55cb7bin0 -> 199 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/41c9b5f720eb8f8fa04c840375a881781a849b43bin0 -> 388 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/4257a018f08f13a3a9adc848ef808e1be50bc4cf2
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/42dfc5c4d13261b7259e65cd692df9c9d607194ebin0 -> 4 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/43144664aedb585d45d42aa5249ddbfe81afe470bin0 -> 3 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/43e5ad495a47593b17dbcbd3e70c2e25a417bb6ebin0 -> 531 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/446614e45b7bef49118b17e031c48faf167ebe3ebin0 -> 68 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/46492477fa84ca88e85df914801af0b09b0939f6bin0 -> 362 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/47157f83b166b57e0052c98a65c6db864fa6cb9bbin0 -> 81 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/473fc9b6d768a925527d3ad805ca363d490dc741bin0 -> 759 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/483c0b4015100eee00f6b23d1100d8c4953dd3b1bin0 -> 766 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/48be2dc4cdc5462407b319caa855d976cda88153bin0 -> 367 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/4e84eb54a0e438052b0c2e83653135042d9eb59a1
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/50839d5c8bf33f0970986dcc4b73b024f11a95b71
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/523d964986d8ad966ae07e540a608681098813f9bin0 -> 4 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/5410b8190c95dacd36d6e6ec75b7538a630e08debin0 -> 364 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/549b2891ac79f504a7c9ea00f6d7527c34ce04e6bin0 -> 66 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/55321649e7b7f1b5664ae20724e683c930643fc41
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/55cc52f25865baee3e6e52c3110a9723caa2b3cb1
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/56c22410e3295ad03aa31552ab888f581756cc17bin0 -> 283 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/5724a705b62a7548ba2df1abe4ef0c970c4e1bd2bin0 -> 759 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/576a148c107d56861d1611641a6f7c7921061c5cbin0 -> 362 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/5a6b8263e8939f851cf5b1e347a33d97253b7b3dbin0 -> 85 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/5ba93c9db0cff93f52b521d7420e43f6eda2784fbin0 -> 1 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/5bd02a339fd7705449388580c75bfcc597aba954bin0 -> 109 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/5bd6fb6fc4163bf3a9db6ddaf509dce8df8a50001
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/5d06fc38005503af3d084721c60e574fb9d2f3701
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/5ddc10489ff3269bdaa3051b70fb7af455ee1104bin0 -> 4 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/5ea9d515f0d10b04f1356b9463139bfe121a6e4abin0 -> 13 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/61c449793347cf2e1ed0c38d54d23c63dfaabeb81
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/6287389c373e9788dcc04f9747b4be1fd1ef3028bin0 -> 6 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/64d4de4d5aafab7ec388a7fe83066c1a4d1d9d68bin0 -> 37 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/651c37806d2ac579dcfc97643c3c1ea74dbb8774bin0 -> 305 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/6551d02d20573cfa2944ec1f12b0c01f264a13261
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/65f029414ee10e45ff4b9f305f7b472364cea538bin0 -> 22 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/68b75a17fe2db060df3e61a597650ba99079abbfbin0 -> 788 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/69e80594dbc5c4c648e39883a650b1760f20ab63bin0 -> 157 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/6cb47d0e640b4c41e32f13c0d64ee46eae1b80b5bin0 -> 25 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/6da5fe063432cb9094c7c083efdbbe5ba4246d18bin0 -> 243 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/6dd140da774d85f272fb587dc1b2a85d881a7c21bin0 -> 89 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/6ddab273597d73be49e2307d68e00fa18bba4765bin0 -> 16 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/6eaf85d84fbf47ea0619d0dba8d366f4e3ff0be6bin0 -> 4 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/6f751cc09af8113f6ecd491b1830bd8454c4738dbin0 -> 751 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/70d9eb29a70d483d07e2faca6b00098af78d1fffbin0 -> 124 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/7192effa1058382b379fb7b87f1acad5ac554d05bin0 -> 643 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/730e85d6a62e70cb6721009b903782ade4ff73a2bin0 -> 370 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/74002471a854059cb29de7cad8f9fb7adc3c5ec22
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/747f2330cd1fc4a06d54b376a9a6528d0364f0acbin0 -> 646 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/749d5d7a9e0b1545b297117e834462af32b3e2301
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/77de0b1de120ac702ca45868b1008a48626daf121
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/792c67398bce19a4eeda32653c994436e79456e51
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/7a3022b248c8960289e4c80c7cc8df409499e5dabin0 -> 250 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/7a9372081294a6fbd3fecdd91b99589c98d4948ebin0 -> 150 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/7bbe4ba828947550f4ad089d5989cb695ecbdb1bbin0 -> 34 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/7f1ad514a96f0c3d5ca5d6f7880b929a65eeae96bin0 -> 37 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/7f2b075f0b6707c38db851747e2578343eeab286bin0 -> 382 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/81ebc64bfde3fad37af5a58ef7f1c5c3c54c4b5dbin0 -> 4 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/82fae081afaea13831404024d39658344d56e1c6bin0 -> 77 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/83ba41cea1adab707f7f213af5e2ed734bdddc25bin0 -> 128 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/841a3f66c94e5acd836a44cd5a8514d4ad45d83ebin0 -> 161 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/841ef94ee0f1b0b45983d95b75aba25421d73f2cbin0 -> 4 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/843b0aad4a9707c5dcc92d12d876b78675cfcb65bin0 -> 168 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/8483e3d92eda8df504b1d1d0d012f4bcd778cd33bin0 -> 769 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/876830fdff4e59038fa2173b700faef5bffe61de1
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/87ca3342fdce0c1f678a3f1b62428032ef51442dbin0 -> 16 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/87d044027cdb7d35fadb56532f497764246946a6bin0 -> 642 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/88ce75ba18bdb7e93a81197d850f4e792f6a8155bin0 -> 690 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/89dc55e8e20e811e78c952c8bd2c16f55fe72f571
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/8a215a58908f44bdced595ceb01a81977f1d72f01
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/8ac7459e918304ca40b1cf29a3ac0f555eada678bin0 -> 150 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/8b93e50a911f3ea0e0b0377ba4636574f2ee9a5ebin0 -> 67 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/8c9ec0ffd803505772693833d56e7a02110645b31
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/8e4b361a530dc6825afcfb4106bd482c3fd010fa1
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/8f6690d97bcda890f2a5b2930a2b7a4d7b56c6e71
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/917636de2c14dce2580d4308249a94d61d62c305bin0 -> 31 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/91f11008defda918951bda868cc68c6373fb0e6abin0 -> 3 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/92e01a34047b660a798086d55a3d8d7100a01939bin0 -> 4 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/963fafadb4de09dee0e6a852bd61b1740039a4651
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/97bf33ec97b93fcc2449431915911a55b906e3b61
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/99e31e12b02b02479d10b2c08426906bd93a08401
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/9a75ce693e7259d4d3bb9203dfc0a65f8bbaa466bin0 -> 152 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/9ac0d956f9743e026baad7319ba2a75d9f1a534fbin0 -> 760 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/9ae56d4451dd3e1b66ddc250d84dbf6d8cae0dbdbin0 -> 13 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/9b9a3a1e4023c9b172060249752a482a3437ef2abin0 -> 14 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/9c81164e10bf612c352dca3ecabf57743b451d422
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/9d8b420b5d32deb0140ab91eeebba58ca6163722bin0 -> 15 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/9de687bf1e2cfac54c3b2e2eb85b53014a460ff7bin0 -> 77 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/9f3cda19a186bd11bfac361b464f92daa129a33bbin0 -> 97 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/a14fc6a608121f8abf0fe25cf466720f00f25653bin0 -> 964 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/a39906074669a6b76a35b0adf2bf36ad751f3b35bin0 -> 19 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/a454ca483b4a66b83826d061be2859dd79ff0d6cbin0 -> 4 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/a52df5607370ff0f56d821000f3d5e386a01d4891
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/a56eaf47f7c7263e53efdc55ec39063dbb4ae71cbin0 -> 34 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/a79249fb8f7d53f0a280359d2d9df31594adbdfcbin0 -> 687 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/aa98a46f25004f7436aadb36ff8b7f07ed7bfce11
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/adc83b19e793491b1c6ea0fd8b46cd9f32e592fc1
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/afd8e19f7bfd6c963f1856be59b75627864821dc2
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/b3966239b8568442baecbeb0f8a1aa29dcdfd7edbin0 -> 241 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/b430d41ef65493b3e917182c23ce90df983e01ab2
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/b44e715e0cfe05f0c92a9e000ac3c36aae17df9d1
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/b4cf4ef7b3f64eff76cf99091fddc04411774708bin0 -> 542 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/b53d84468ea93620a9824ca65acf1179f431e763bin0 -> 584 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/b6ac4831cc5baabee9c8ab9af9ca3923f91097a02
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/b7f4a484866a8050dbc63bc905c9803c6964eda5bin0 -> 22 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/b8f21e59f90431c982d5ec3fb54ae4605f102252bin0 -> 361 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/bad10b6581cdead8e7cb96e4f544dcf0ea650fbcbin0 -> 9 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/bb01bed86b43257be9f527388e1183f52438c4731
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/bb7497b00f0d999ef39dbf81c6bd0441e32723b6bin0 -> 359 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/bf01b72e635deda1b4a8468f1cc36f01a54e1338bin0 -> 3 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/bf8b4530d8d246dd74ac53a13471bba17941dff71
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/c08bc84ab6a512b901bb730beb05c8394e4f1c5dbin0 -> 50 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/c244b635d94e6f5d6b344887434be3e001a04b41bin0 -> 46 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/c281efe9620da999a637ff6e9b3279ec613fb992bin0 -> 73 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/c30a212824ee71e215f475f453de17c65a200101bin0 -> 172 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/c449427f35b7ecdf5641073629f7723df52c4cb01
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/c60240cd3b02eb71e2bf5ebd59afa3a5dc9b5e4dbin0 -> 172 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/c60cdf9c3fb9060838f445b3bc3852b6f81e1e4cbin0 -> 4 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/c72d0501bacadb45242c553ba292591302f12a6abin0 -> 13 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/c739e7b5ad999edbdeffdab672dbc30deb3959a0bin0 -> 34 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/c7d73b12a7108d82f8dac6d8a6a34f838601aca6bin0 -> 4 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/ca781e1add632433293e847ae9e71649c217ee5fbin0 -> 651 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/cc48e916f40e8d69c2d07cfda42c7d3b7fe3447abin0 -> 357 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/cca1aff4c08ee4ccbcb6f80e1cd1480a0a093cfdbin0 -> 372 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/cf6ae8bf1d08d25e235b7bee0839984bbc04edf6bin0 -> 4 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/cfc52fa086292c699efd7bf41d2fae3deb449536bin0 -> 510 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/cfe13ef3c6c713a059f231f0001ecec97e2a932dbin0 -> 4 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/d14026ac6421bca7161024f4e735cb80a1068d012
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/d2fb6e8f7867fc1e2ebe723da2b5246dc9cc6b14bin0 -> 4 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/d4db7d51bdaa4781cf12c3b59914bad414d2a41ebin0 -> 7 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/d533da0e7f8c1e39bb025b4d7a89613142a6f54ebin0 -> 4 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/d5cf489d01a1b847a7aac5dddabff23fdc218e1ebin0 -> 14 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/d686f8561a249c7c15c78f76a5fceb884286e070bin0 -> 73 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/d92424daad9d96a40e5ab177e3824c36ef51dc0fbin0 -> 10 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/db242a11ed88b2b26af46770dd1927d9f35301fbbin0 -> 756 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/db32eb04db13d58f65f46d262608bd088987c063bin0 -> 684 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/db39a953317951759e40734de6607a0b4457728ebin0 -> 387 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/dc5e8f3102456bed90d17303bc4cff1a7e076d5d1
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/dd9542bbed8e5dc58da2789edbfb9c38d578d3b4bin0 -> 4 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/de2ebb1ed324385de500a1a3308846239857c3c71
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/de8ba9158254c1cd84b53df1e4cdf1757b1392f1bin0 -> 650 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/e1dd260746f50024822a8b729b89545d26decfb8bin0 -> 14 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/e29add81b20dc570fdc885782689f6dccb1c5fadbin0 -> 9 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/e2e99af62843cd3b29d50daeb118e58830784da9bin0 -> 646 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/e46611c5daf99662e1576147c1623409752a1f391
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/e5a1ba11af830e9d2db201c5164f75747a85fe9bbin0 -> 94 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/e6026ee0badf216b326443a5f708446b2f2e579fbin0 -> 952 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/e6c7d2c0038fa1f03fc6590a726abc98f4c641f31
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/eafdef6a630bed71bd0e4f3d4a16b5fa0c920651bin0 -> 4 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/ece985b9b82e27281514d460709d7edf8203ded7bin0 -> 11 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/edb8f4259f756c2c4bc731f05beaa36f992cf079bin0 -> 697 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/edce7778c2e1adb81dda3d057a6536759a7cb2931
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/ee4040c0dd406dd616c49ed2c37b40478dabfe0fbin0 -> 71 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/ee69f2b380663d051a70f30fcfce9f79f5341e5abin0 -> 5 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/efc6743e47274058771bb6eda1fefa017bde4a95bin0 -> 373 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/f0038e54162000694d882b1acb80930c807b41d2bin0 -> 7 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/f1deb9e388c877337dabe92f31b01e2a019a10f4bin0 -> 223 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/f3a09373e4d3c7310d372089e6deb15d6b22c1981
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/f3db7ef6495fa1ac5bb4db293fb38dd59122bb7c2
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/f434bb4ceecc573e085d4c3ef453ef01e93d9c89bin0 -> 76 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/f55bceaad42ddf9d2b37fdfca68255d29a6961091
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/f62ca5321428a5d23f3c804fb51eb4e65bc58716bin0 -> 4 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/f7c6a558b8d0af64db2b139371a7af7068b01b92bin0 -> 661 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/faa1781e1444bba5b8c677bc5e2a38d023a1ec651
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/fceba33ada1dda05fccedfefd331c9a201f1a2e51
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/fd668bef6fdaf7f3ffd58d8c60ce550476652e60bin0 -> 247 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/fdf06b928e37e7c4ae59a568b5723ad98bbed6e5bin0 -> 19 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/fe2fc5d499aeb2762387ef2e3ce939280813dec0bin0 -> 4 bytes
-rw-r--r--test/core/security/corpus/alts_credentials_corpus/ff548d368b090409a138e5cc4afc7f43b4a3fbbdbin0 -> 748 bytes
-rw-r--r--test/core/security/credentials_test.cc10
-rw-r--r--test/core/security/grpc_alts_credentials_options_test.cc45
-rw-r--r--test/core/security/security_connector_test.cc78
-rw-r--r--test/core/slice/slice_hash_table_test.cc1
-rw-r--r--test/core/slice/slice_test.cc3
-rw-r--r--test/core/slice/slice_weak_hash_table_test.cc1
-rw-r--r--test/core/surface/BUILD12
-rw-r--r--test/core/surface/concurrent_connectivity_test.cc5
-rw-r--r--test/core/surface/invalid_channel_args_test.cc137
-rw-r--r--test/core/surface/public_headers_must_be_c89.c12
-rw-r--r--test/core/surface/server_chttp2_test.cc5
-rw-r--r--test/core/surface/server_test.cc5
-rw-r--r--test/core/transport/BUILD3
-rw-r--r--test/core/transport/byte_stream_test.cc195
-rw-r--r--test/core/transport/chttp2/bin_decoder_test.cc1
-rw-r--r--test/core/transport/chttp2/hpack_parser_fuzzer_test.cc1
-rw-r--r--test/core/transport/chttp2/hpack_parser_test.cc2
-rw-r--r--test/core/transport/chttp2/hpack_table_test.cc1
-rw-r--r--test/core/transport/connectivity_state_test.cc1
-rw-r--r--test/core/transport/metadata_test.cc1
-rw-r--r--test/core/tsi/BUILD14
-rw-r--r--test/core/tsi/alts/crypt/BUILD24
-rw-r--r--test/core/tsi/alts/crypt/gsec_test_util.cc10
-rw-r--r--test/core/tsi/alts/crypt/gsec_test_util.h2
-rw-r--r--test/core/tsi/alts/fake_handshaker/BUILD57
-rw-r--r--test/core/tsi/alts/fake_handshaker/fake_handshaker_server.cc268
-rw-r--r--test/core/tsi/alts/fake_handshaker/handshaker.proto224
-rw-r--r--test/core/tsi/alts/fake_handshaker/transport_security_common.proto40
-rw-r--r--test/core/tsi/alts/frame_protector/BUILD13
-rw-r--r--test/core/tsi/alts/handshaker/BUILD10
-rw-r--r--test/core/tsi/alts/handshaker/alts_handshaker_client_test.cc9
-rw-r--r--test/core/tsi/alts/handshaker/alts_tsi_handshaker_test.cc88
-rw-r--r--test/core/tsi/alts/zero_copy_frame_protector/BUILD10
-rw-r--r--test/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_test.cc1
-rw-r--r--test/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector_test.cc1
-rw-r--r--test/core/tsi/ssl_session_cache_test.cc153
-rw-r--r--test/core/tsi/ssl_transport_security_test.cc222
-rw-r--r--test/core/util/BUILD2
-rw-r--r--test/core/util/fuzzer_corpus_test.cc2
-rw-r--r--test/core/util/fuzzer_util.cc82
-rw-r--r--test/core/util/fuzzer_util.h49
-rw-r--r--test/core/util/grpc_fuzzer.bzl4
-rw-r--r--test/core/util/port_isolated_runtime_environment.cc17
-rw-r--r--test/core/util/test_config.cc1
-rw-r--r--test/core/util/test_tcp_server.cc9
393 files changed, 3739 insertions, 1313 deletions
diff --git a/test/core/channel/BUILD b/test/core/channel/BUILD
index c5dfd8ef37..6bf4fcdbb8 100644
--- a/test/core/channel/BUILD
+++ b/test/core/channel/BUILD
@@ -65,3 +65,32 @@ grpc_cc_test(
"//test/core/util:grpc_test_util",
],
)
+
+grpc_cc_test(
+ name = "channel_trace_test",
+ srcs = ["channel_trace_test.cc"],
+ language = "C++",
+ deps = [
+ "//:gpr",
+ "//:grpc",
+ "//:grpc++",
+ "//test/core/util:gpr_test_util",
+ "//test/core/util:grpc_test_util",
+ "//test/cpp/util:channel_trace_proto_helper",
+ ],
+ external_deps = [
+ "gtest",
+ ],
+)
+
+grpc_cc_test(
+ name = "status_util_test",
+ srcs = ["status_util_test.cc"],
+ language = "C++",
+ deps = [
+ "//:grpc",
+ ],
+ external_deps = [
+ "gtest",
+ ],
+)
diff --git a/test/core/channel/channel_trace_test.cc b/test/core/channel/channel_trace_test.cc
new file mode 100644
index 0000000000..3c73e33612
--- /dev/null
+++ b/test/core/channel/channel_trace_test.cc
@@ -0,0 +1,240 @@
+/*
+ *
+ * Copyright 2017 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <gtest/gtest.h>
+
+#include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
+
+#include "src/core/lib/channel/channel_trace.h"
+#include "src/core/lib/channel/channel_trace_registry.h"
+#include "src/core/lib/gpr/useful.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
+#include "src/core/lib/json/json.h"
+
+#include "test/core/util/test_config.h"
+#include "test/cpp/util/channel_trace_proto_helper.h"
+
+// remove me
+#include <grpc/support/string_util.h>
+#include <stdlib.h>
+#include <string.h>
+
+namespace grpc_core {
+namespace testing {
+namespace {
+
+grpc_json* GetJsonChild(grpc_json* parent, const char* key) {
+ EXPECT_NE(parent, nullptr);
+ for (grpc_json* child = parent->child; child != nullptr;
+ child = child->next) {
+ if (child->key != nullptr && strcmp(child->key, key) == 0) return child;
+ }
+ return nullptr;
+}
+
+void ValidateJsonArraySize(grpc_json* json, const char* key,
+ size_t expected_size) {
+ grpc_json* arr = GetJsonChild(json, key);
+ ASSERT_NE(arr, nullptr);
+ ASSERT_EQ(arr->type, GRPC_JSON_ARRAY);
+ size_t count = 0;
+ for (grpc_json* child = arr->child; child != nullptr; child = child->next) {
+ ++count;
+ }
+ ASSERT_EQ(count, expected_size);
+}
+
+void ValidateChannelTraceData(grpc_json* json,
+ size_t num_events_logged_expected,
+ size_t actual_num_events_expected) {
+ ASSERT_NE(json, nullptr);
+ grpc_json* num_events_logged_json = GetJsonChild(json, "numEventsLogged");
+ ASSERT_NE(num_events_logged_json, nullptr);
+ grpc_json* start_time = GetJsonChild(json, "creationTime");
+ ASSERT_NE(start_time, nullptr);
+ size_t num_events_logged =
+ (size_t)strtol(num_events_logged_json->value, nullptr, 0);
+ ASSERT_EQ(num_events_logged, num_events_logged_expected);
+ ValidateJsonArraySize(json, "events", actual_num_events_expected);
+}
+
+void AddSimpleTrace(RefCountedPtr<ChannelTrace> tracer) {
+ tracer->AddTraceEvent(ChannelTrace::Severity::Info,
+ grpc_slice_from_static_string("simple trace"));
+}
+
+// checks for the existence of all the required members of the tracer.
+void ValidateChannelTrace(RefCountedPtr<ChannelTrace> tracer,
+ size_t expected_num_event_logged, size_t max_nodes) {
+ if (!max_nodes) return;
+ char* json_str = tracer->RenderTrace();
+ grpc::testing::ValidateChannelTraceProtoJsonTranslation(json_str);
+ grpc_json* json = grpc_json_parse_string(json_str);
+ ValidateChannelTraceData(json, expected_num_event_logged,
+ GPR_MIN(expected_num_event_logged, max_nodes));
+ grpc_json_destroy(json);
+ gpr_free(json_str);
+}
+
+void ValidateTraceDataMatchedUuidLookup(RefCountedPtr<ChannelTrace> tracer) {
+ intptr_t uuid = tracer->GetUuid();
+ if (uuid == -1) return; // Doesn't make sense to lookup if tracing disabled
+ char* tracer_json_str = tracer->RenderTrace();
+ ChannelTrace* uuid_lookup =
+ grpc_channel_trace_registry_get_channel_trace(uuid);
+ char* uuid_lookup_json_str = uuid_lookup->RenderTrace();
+ EXPECT_EQ(strcmp(tracer_json_str, uuid_lookup_json_str), 0);
+ gpr_free(tracer_json_str);
+ gpr_free(uuid_lookup_json_str);
+}
+
+} // anonymous namespace
+
+class ChannelTracerTest : public ::testing::TestWithParam<size_t> {};
+
+// Tests basic ChannelTrace functionality like construction, adding trace, and
+// lookups by uuid.
+TEST_P(ChannelTracerTest, BasicTest) {
+ grpc_core::ExecCtx exec_ctx;
+ RefCountedPtr<ChannelTrace> tracer = MakeRefCounted<ChannelTrace>(GetParam());
+ AddSimpleTrace(tracer);
+ AddSimpleTrace(tracer);
+ ValidateTraceDataMatchedUuidLookup(tracer);
+ tracer->AddTraceEvent(ChannelTrace::Severity::Info,
+ grpc_slice_from_static_string("trace three"));
+ tracer->AddTraceEvent(ChannelTrace::Severity::Error,
+ grpc_slice_from_static_string("trace four error"));
+ ValidateChannelTrace(tracer, 4, GetParam());
+ AddSimpleTrace(tracer);
+ AddSimpleTrace(tracer);
+ ValidateChannelTrace(tracer, 6, GetParam());
+ AddSimpleTrace(tracer);
+ AddSimpleTrace(tracer);
+ AddSimpleTrace(tracer);
+ AddSimpleTrace(tracer);
+ ValidateChannelTrace(tracer, 10, GetParam());
+ ValidateTraceDataMatchedUuidLookup(tracer);
+ tracer.reset(nullptr);
+}
+
+// Tests more complex functionality, like a parent channel tracking
+// subchannles. This exercises the ref/unref patterns since the parent tracer
+// and this function will both hold refs to the subchannel.
+TEST_P(ChannelTracerTest, ComplexTest) {
+ grpc_core::ExecCtx exec_ctx;
+ RefCountedPtr<ChannelTrace> tracer = MakeRefCounted<ChannelTrace>(GetParam());
+ AddSimpleTrace(tracer);
+ AddSimpleTrace(tracer);
+ RefCountedPtr<ChannelTrace> sc1 = MakeRefCounted<ChannelTrace>(GetParam());
+ tracer->AddTraceEventReferencingSubchannel(
+ ChannelTrace::Severity::Info,
+ grpc_slice_from_static_string("subchannel one created"), sc1);
+ ValidateChannelTrace(tracer, 3, GetParam());
+ AddSimpleTrace(sc1);
+ AddSimpleTrace(sc1);
+ AddSimpleTrace(sc1);
+ ValidateChannelTrace(sc1, 3, GetParam());
+ AddSimpleTrace(sc1);
+ AddSimpleTrace(sc1);
+ AddSimpleTrace(sc1);
+ ValidateChannelTrace(sc1, 6, GetParam());
+ AddSimpleTrace(tracer);
+ AddSimpleTrace(tracer);
+ ValidateChannelTrace(tracer, 5, GetParam());
+ ValidateTraceDataMatchedUuidLookup(tracer);
+ RefCountedPtr<ChannelTrace> sc2 = MakeRefCounted<ChannelTrace>(GetParam());
+ tracer->AddTraceEventReferencingChannel(
+ ChannelTrace::Severity::Info,
+ grpc_slice_from_static_string("LB channel two created"), sc2);
+ tracer->AddTraceEventReferencingSubchannel(
+ ChannelTrace::Severity::Warning,
+ grpc_slice_from_static_string("subchannel one inactive"), sc1);
+ ValidateChannelTrace(tracer, 7, GetParam());
+ AddSimpleTrace(tracer);
+ AddSimpleTrace(tracer);
+ AddSimpleTrace(tracer);
+ AddSimpleTrace(tracer);
+ AddSimpleTrace(tracer);
+ AddSimpleTrace(tracer);
+ ValidateTraceDataMatchedUuidLookup(tracer);
+ tracer.reset(nullptr);
+ sc1.reset(nullptr);
+ sc2.reset(nullptr);
+}
+
+// Test a case in which the parent channel has subchannels and the subchannels
+// have connections. Ensures that everything lives as long as it should then
+// gets deleted.
+TEST_P(ChannelTracerTest, TestNesting) {
+ grpc_core::ExecCtx exec_ctx;
+ RefCountedPtr<ChannelTrace> tracer = MakeRefCounted<ChannelTrace>(GetParam());
+ AddSimpleTrace(tracer);
+ AddSimpleTrace(tracer);
+ ValidateChannelTrace(tracer, 2, GetParam());
+ RefCountedPtr<ChannelTrace> sc1 = MakeRefCounted<ChannelTrace>(GetParam());
+ tracer->AddTraceEventReferencingChannel(
+ ChannelTrace::Severity::Info,
+ grpc_slice_from_static_string("subchannel one created"), sc1);
+ ValidateChannelTrace(tracer, 3, GetParam());
+ AddSimpleTrace(sc1);
+ RefCountedPtr<ChannelTrace> conn1 = MakeRefCounted<ChannelTrace>(GetParam());
+ // nesting one level deeper.
+ sc1->AddTraceEventReferencingSubchannel(
+ ChannelTrace::Severity::Info,
+ grpc_slice_from_static_string("connection one created"), conn1);
+ ValidateChannelTrace(tracer, 3, GetParam());
+ AddSimpleTrace(conn1);
+ AddSimpleTrace(tracer);
+ AddSimpleTrace(tracer);
+ ValidateChannelTrace(tracer, 5, GetParam());
+ ValidateChannelTrace(conn1, 1, GetParam());
+ RefCountedPtr<ChannelTrace> sc2 = MakeRefCounted<ChannelTrace>(GetParam());
+ tracer->AddTraceEventReferencingSubchannel(
+ ChannelTrace::Severity::Info,
+ grpc_slice_from_static_string("subchannel two created"), sc2);
+ // this trace should not get added to the parents children since it is already
+ // present in the tracer.
+ tracer->AddTraceEventReferencingChannel(
+ ChannelTrace::Severity::Warning,
+ grpc_slice_from_static_string("subchannel one inactive"), sc1);
+ AddSimpleTrace(tracer);
+ ValidateChannelTrace(tracer, 8, GetParam());
+ tracer.reset(nullptr);
+ sc1.reset(nullptr);
+ sc2.reset(nullptr);
+ conn1.reset(nullptr);
+}
+
+INSTANTIATE_TEST_CASE_P(ChannelTracerTestSweep, ChannelTracerTest,
+ ::testing::Values(0, 1, 2, 6, 10, 15));
+
+} // namespace testing
+} // namespace grpc_core
+
+int main(int argc, char** argv) {
+ grpc_test_init(argc, argv);
+ grpc_init();
+ ::testing::InitGoogleTest(&argc, argv);
+ int ret = RUN_ALL_TESTS();
+ grpc_shutdown();
+ return ret;
+}
diff --git a/test/core/channel/minimal_stack_is_minimal_test.cc b/test/core/channel/minimal_stack_is_minimal_test.cc
index f02c8180f2..e5953acedc 100644
--- a/test/core/channel/minimal_stack_is_minimal_test.cc
+++ b/test/core/channel/minimal_stack_is_minimal_test.cc
@@ -66,35 +66,37 @@ int main(int argc, char** argv) {
minimal_stack_arg.key = const_cast<char*>(GRPC_ARG_MINIMAL_STACK);
minimal_stack_arg.value.integer = 1;
grpc_channel_args minimal_stack_args = {1, &minimal_stack_arg};
- errors += CHECK_STACK("unknown", &minimal_stack_args,
- GRPC_CLIENT_DIRECT_CHANNEL, "connected", NULL);
+ errors +=
+ CHECK_STACK("unknown", &minimal_stack_args, GRPC_CLIENT_DIRECT_CHANNEL,
+ "authority", "connected", NULL);
errors += CHECK_STACK("unknown", &minimal_stack_args, GRPC_CLIENT_SUBCHANNEL,
- "connected", NULL);
+ "authority", "connected", NULL);
errors += CHECK_STACK("unknown", &minimal_stack_args, GRPC_SERVER_CHANNEL,
"server", "connected", NULL);
errors +=
CHECK_STACK("chttp2", &minimal_stack_args, GRPC_CLIENT_DIRECT_CHANNEL,
- "http-client", "connected", NULL);
+ "authority", "http-client", "connected", NULL);
errors += CHECK_STACK("chttp2", &minimal_stack_args, GRPC_CLIENT_SUBCHANNEL,
- "http-client", "connected", NULL);
+ "authority", "http-client", "connected", NULL);
errors += CHECK_STACK("chttp2", &minimal_stack_args, GRPC_SERVER_CHANNEL,
"server", "http-server", "connected", NULL);
errors += CHECK_STACK(nullptr, &minimal_stack_args, GRPC_CLIENT_CHANNEL,
"client-channel", NULL);
// tests with a default stack
- errors += CHECK_STACK("unknown", nullptr, GRPC_CLIENT_DIRECT_CHANNEL,
- "message_size", "deadline", "connected", NULL);
- errors += CHECK_STACK("unknown", nullptr, GRPC_CLIENT_SUBCHANNEL,
+ errors +=
+ CHECK_STACK("unknown", nullptr, GRPC_CLIENT_DIRECT_CHANNEL, "authority",
+ "message_size", "deadline", "connected", NULL);
+ errors += CHECK_STACK("unknown", nullptr, GRPC_CLIENT_SUBCHANNEL, "authority",
"message_size", "connected", NULL);
errors += CHECK_STACK("unknown", nullptr, GRPC_SERVER_CHANNEL, "server",
"message_size", "deadline", "connected", NULL);
errors += CHECK_STACK("chttp2", nullptr, GRPC_CLIENT_DIRECT_CHANNEL,
- "message_size", "deadline", "http-client",
+ "authority", "message_size", "deadline", "http-client",
"message_compress", "connected", NULL);
- errors +=
- CHECK_STACK("chttp2", nullptr, GRPC_CLIENT_SUBCHANNEL, "message_size",
- "http-client", "message_compress", "connected", NULL);
+ errors += CHECK_STACK("chttp2", nullptr, GRPC_CLIENT_SUBCHANNEL, "authority",
+ "message_size", "http-client", "message_compress",
+ "connected", NULL);
errors += CHECK_STACK("chttp2", nullptr, GRPC_SERVER_CHANNEL, "server",
"message_size", "deadline", "http-server",
"message_compress", "connected", NULL);
diff --git a/test/core/client_channel/status_util_test.cc b/test/core/channel/status_util_test.cc
index f944990ad2..1d64bf1995 100644
--- a/test/core/client_channel/status_util_test.cc
+++ b/test/core/channel/status_util_test.cc
@@ -16,7 +16,7 @@
*
*/
-#include "src/core/ext/filters/client_channel/status_util.h"
+#include "src/core/lib/channel/status_util.h"
#include <gtest/gtest.h>
diff --git a/test/core/client_channel/BUILD b/test/core/client_channel/BUILD
index d430b722df..db98ffab77 100644
--- a/test/core/client_channel/BUILD
+++ b/test/core/client_channel/BUILD
@@ -55,13 +55,16 @@ grpc_cc_test(
)
grpc_cc_test(
- name = "status_util_test",
- srcs = ["status_util_test.cc"],
+ name = "retry_throttle_test",
+ srcs = ["retry_throttle_test.cc"],
+ external_deps = [
+ "gtest",
+ ],
language = "C++",
deps = [
+ "//:gpr",
"//:grpc",
- ],
- external_deps = [
- "gtest",
+ "//test/core/util:gpr_test_util",
+ "//test/core/util:grpc_test_util",
],
)
diff --git a/test/core/client_channel/parse_address_test.cc b/test/core/client_channel/parse_address_test.cc
index 373ed76cbe..ae157fbb8b 100644
--- a/test/core/client_channel/parse_address_test.cc
+++ b/test/core/client_channel/parse_address_test.cc
@@ -18,6 +18,7 @@
#include "src/core/ext/filters/client_channel/parse_address.h"
#include "src/core/lib/iomgr/sockaddr.h"
+#include "src/core/lib/iomgr/socket_utils.h"
#include <string.h>
#ifdef GRPC_HAVE_UNIX_SOCKET
@@ -58,16 +59,15 @@ static void test_grpc_parse_ipv4(const char* uri_text, const char* host,
grpc_core::ExecCtx exec_ctx;
grpc_uri* uri = grpc_uri_parse(uri_text, 0);
grpc_resolved_address addr;
- char ntop_buf[INET_ADDRSTRLEN];
+ char ntop_buf[GRPC_INET_ADDRSTRLEN];
GPR_ASSERT(1 == grpc_parse_ipv4(uri, &addr));
- struct sockaddr_in* addr_in =
- reinterpret_cast<struct sockaddr_in*>(addr.addr);
- GPR_ASSERT(AF_INET == addr_in->sin_family);
- GPR_ASSERT(nullptr != grpc_inet_ntop(AF_INET, &addr_in->sin_addr, ntop_buf,
- sizeof(ntop_buf)));
+ grpc_sockaddr_in* addr_in = reinterpret_cast<grpc_sockaddr_in*>(addr.addr);
+ GPR_ASSERT(GRPC_AF_INET == addr_in->sin_family);
+ GPR_ASSERT(nullptr != grpc_inet_ntop(GRPC_AF_INET, &addr_in->sin_addr,
+ ntop_buf, sizeof(ntop_buf)));
GPR_ASSERT(0 == strcmp(ntop_buf, host));
- GPR_ASSERT(ntohs(addr_in->sin_port) == port);
+ GPR_ASSERT(grpc_ntohs(addr_in->sin_port) == port);
grpc_uri_destroy(uri);
}
@@ -77,16 +77,15 @@ static void test_grpc_parse_ipv6(const char* uri_text, const char* host,
grpc_core::ExecCtx exec_ctx;
grpc_uri* uri = grpc_uri_parse(uri_text, 0);
grpc_resolved_address addr;
- char ntop_buf[INET6_ADDRSTRLEN];
+ char ntop_buf[GRPC_INET6_ADDRSTRLEN];
GPR_ASSERT(1 == grpc_parse_ipv6(uri, &addr));
- struct sockaddr_in6* addr_in6 =
- reinterpret_cast<struct sockaddr_in6*>(addr.addr);
- GPR_ASSERT(AF_INET6 == addr_in6->sin6_family);
- GPR_ASSERT(nullptr != grpc_inet_ntop(AF_INET6, &addr_in6->sin6_addr, ntop_buf,
- sizeof(ntop_buf)));
+ grpc_sockaddr_in6* addr_in6 = reinterpret_cast<grpc_sockaddr_in6*>(addr.addr);
+ GPR_ASSERT(GRPC_AF_INET6 == addr_in6->sin6_family);
+ GPR_ASSERT(nullptr != grpc_inet_ntop(GRPC_AF_INET6, &addr_in6->sin6_addr,
+ ntop_buf, sizeof(ntop_buf)));
GPR_ASSERT(0 == strcmp(ntop_buf, host));
- GPR_ASSERT(ntohs(addr_in6->sin6_port) == port);
+ GPR_ASSERT(grpc_ntohs(addr_in6->sin6_port) == port);
GPR_ASSERT(addr_in6->sin6_scope_id == scope_id);
grpc_uri_destroy(uri);
diff --git a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc
index 966fb1d14b..e34aa2e676 100644
--- a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc
+++ b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc
@@ -57,6 +57,9 @@ static void my_resolve_address(const char* addr, const char* default_port,
GRPC_CLOSURE_SCHED(on_done, error);
}
+static grpc_address_resolver_vtable test_resolver = {my_resolve_address,
+ nullptr};
+
static grpc_ares_request* my_dns_lookup_ares(
const char* dns_server, const char* addr, const char* default_port,
grpc_pollset_set* interested_parties, grpc_closure* on_done,
@@ -143,7 +146,7 @@ int main(int argc, char** argv) {
grpc_init();
gpr_mu_init(&g_mu);
g_combiner = grpc_combiner_create();
- grpc_resolve_address = my_resolve_address;
+ grpc_set_resolver_impl(&test_resolver);
grpc_dns_lookup_ares = my_dns_lookup_ares;
grpc_channel_args* result = (grpc_channel_args*)1;
diff --git a/test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc b/test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc
index 9402a605b3..37e1d714ca 100644
--- a/test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc
+++ b/test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc
@@ -28,12 +28,10 @@
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "test/core/util/test_config.h"
-static grpc_combiner* g_combiner;
+extern grpc_address_resolver_vtable* grpc_resolve_address_impl;
+static grpc_address_resolver_vtable* default_resolve_address;
-static void (*g_default_grpc_resolve_address)(
- const char* name, const char* default_port,
- grpc_pollset_set* interested_parties, grpc_closure* on_done,
- grpc_resolved_addresses** addrs);
+static grpc_combiner* g_combiner;
grpc_ares_request* (*g_default_dns_lookup_ares)(
const char* dns_server, const char* name, const char* default_port,
@@ -52,18 +50,28 @@ struct iomgr_args {
grpc_pollset_set* pollset_set;
} g_iomgr_args;
-// Wrapper around g_default_grpc_resolve_address in order to count the number of
+// Wrapper around default resolve_address in order to count the number of
// times we incur in a system-level name resolution.
static void test_resolve_address_impl(const char* name,
const char* default_port,
grpc_pollset_set* interested_parties,
grpc_closure* on_done,
grpc_resolved_addresses** addrs) {
- g_default_grpc_resolve_address(name, default_port, g_iomgr_args.pollset_set,
- on_done, addrs);
+ default_resolve_address->resolve_address(
+ name, default_port, g_iomgr_args.pollset_set, on_done, addrs);
++g_resolution_count;
}
+static grpc_error* test_blocking_resolve_address_impl(
+ const char* name, const char* default_port,
+ grpc_resolved_addresses** addresses) {
+ return default_resolve_address->blocking_resolve_address(name, default_port,
+ addresses);
+}
+
+static grpc_address_resolver_vtable test_resolver = {
+ test_resolve_address_impl, test_blocking_resolve_address_impl};
+
grpc_ares_request* test_dns_lookup_ares(
const char* dns_server, const char* name, const char* default_port,
grpc_pollset_set* interested_parties, grpc_closure* on_done,
@@ -137,7 +145,6 @@ struct OnResolutionCallbackArg {
grpc_core::OrphanablePtr<grpc_core::Resolver> resolver;
grpc_channel_args* result = nullptr;
grpc_millis delay_before_second_resolution = 0;
- bool using_cares = false;
};
// Counter for the number of times a resolution notification callback has been
@@ -147,81 +154,100 @@ static int g_on_resolution_invocations_count;
// Set to true by the last callback in the resolution chain.
bool g_all_callbacks_invoked;
-void on_third_resolution(void* arg, grpc_error* error) {
+void on_fourth_resolution(void* arg, grpc_error* error) {
OnResolutionCallbackArg* cb_arg = static_cast<OnResolutionCallbackArg*>(arg);
+ grpc_channel_args_destroy(cb_arg->result);
GPR_ASSERT(error == GRPC_ERROR_NONE);
++g_on_resolution_invocations_count;
- grpc_channel_args_destroy(cb_arg->result);
gpr_log(GPR_INFO,
- "3rd: g_on_resolution_invocations_count: %d, g_resolution_count: %d",
+ "4th: g_on_resolution_invocations_count: %d, g_resolution_count: %d",
g_on_resolution_invocations_count, g_resolution_count);
// In this case we expect to have incurred in another system-level resolution
- // because on_second_resolution slept for longer than the min resolution
+ // because on_third_resolution slept for longer than the min resolution
// period.
- GPR_ASSERT(g_on_resolution_invocations_count == 3);
- GPR_ASSERT(g_resolution_count == 2);
+ GPR_ASSERT(g_on_resolution_invocations_count == 4);
+ GPR_ASSERT(g_resolution_count == 3);
cb_arg->resolver.reset();
- if (cb_arg->using_cares) {
- gpr_atm_rel_store(&g_iomgr_args.done_atm, 1);
- gpr_mu_lock(g_iomgr_args.mu);
- GRPC_LOG_IF_ERROR("pollset_kick",
- grpc_pollset_kick(g_iomgr_args.pollset, nullptr));
- gpr_mu_unlock(g_iomgr_args.mu);
- }
+ gpr_atm_rel_store(&g_iomgr_args.done_atm, 1);
+ gpr_mu_lock(g_iomgr_args.mu);
+ GRPC_LOG_IF_ERROR("pollset_kick",
+ grpc_pollset_kick(g_iomgr_args.pollset, nullptr));
+ gpr_mu_unlock(g_iomgr_args.mu);
grpc_core::Delete(cb_arg);
g_all_callbacks_invoked = true;
}
-void on_second_resolution(void* arg, grpc_error* error) {
+void on_third_resolution(void* arg, grpc_error* error) {
OnResolutionCallbackArg* cb_arg = static_cast<OnResolutionCallbackArg*>(arg);
- ++g_on_resolution_invocations_count;
grpc_channel_args_destroy(cb_arg->result);
+ GPR_ASSERT(error == GRPC_ERROR_NONE);
+ ++g_on_resolution_invocations_count;
+ gpr_log(GPR_INFO,
+ "3rd: g_on_resolution_invocations_count: %d, g_resolution_count: %d",
+ g_on_resolution_invocations_count, g_resolution_count);
+ // The timer set because of the previous re-resolution request fires, so a new
+ // system-level resolution happened.
+ GPR_ASSERT(g_on_resolution_invocations_count == 3);
+ GPR_ASSERT(g_resolution_count == 2);
+ grpc_core::ExecCtx::Get()->TestOnlySetNow(
+ cb_arg->delay_before_second_resolution * 2);
+ cb_arg->resolver->NextLocked(
+ &cb_arg->result,
+ GRPC_CLOSURE_CREATE(on_fourth_resolution, arg,
+ grpc_combiner_scheduler(g_combiner)));
+ cb_arg->resolver->RequestReresolutionLocked();
+ gpr_mu_lock(g_iomgr_args.mu);
+ GRPC_LOG_IF_ERROR("pollset_kick",
+ grpc_pollset_kick(g_iomgr_args.pollset, nullptr));
+ gpr_mu_unlock(g_iomgr_args.mu);
+}
+void on_second_resolution(void* arg, grpc_error* error) {
+ OnResolutionCallbackArg* cb_arg = static_cast<OnResolutionCallbackArg*>(arg);
+ grpc_channel_args_destroy(cb_arg->result);
+ GPR_ASSERT(error == GRPC_ERROR_NONE);
+ ++g_on_resolution_invocations_count;
gpr_log(GPR_INFO,
"2nd: g_on_resolution_invocations_count: %d, g_resolution_count: %d",
g_on_resolution_invocations_count, g_resolution_count);
// The resolution request for which this function is the callback happened
// before the min resolution period. Therefore, no new system-level
- // resolutions happened, as indicated by g_resolution_count.
+ // resolutions happened, as indicated by g_resolution_count. But a resolution
+ // timer was set to fire when the cooldown finishes.
GPR_ASSERT(g_on_resolution_invocations_count == 2);
GPR_ASSERT(g_resolution_count == 1);
- grpc_core::ExecCtx::Get()->TestOnlySetNow(
- cb_arg->delay_before_second_resolution * 2);
+ // Register a new callback to capture the timer firing.
cb_arg->resolver->NextLocked(
&cb_arg->result,
GRPC_CLOSURE_CREATE(on_third_resolution, arg,
grpc_combiner_scheduler(g_combiner)));
- cb_arg->resolver->RequestReresolutionLocked();
- if (cb_arg->using_cares) {
- gpr_mu_lock(g_iomgr_args.mu);
- GRPC_LOG_IF_ERROR("pollset_kick",
- grpc_pollset_kick(g_iomgr_args.pollset, nullptr));
- gpr_mu_unlock(g_iomgr_args.mu);
- }
+ gpr_mu_lock(g_iomgr_args.mu);
+ GRPC_LOG_IF_ERROR("pollset_kick",
+ grpc_pollset_kick(g_iomgr_args.pollset, nullptr));
+ gpr_mu_unlock(g_iomgr_args.mu);
}
void on_first_resolution(void* arg, grpc_error* error) {
OnResolutionCallbackArg* cb_arg = static_cast<OnResolutionCallbackArg*>(arg);
- ++g_on_resolution_invocations_count;
grpc_channel_args_destroy(cb_arg->result);
- cb_arg->resolver->NextLocked(
- &cb_arg->result,
- GRPC_CLOSURE_CREATE(on_second_resolution, arg,
- grpc_combiner_scheduler(g_combiner)));
- cb_arg->resolver->RequestReresolutionLocked();
+ GPR_ASSERT(error == GRPC_ERROR_NONE);
+ ++g_on_resolution_invocations_count;
gpr_log(GPR_INFO,
"1st: g_on_resolution_invocations_count: %d, g_resolution_count: %d",
g_on_resolution_invocations_count, g_resolution_count);
- // Theres one initial system-level resolution and one invocation of a
+ // There's one initial system-level resolution and one invocation of a
// notification callback (the current function).
GPR_ASSERT(g_on_resolution_invocations_count == 1);
GPR_ASSERT(g_resolution_count == 1);
- if (cb_arg->using_cares) {
- gpr_mu_lock(g_iomgr_args.mu);
- GRPC_LOG_IF_ERROR("pollset_kick",
- grpc_pollset_kick(g_iomgr_args.pollset, nullptr));
- gpr_mu_unlock(g_iomgr_args.mu);
- }
+ cb_arg->resolver->NextLocked(
+ &cb_arg->result,
+ GRPC_CLOSURE_CREATE(on_second_resolution, arg,
+ grpc_combiner_scheduler(g_combiner)));
+ cb_arg->resolver->RequestReresolutionLocked();
+ gpr_mu_lock(g_iomgr_args.mu);
+ GRPC_LOG_IF_ERROR("pollset_kick",
+ grpc_pollset_kick(g_iomgr_args.pollset, nullptr));
+ gpr_mu_unlock(g_iomgr_args.mu);
}
static void start_test_under_combiner(void* arg, grpc_error* error) {
@@ -261,22 +287,19 @@ static void start_test_under_combiner(void* arg, grpc_error* error) {
grpc_uri_destroy(uri);
}
-static void test_cooldown(bool using_cares) {
+static void test_cooldown() {
grpc_core::ExecCtx exec_ctx;
- if (using_cares) iomgr_args_init(&g_iomgr_args);
+ iomgr_args_init(&g_iomgr_args);
OnResolutionCallbackArg* res_cb_arg =
grpc_core::New<OnResolutionCallbackArg>();
res_cb_arg->uri_str = "dns:127.0.0.1";
- res_cb_arg->using_cares = using_cares;
GRPC_CLOSURE_SCHED(GRPC_CLOSURE_CREATE(start_test_under_combiner, res_cb_arg,
grpc_combiner_scheduler(g_combiner)),
GRPC_ERROR_NONE);
- if (using_cares) {
- grpc_core::ExecCtx::Get()->Flush();
- poll_pollset_until_request_done(&g_iomgr_args);
- iomgr_args_finish(&g_iomgr_args);
- }
+ grpc_core::ExecCtx::Get()->Flush();
+ poll_pollset_until_request_done(&g_iomgr_args);
+ iomgr_args_finish(&g_iomgr_args);
}
int main(int argc, char** argv) {
@@ -285,13 +308,12 @@ int main(int argc, char** argv) {
g_combiner = grpc_combiner_create();
- const bool using_cares = (grpc_resolve_address == grpc_resolve_address_ares);
- g_default_grpc_resolve_address = grpc_resolve_address;
g_default_dns_lookup_ares = grpc_dns_lookup_ares;
grpc_dns_lookup_ares = test_dns_lookup_ares;
- grpc_resolve_address = test_resolve_address_impl;
+ default_resolve_address = grpc_resolve_address_impl;
+ grpc_set_resolver_impl(&test_resolver);
- test_cooldown(using_cares);
+ test_cooldown();
{
grpc_core::ExecCtx exec_ctx;
diff --git a/test/core/client_channel/resolvers/dns_resolver_test.cc b/test/core/client_channel/resolvers/dns_resolver_test.cc
index e3fba2838c..103b2916c4 100644
--- a/test/core/client_channel/resolvers/dns_resolver_test.cc
+++ b/test/core/client_channel/resolvers/dns_resolver_test.cc
@@ -70,11 +70,12 @@ int main(int argc, char** argv) {
test_succeeds(dns, "dns:10.2.1.1");
test_succeeds(dns, "dns:10.2.1.1:1234");
- test_succeeds(dns, "ipv4:www.google.com");
+ test_succeeds(dns, "dns:www.google.com");
+ test_succeeds(dns, "dns:///www.google.com");
if (grpc_resolve_address == grpc_resolve_address_ares) {
- test_succeeds(dns, "ipv4://8.8.8.8/8.8.8.8:8888");
+ test_succeeds(dns, "dns://8.8.8.8/8.8.8.8:8888");
} else {
- test_fails(dns, "ipv4://8.8.8.8/8.8.8.8:8888");
+ test_fails(dns, "dns://8.8.8.8/8.8.8.8:8888");
}
{
diff --git a/test/core/client_channel/retry_throttle_test.cc b/test/core/client_channel/retry_throttle_test.cc
new file mode 100644
index 0000000000..c6d5d3ebbb
--- /dev/null
+++ b/test/core/client_channel/retry_throttle_test.cc
@@ -0,0 +1,142 @@
+/*
+ *
+ * Copyright 2018 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "src/core/ext/filters/client_channel/retry_throttle.h"
+
+#include <gtest/gtest.h>
+
+#include "test/core/util/test_config.h"
+
+namespace grpc_core {
+namespace internal {
+namespace {
+
+TEST(ServerRetryThrottleData, Basic) {
+ // Max token count is 4, so threshold for retrying is 2.
+ // Token count starts at 4.
+ // Each failure decrements by 1. Each success increments by 1.6.
+ auto throttle_data =
+ MakeRefCounted<ServerRetryThrottleData>(4000, 1600, nullptr);
+ // Failure: token_count=3. Above threshold.
+ EXPECT_TRUE(throttle_data->RecordFailure());
+ // Success: token_count=4. Not incremented beyond max.
+ throttle_data->RecordSuccess();
+ // Failure: token_count=3. Above threshold.
+ EXPECT_TRUE(throttle_data->RecordFailure());
+ // Failure: token_count=2. At threshold, so no retries.
+ EXPECT_FALSE(throttle_data->RecordFailure());
+ // Failure: token_count=1. Below threshold, so no retries.
+ EXPECT_FALSE(throttle_data->RecordFailure());
+ // Failure: token_count=0. Below threshold, so no retries.
+ EXPECT_FALSE(throttle_data->RecordFailure());
+ // Failure: token_count=0. Below threshold, so no retries. Not
+ // decremented below min.
+ EXPECT_FALSE(throttle_data->RecordFailure());
+ // Success: token_count=1.6.
+ throttle_data->RecordSuccess();
+ // Success: token_count=3.2.
+ throttle_data->RecordSuccess();
+ // Failure: token_count=2.2. Above threshold.
+ EXPECT_TRUE(throttle_data->RecordFailure());
+ // Failure: token_count=1.2. Below threshold, so no retries.
+ EXPECT_FALSE(throttle_data->RecordFailure());
+ // Success: token_count=2.8.
+ throttle_data->RecordSuccess();
+ // Failure: token_count=1.8. Below threshold, so no retries.
+ EXPECT_FALSE(throttle_data->RecordFailure());
+ // Success: token_count=3.4.
+ throttle_data->RecordSuccess();
+ // Failure: token_count=2.4. Above threshold.
+ EXPECT_TRUE(throttle_data->RecordFailure());
+}
+
+TEST(ServerRetryThrottleData, Replacement) {
+ // Create old throttle data.
+ // Max token count is 4, so threshold for retrying is 2.
+ // Token count starts at 4.
+ // Each failure decrements by 1. Each success increments by 1.
+ auto old_throttle_data =
+ MakeRefCounted<ServerRetryThrottleData>(4000, 1000, nullptr);
+ // Failure: token_count=3. Above threshold.
+ EXPECT_TRUE(old_throttle_data->RecordFailure());
+ // Create new throttle data.
+ // Max token count is 10, so threshold for retrying is 5.
+ // Token count starts at 7.5 (ratio inherited from old_throttle_data).
+ // Each failure decrements by 1. Each success increments by 3.
+ auto throttle_data = MakeRefCounted<ServerRetryThrottleData>(
+ 10000, 3000, old_throttle_data.get());
+ // Failure via old_throttle_data: token_count=6.5.
+ EXPECT_TRUE(old_throttle_data->RecordFailure());
+ // Failure: token_count=5.5.
+ EXPECT_TRUE(old_throttle_data->RecordFailure());
+ // Failure via old_throttle_data: token_count=4.5. Below threshold.
+ EXPECT_FALSE(old_throttle_data->RecordFailure());
+ // Failure: token_count=3.5. Below threshold.
+ EXPECT_FALSE(throttle_data->RecordFailure());
+ // Success: token_count=6.5.
+ throttle_data->RecordSuccess();
+ // Failure via old_throttle_data: token_count=5.5. Above threshold.
+ EXPECT_TRUE(old_throttle_data->RecordFailure());
+ // Failure: token_count=4.5. Below threshold.
+ EXPECT_FALSE(throttle_data->RecordFailure());
+}
+
+TEST(ServerRetryThrottleMap, Replacement) {
+ ServerRetryThrottleMap::Init();
+ const char kServerName[] = "server_name";
+ // Create old throttle data.
+ // Max token count is 4, so threshold for retrying is 2.
+ // Token count starts at 4.
+ // Each failure decrements by 1. Each success increments by 1.
+ auto old_throttle_data =
+ ServerRetryThrottleMap::GetDataForServer(kServerName, 4000, 1000);
+ // Failure: token_count=3. Above threshold.
+ EXPECT_TRUE(old_throttle_data->RecordFailure());
+ // Create new throttle data.
+ // Max token count is 10, so threshold for retrying is 5.
+ // Token count starts at 7.5 (ratio inherited from old_throttle_data).
+ // Each failure decrements by 1. Each success increments by 3.
+ auto throttle_data =
+ ServerRetryThrottleMap::GetDataForServer(kServerName, 10000, 3000);
+ // Failure via old_throttle_data: token_count=6.5.
+ EXPECT_TRUE(old_throttle_data->RecordFailure());
+ // Failure: token_count=5.5.
+ EXPECT_TRUE(old_throttle_data->RecordFailure());
+ // Failure via old_throttle_data: token_count=4.5. Below threshold.
+ EXPECT_FALSE(old_throttle_data->RecordFailure());
+ // Failure: token_count=3.5. Below threshold.
+ EXPECT_FALSE(throttle_data->RecordFailure());
+ // Success: token_count=6.5.
+ throttle_data->RecordSuccess();
+ // Failure via old_throttle_data: token_count=5.5. Above threshold.
+ EXPECT_TRUE(old_throttle_data->RecordFailure());
+ // Failure: token_count=4.5. Below threshold.
+ EXPECT_FALSE(throttle_data->RecordFailure());
+ // Clean up.
+ ServerRetryThrottleMap::Shutdown();
+}
+
+} // namespace
+} // namespace internal
+} // namespace grpc_core
+
+int main(int argc, char** argv) {
+ grpc_test_init(argc, argv);
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
diff --git a/test/core/compression/algorithm_test.cc b/test/core/compression/algorithm_test.cc
index 3dcddf3e67..8989a41989 100644
--- a/test/core/compression/algorithm_test.cc
+++ b/test/core/compression/algorithm_test.cc
@@ -24,6 +24,7 @@
#include <grpc/grpc.h>
#include <grpc/support/log.h>
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/transport/static_metadata.h"
#include "test/core/util/test_config.h"
diff --git a/test/core/debug/stats_test.cc b/test/core/debug/stats_test.cc
index e60e54b2fd..949a88f8f0 100644
--- a/test/core/debug/stats_test.cc
+++ b/test/core/debug/stats_test.cc
@@ -47,22 +47,22 @@ class Snapshot {
TEST(StatsTest, IncCounters) {
for (int i = 0; i < GRPC_STATS_COUNTER_COUNT; i++) {
- Snapshot snapshot;
+ std::unique_ptr<Snapshot> snapshot(new Snapshot);
grpc_core::ExecCtx exec_ctx;
GRPC_STATS_INC_COUNTER((grpc_stats_counters)i);
- EXPECT_EQ(snapshot.delta().counters[i], 1);
+ EXPECT_EQ(snapshot->delta().counters[i], 1);
}
}
TEST(StatsTest, IncSpecificCounter) {
- Snapshot snapshot;
+ std::unique_ptr<Snapshot> snapshot(new Snapshot);
grpc_core::ExecCtx exec_ctx;
GRPC_STATS_INC_SYSCALL_POLL();
- EXPECT_EQ(snapshot.delta().counters[GRPC_STATS_COUNTER_SYSCALL_POLL], 1);
+ EXPECT_EQ(snapshot->delta().counters[GRPC_STATS_COUNTER_SYSCALL_POLL], 1);
}
static int FindExpectedBucket(int i, int j) {
@@ -90,12 +90,12 @@ TEST_P(HistogramTest, IncHistogram) {
gpr_log(GPR_DEBUG, "expected_bucket:%d nvalues=%" PRIdPTR, expected_bucket,
test_values.size());
for (auto j : test_values) {
- Snapshot snapshot;
+ std::unique_ptr<Snapshot> snapshot(new Snapshot);
grpc_core::ExecCtx exec_ctx;
grpc_stats_inc_histogram[kHistogram](j);
- auto delta = snapshot.delta();
+ auto delta = snapshot->delta();
EXPECT_EQ(
delta
diff --git a/test/core/end2end/BUILD b/test/core/end2end/BUILD
index 952f3505fb..dd16694204 100644
--- a/test/core/end2end/BUILD
+++ b/test/core/end2end/BUILD
@@ -163,3 +163,20 @@ grpc_cc_test(
)
grpc_end2end_tests()
+
+grpc_cc_test(
+ name = "h2_ssl_session_reuse_test",
+ srcs = ["h2_ssl_session_reuse_test.cc"],
+ external_deps = [
+ "gtest",
+ ],
+ language = "C++",
+ deps = [
+ ':end2end_tests',
+ '//:gpr',
+ '//:grpc',
+ '//:tsi',
+ '//test/core/util:gpr_test_util',
+ '//test/core/util:grpc_test_util',
+ ],
+)
diff --git a/test/core/end2end/connection_refused_test.cc b/test/core/end2end/connection_refused_test.cc
index ff830b47cd..33812ec8e5 100644
--- a/test/core/end2end/connection_refused_test.cc
+++ b/test/core/end2end/connection_refused_test.cc
@@ -25,6 +25,7 @@
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/host_port.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/transport/metadata.h"
#include "src/core/lib/transport/service_config.h"
diff --git a/test/core/end2end/cq_verifier.cc b/test/core/end2end/cq_verifier.cc
index c3a3f43fe1..f7e64effcd 100644
--- a/test/core/end2end/cq_verifier.cc
+++ b/test/core/end2end/cq_verifier.cc
@@ -18,6 +18,7 @@
#include "test/core/end2end/cq_verifier.h"
+#include <inttypes.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
diff --git a/test/core/end2end/end2end_nosec_tests.cc b/test/core/end2end/end2end_nosec_tests.cc
index 78ddcdb8f6..59eb643a93 100644
--- a/test/core/end2end/end2end_nosec_tests.cc
+++ b/test/core/end2end/end2end_nosec_tests.cc
@@ -38,6 +38,8 @@ extern void bad_ping(grpc_end2end_test_config config);
extern void bad_ping_pre_init(void);
extern void binary_metadata(grpc_end2end_test_config config);
extern void binary_metadata_pre_init(void);
+extern void call_host_override(grpc_end2end_test_config config);
+extern void call_host_override_pre_init(void);
extern void cancel_after_accept(grpc_end2end_test_config config);
extern void cancel_after_accept_pre_init(void);
extern void cancel_after_client_done(grpc_end2end_test_config config);
@@ -130,6 +132,8 @@ extern void retry_exceeds_buffer_size_in_subsequent_batch(grpc_end2end_test_conf
extern void retry_exceeds_buffer_size_in_subsequent_batch_pre_init(void);
extern void retry_non_retriable_status(grpc_end2end_test_config config);
extern void retry_non_retriable_status_pre_init(void);
+extern void retry_non_retriable_status_before_recv_trailing_metadata_started(grpc_end2end_test_config config);
+extern void retry_non_retriable_status_before_recv_trailing_metadata_started_pre_init(void);
extern void retry_recv_initial_metadata(grpc_end2end_test_config config);
extern void retry_recv_initial_metadata_pre_init(void);
extern void retry_recv_message(grpc_end2end_test_config config);
@@ -187,6 +191,7 @@ void grpc_end2end_tests_pre_init(void) {
bad_hostname_pre_init();
bad_ping_pre_init();
binary_metadata_pre_init();
+ call_host_override_pre_init();
cancel_after_accept_pre_init();
cancel_after_client_done_pre_init();
cancel_after_invoke_pre_init();
@@ -233,6 +238,7 @@ void grpc_end2end_tests_pre_init(void) {
retry_exceeds_buffer_size_in_initial_batch_pre_init();
retry_exceeds_buffer_size_in_subsequent_batch_pre_init();
retry_non_retriable_status_pre_init();
+ retry_non_retriable_status_before_recv_trailing_metadata_started_pre_init();
retry_recv_initial_metadata_pre_init();
retry_recv_message_pre_init();
retry_server_pushback_delay_pre_init();
@@ -270,6 +276,7 @@ void grpc_end2end_tests(int argc, char **argv,
bad_hostname(config);
bad_ping(config);
binary_metadata(config);
+ call_host_override(config);
cancel_after_accept(config);
cancel_after_client_done(config);
cancel_after_invoke(config);
@@ -316,6 +323,7 @@ void grpc_end2end_tests(int argc, char **argv,
retry_exceeds_buffer_size_in_initial_batch(config);
retry_exceeds_buffer_size_in_subsequent_batch(config);
retry_non_retriable_status(config);
+ retry_non_retriable_status_before_recv_trailing_metadata_started(config);
retry_recv_initial_metadata(config);
retry_recv_message(config);
retry_server_pushback_delay(config);
@@ -360,6 +368,10 @@ void grpc_end2end_tests(int argc, char **argv,
binary_metadata(config);
continue;
}
+ if (0 == strcmp("call_host_override", argv[i])) {
+ call_host_override(config);
+ continue;
+ }
if (0 == strcmp("cancel_after_accept", argv[i])) {
cancel_after_accept(config);
continue;
@@ -544,6 +556,10 @@ void grpc_end2end_tests(int argc, char **argv,
retry_non_retriable_status(config);
continue;
}
+ if (0 == strcmp("retry_non_retriable_status_before_recv_trailing_metadata_started", argv[i])) {
+ retry_non_retriable_status_before_recv_trailing_metadata_started(config);
+ continue;
+ }
if (0 == strcmp("retry_recv_initial_metadata", argv[i])) {
retry_recv_initial_metadata(config);
continue;
diff --git a/test/core/end2end/end2end_tests.cc b/test/core/end2end/end2end_tests.cc
index fb1e61b39f..9f164b4ead 100644
--- a/test/core/end2end/end2end_tests.cc
+++ b/test/core/end2end/end2end_tests.cc
@@ -40,6 +40,8 @@ extern void binary_metadata(grpc_end2end_test_config config);
extern void binary_metadata_pre_init(void);
extern void call_creds(grpc_end2end_test_config config);
extern void call_creds_pre_init(void);
+extern void call_host_override(grpc_end2end_test_config config);
+extern void call_host_override_pre_init(void);
extern void cancel_after_accept(grpc_end2end_test_config config);
extern void cancel_after_accept_pre_init(void);
extern void cancel_after_client_done(grpc_end2end_test_config config);
@@ -132,6 +134,8 @@ extern void retry_exceeds_buffer_size_in_subsequent_batch(grpc_end2end_test_conf
extern void retry_exceeds_buffer_size_in_subsequent_batch_pre_init(void);
extern void retry_non_retriable_status(grpc_end2end_test_config config);
extern void retry_non_retriable_status_pre_init(void);
+extern void retry_non_retriable_status_before_recv_trailing_metadata_started(grpc_end2end_test_config config);
+extern void retry_non_retriable_status_before_recv_trailing_metadata_started_pre_init(void);
extern void retry_recv_initial_metadata(grpc_end2end_test_config config);
extern void retry_recv_initial_metadata_pre_init(void);
extern void retry_recv_message(grpc_end2end_test_config config);
@@ -190,6 +194,7 @@ void grpc_end2end_tests_pre_init(void) {
bad_ping_pre_init();
binary_metadata_pre_init();
call_creds_pre_init();
+ call_host_override_pre_init();
cancel_after_accept_pre_init();
cancel_after_client_done_pre_init();
cancel_after_invoke_pre_init();
@@ -236,6 +241,7 @@ void grpc_end2end_tests_pre_init(void) {
retry_exceeds_buffer_size_in_initial_batch_pre_init();
retry_exceeds_buffer_size_in_subsequent_batch_pre_init();
retry_non_retriable_status_pre_init();
+ retry_non_retriable_status_before_recv_trailing_metadata_started_pre_init();
retry_recv_initial_metadata_pre_init();
retry_recv_message_pre_init();
retry_server_pushback_delay_pre_init();
@@ -274,6 +280,7 @@ void grpc_end2end_tests(int argc, char **argv,
bad_ping(config);
binary_metadata(config);
call_creds(config);
+ call_host_override(config);
cancel_after_accept(config);
cancel_after_client_done(config);
cancel_after_invoke(config);
@@ -320,6 +327,7 @@ void grpc_end2end_tests(int argc, char **argv,
retry_exceeds_buffer_size_in_initial_batch(config);
retry_exceeds_buffer_size_in_subsequent_batch(config);
retry_non_retriable_status(config);
+ retry_non_retriable_status_before_recv_trailing_metadata_started(config);
retry_recv_initial_metadata(config);
retry_recv_message(config);
retry_server_pushback_delay(config);
@@ -368,6 +376,10 @@ void grpc_end2end_tests(int argc, char **argv,
call_creds(config);
continue;
}
+ if (0 == strcmp("call_host_override", argv[i])) {
+ call_host_override(config);
+ continue;
+ }
if (0 == strcmp("cancel_after_accept", argv[i])) {
cancel_after_accept(config);
continue;
@@ -552,6 +564,10 @@ void grpc_end2end_tests(int argc, char **argv,
retry_non_retriable_status(config);
continue;
}
+ if (0 == strcmp("retry_non_retriable_status_before_recv_trailing_metadata_started", argv[i])) {
+ retry_non_retriable_status_before_recv_trailing_metadata_started(config);
+ continue;
+ }
if (0 == strcmp("retry_recv_initial_metadata", argv[i])) {
retry_recv_initial_metadata(config);
continue;
diff --git a/test/core/end2end/end2end_tests.h b/test/core/end2end/end2end_tests.h
index b42d90b55c..a1ebdedea8 100644
--- a/test/core/end2end/end2end_tests.h
+++ b/test/core/end2end/end2end_tests.h
@@ -52,6 +52,11 @@ struct grpc_end2end_test_config {
/* Which features are supported by this fixture. See feature flags above. */
uint32_t feature_mask;
+ /* If the call host is setup by the fixture (for example, via the
+ * GRPC_SSL_TARGET_NAME_OVERRIDE_ARG channel arg), which value should the test
+ * expect to find in call_details.host */
+ const char* overridden_call_host;
+
grpc_end2end_test_fixture (*create_fixture)(grpc_channel_args* client_args,
grpc_channel_args* server_args);
void (*init_client)(grpc_end2end_test_fixture* f,
diff --git a/test/core/end2end/fixtures/h2_census.cc b/test/core/end2end/fixtures/h2_census.cc
index b3b4171a72..29b1d6d883 100644
--- a/test/core/end2end/fixtures/h2_census.cc
+++ b/test/core/end2end/fixtures/h2_census.cc
@@ -111,7 +111,7 @@ static grpc_end2end_test_config configs[] = {
FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION |
FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL |
FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER,
- chttp2_create_fixture_fullstack, chttp2_init_client_fullstack,
+ nullptr, 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.cc b/test/core/end2end/fixtures/h2_compress.cc
index 565c96cf93..4aaadf715c 100644
--- a/test/core/end2end/fixtures/h2_compress.cc
+++ b/test/core/end2end/fixtures/h2_compress.cc
@@ -109,7 +109,7 @@ static grpc_end2end_test_config configs[] = {
FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION |
FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL |
FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER,
- chttp2_create_fixture_fullstack_compression,
+ nullptr, chttp2_create_fixture_fullstack_compression,
chttp2_init_client_fullstack_compression,
chttp2_init_server_fullstack_compression,
chttp2_tear_down_fullstack_compression},
diff --git a/test/core/end2end/fixtures/h2_fakesec.cc b/test/core/end2end/fixtures/h2_fakesec.cc
index bbf65fcd24..a653d7c477 100644
--- a/test/core/end2end/fixtures/h2_fakesec.cc
+++ b/test/core/end2end/fixtures/h2_fakesec.cc
@@ -132,10 +132,9 @@ 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_CLIENT_CHANNEL |
FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER,
- chttp2_create_fixture_secure_fullstack,
+ nullptr, chttp2_create_fixture_secure_fullstack,
chttp2_init_client_fake_secure_fullstack,
chttp2_init_server_fake_secure_fullstack,
chttp2_tear_down_secure_fullstack},
diff --git a/test/core/end2end/fixtures/h2_fd.cc b/test/core/end2end/fixtures/h2_fd.cc
index 9157ab04d0..52be0f7fd5 100644
--- a/test/core/end2end/fixtures/h2_fd.cc
+++ b/test/core/end2end/fixtures/h2_fd.cc
@@ -96,7 +96,7 @@ static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture* f) {
/* All test configurations */
static grpc_end2end_test_config configs[] = {
- {"chttp2/fd", FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER,
+ {"chttp2/fd", FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, nullptr,
chttp2_create_fixture_socketpair, chttp2_init_client_socketpair,
chttp2_init_server_socketpair, chttp2_tear_down_socketpair},
};
diff --git a/test/core/end2end/fixtures/h2_full+pipe.cc b/test/core/end2end/fixtures/h2_full+pipe.cc
index ed173c1afb..c5329640dc 100644
--- a/test/core/end2end/fixtures/h2_full+pipe.cc
+++ b/test/core/end2end/fixtures/h2_full+pipe.cc
@@ -96,7 +96,7 @@ static grpc_end2end_test_config configs[] = {
FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION |
FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL |
FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER,
- chttp2_create_fixture_fullstack, chttp2_init_client_fullstack,
+ nullptr, 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.cc b/test/core/end2end/fixtures/h2_full+trace.cc
index afb86ea899..ba7a780304 100644
--- a/test/core/end2end/fixtures/h2_full+trace.cc
+++ b/test/core/end2end/fixtures/h2_full+trace.cc
@@ -96,7 +96,7 @@ static grpc_end2end_test_config configs[] = {
FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION |
FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL |
FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER,
- chttp2_create_fixture_fullstack, chttp2_init_client_fullstack,
+ nullptr, 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+workarounds.cc b/test/core/end2end/fixtures/h2_full+workarounds.cc
index bd9ddff5b5..78da8418f6 100644
--- a/test/core/end2end/fixtures/h2_full+workarounds.cc
+++ b/test/core/end2end/fixtures/h2_full+workarounds.cc
@@ -107,7 +107,7 @@ static grpc_end2end_test_config configs[] = {
FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL |
FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER |
FEATURE_MASK_SUPPORTS_WORKAROUNDS,
- chttp2_create_fixture_fullstack, chttp2_init_client_fullstack,
+ nullptr, 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.cc b/test/core/end2end/fixtures/h2_full.cc
index ca61ec8eff..0c826b6836 100644
--- a/test/core/end2end/fixtures/h2_full.cc
+++ b/test/core/end2end/fixtures/h2_full.cc
@@ -90,7 +90,7 @@ static grpc_end2end_test_config configs[] = {
FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION |
FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL |
FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER,
- chttp2_create_fixture_fullstack, chttp2_init_client_fullstack,
+ nullptr, 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.cc b/test/core/end2end/fixtures/h2_http_proxy.cc
index 90d0627860..0af8a29a15 100644
--- a/test/core/end2end/fixtures/h2_http_proxy.cc
+++ b/test/core/end2end/fixtures/h2_http_proxy.cc
@@ -113,7 +113,7 @@ static grpc_end2end_test_config configs[] = {
FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION |
FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL |
FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER,
- chttp2_create_fixture_fullstack, chttp2_init_client_fullstack,
+ nullptr, 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.cc b/test/core/end2end/fixtures/h2_load_reporting.cc
index ec9eedbd34..18ea10a8d2 100644
--- a/test/core/end2end/fixtures/h2_load_reporting.cc
+++ b/test/core/end2end/fixtures/h2_load_reporting.cc
@@ -98,8 +98,9 @@ static grpc_end2end_test_config configs[] = {
FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION |
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},
+ nullptr, chttp2_create_fixture_load_reporting,
+ chttp2_init_client_load_reporting, chttp2_init_server_load_reporting,
+ chttp2_tear_down_load_reporting},
};
int main(int argc, char** argv) {
diff --git a/test/core/end2end/fixtures/h2_oauth2.cc b/test/core/end2end/fixtures/h2_oauth2.cc
index 9453f2f7cb..d44aafd50a 100644
--- a/test/core/end2end/fixtures/h2_oauth2.cc
+++ b/test/core/end2end/fixtures/h2_oauth2.cc
@@ -216,7 +216,7 @@ static grpc_end2end_test_config configs[] = {
FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS |
FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL |
FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER,
- chttp2_create_fixture_secure_fullstack,
+ "foo.test.google.fr", chttp2_create_fixture_secure_fullstack,
chttp2_init_client_simple_ssl_with_oauth2_secure_fullstack,
chttp2_init_server_simple_ssl_secure_fullstack,
chttp2_tear_down_secure_fullstack},
diff --git a/test/core/end2end/fixtures/h2_proxy.cc b/test/core/end2end/fixtures/h2_proxy.cc
index c97188fbb2..a32000061a 100644
--- a/test/core/end2end/fixtures/h2_proxy.cc
+++ b/test/core/end2end/fixtures/h2_proxy.cc
@@ -117,7 +117,7 @@ static grpc_end2end_test_config configs[] = {
FEATURE_MASK_SUPPORTS_REQUEST_PROXYING |
FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL |
FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER,
- chttp2_create_fixture_fullstack, chttp2_init_client_fullstack,
+ nullptr, 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.cc b/test/core/end2end/fixtures/h2_sockpair+trace.cc
index d539ddae8f..cdefcf4546 100644
--- a/test/core/end2end/fixtures/h2_sockpair+trace.cc
+++ b/test/core/end2end/fixtures/h2_sockpair+trace.cc
@@ -63,9 +63,14 @@ typedef struct {
static void client_setup_transport(void* ts, grpc_transport* transport) {
sp_client_setup* cs = static_cast<sp_client_setup*>(ts);
-
- cs->f->client = grpc_channel_create("socketpair-target", cs->client_args,
+ grpc_arg authority_arg = grpc_channel_arg_string_create(
+ const_cast<char*>(GRPC_ARG_DEFAULT_AUTHORITY),
+ const_cast<char*>("test-authority"));
+ grpc_channel_args* args =
+ grpc_channel_args_copy_and_add(cs->client_args, &authority_arg, 1);
+ cs->f->client = grpc_channel_create("socketpair-target", args,
GRPC_CLIENT_DIRECT_CHANNEL, transport);
+ grpc_channel_args_destroy(args);
}
static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
@@ -118,7 +123,7 @@ static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture* f) {
/* All test configurations */
static grpc_end2end_test_config configs[] = {
- {"chttp2/socketpair", FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER,
+ {"chttp2/socketpair", FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, nullptr,
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.cc b/test/core/end2end/fixtures/h2_sockpair.cc
index 75f64024cd..8966cb38d4 100644
--- a/test/core/end2end/fixtures/h2_sockpair.cc
+++ b/test/core/end2end/fixtures/h2_sockpair.cc
@@ -58,8 +58,14 @@ typedef struct {
static void client_setup_transport(void* ts, grpc_transport* transport) {
sp_client_setup* cs = static_cast<sp_client_setup*>(ts);
- cs->f->client = grpc_channel_create("socketpair-target", cs->client_args,
+ grpc_arg authority_arg = grpc_channel_arg_string_create(
+ const_cast<char*>(GRPC_ARG_DEFAULT_AUTHORITY),
+ const_cast<char*>("test-authority"));
+ grpc_channel_args* args =
+ grpc_channel_args_copy_and_add(cs->client_args, &authority_arg, 1);
+ cs->f->client = grpc_channel_create("socketpair-target", args,
GRPC_CLIENT_DIRECT_CHANNEL, transport);
+ grpc_channel_args_destroy(args);
}
static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
@@ -112,7 +118,7 @@ static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture* f) {
/* All test configurations */
static grpc_end2end_test_config configs[] = {
- {"chttp2/socketpair", FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER,
+ {"chttp2/socketpair", FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, nullptr,
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.cc b/test/core/end2end/fixtures/h2_sockpair_1byte.cc
index 929631917d..ebf4162217 100644
--- a/test/core/end2end/fixtures/h2_sockpair_1byte.cc
+++ b/test/core/end2end/fixtures/h2_sockpair_1byte.cc
@@ -58,8 +58,14 @@ typedef struct {
static void client_setup_transport(void* ts, grpc_transport* transport) {
sp_client_setup* cs = static_cast<sp_client_setup*>(ts);
- cs->f->client = grpc_channel_create("socketpair-target", cs->client_args,
+ grpc_arg authority_arg = grpc_channel_arg_string_create(
+ const_cast<char*>(GRPC_ARG_DEFAULT_AUTHORITY),
+ const_cast<char*>("test-authority"));
+ grpc_channel_args* args =
+ grpc_channel_args_copy_and_add(cs->client_args, &authority_arg, 1);
+ cs->f->client = grpc_channel_create("socketpair-target", args,
GRPC_CLIENT_DIRECT_CHANNEL, transport);
+ grpc_channel_args_destroy(args);
}
static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
@@ -124,9 +130,9 @@ 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",
- FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_socketpair,
- chttp2_init_client_socketpair, chttp2_init_server_socketpair,
- chttp2_tear_down_socketpair},
+ FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, nullptr,
+ 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.cc b/test/core/end2end/fixtures/h2_ssl.cc
index bbcc88e4f3..999cd4cdfb 100644
--- a/test/core/end2end/fixtures/h2_ssl.cc
+++ b/test/core/end2end/fixtures/h2_ssl.cc
@@ -109,10 +109,7 @@ static void chttp2_init_client_simple_ssl_secure_fullstack(
grpc_channel_args* new_client_args =
grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1);
chttp2_init_client_secure_fullstack(f, new_client_args, ssl_creds);
- {
- grpc_core::ExecCtx exec_ctx;
- grpc_channel_args_destroy(new_client_args);
- }
+ grpc_channel_args_destroy(new_client_args);
}
static int fail_server_auth_check(grpc_channel_args* server_args) {
@@ -149,7 +146,7 @@ static grpc_end2end_test_config configs[] = {
FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS |
FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL |
FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER,
- chttp2_create_fixture_secure_fullstack,
+ "foo.test.google.fr", chttp2_create_fixture_secure_fullstack,
chttp2_init_client_simple_ssl_secure_fullstack,
chttp2_init_server_simple_ssl_secure_fullstack,
chttp2_tear_down_secure_fullstack},
diff --git a/test/core/end2end/fixtures/h2_ssl_proxy.cc b/test/core/end2end/fixtures/h2_ssl_proxy.cc
index 6b0b891b18..9ab50c6217 100644
--- a/test/core/end2end/fixtures/h2_ssl_proxy.cc
+++ b/test/core/end2end/fixtures/h2_ssl_proxy.cc
@@ -187,7 +187,7 @@ static grpc_end2end_test_config configs[] = {
FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS |
FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL |
FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER,
- chttp2_create_fixture_secure_fullstack,
+ "foo.test.google.fr", chttp2_create_fixture_secure_fullstack,
chttp2_init_client_simple_ssl_secure_fullstack,
chttp2_init_server_simple_ssl_secure_fullstack,
chttp2_tear_down_secure_fullstack},
diff --git a/test/core/end2end/fixtures/h2_uds.cc b/test/core/end2end/fixtures/h2_uds.cc
index 1b081f9ea3..2c81c3d362 100644
--- a/test/core/end2end/fixtures/h2_uds.cc
+++ b/test/core/end2end/fixtures/h2_uds.cc
@@ -95,7 +95,7 @@ static grpc_end2end_test_config configs[] = {
FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION |
FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL |
FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER,
- chttp2_create_fixture_fullstack, chttp2_init_client_fullstack,
+ nullptr, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack,
chttp2_init_server_fullstack, chttp2_tear_down_fullstack},
};
diff --git a/test/core/end2end/fixtures/http_proxy_fixture.cc b/test/core/end2end/fixtures/http_proxy_fixture.cc
index 58353376f3..f02fa9d998 100644
--- a/test/core/end2end/fixtures/http_proxy_fixture.cc
+++ b/test/core/end2end/fixtures/http_proxy_fixture.cc
@@ -535,10 +535,10 @@ grpc_end2end_http_proxy* grpc_end2end_http_proxy_create(
GPR_ASSERT(error == GRPC_ERROR_NONE);
// Bind to port.
grpc_resolved_address resolved_addr;
- struct sockaddr_in* addr =
- reinterpret_cast<struct sockaddr_in*>(resolved_addr.addr);
+ grpc_sockaddr_in* addr =
+ reinterpret_cast<grpc_sockaddr_in*>(resolved_addr.addr);
memset(&resolved_addr, 0, sizeof(resolved_addr));
- addr->sin_family = AF_INET;
+ addr->sin_family = GRPC_AF_INET;
grpc_sockaddr_set_port(&resolved_addr, proxy_port);
int port;
error = grpc_tcp_server_add_port(proxy->server, &resolved_addr, &port);
diff --git a/test/core/end2end/fixtures/inproc.cc b/test/core/end2end/fixtures/inproc.cc
index d47de42540..be6eda8483 100644
--- a/test/core/end2end/fixtures/inproc.cc
+++ b/test/core/end2end/fixtures/inproc.cc
@@ -75,8 +75,9 @@ void inproc_tear_down(grpc_end2end_test_fixture* f) {
/* All test configurations */
static grpc_end2end_test_config configs[] = {
- {"inproc", FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, inproc_create_fixture,
- inproc_init_client, inproc_init_server, inproc_tear_down},
+ {"inproc", FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, nullptr,
+ inproc_create_fixture, inproc_init_client, inproc_init_server,
+ inproc_tear_down},
};
int main(int argc, char** argv) {
diff --git a/test/core/end2end/fuzzers/BUILD b/test/core/end2end/fuzzers/BUILD
index d33e2b0ff4..c12cfc6983 100644
--- a/test/core/end2end/fuzzers/BUILD
+++ b/test/core/end2end/fuzzers/BUILD
@@ -25,6 +25,8 @@ grpc_fuzzer(
srcs = ["api_fuzzer.cc"],
language = "C++",
corpus = "api_fuzzer_corpus",
+ size = "enormous",
+ timeout = "eternal",
deps = [
"//:gpr",
"//:grpc",
diff --git a/test/core/end2end/fuzzers/api_fuzzer.cc b/test/core/end2end/fuzzers/api_fuzzer.cc
index b6347fb1db..36f257d6da 100644
--- a/test/core/end2end/fuzzers/api_fuzzer.cc
+++ b/test/core/end2end/fuzzers/api_fuzzer.cc
@@ -38,8 +38,14 @@
#include "src/core/lib/surface/server.h"
#include "src/core/lib/transport/metadata.h"
#include "test/core/end2end/data/ssl_test_data.h"
+#include "test/core/util/fuzzer_util.h"
#include "test/core/util/passthru_endpoint.h"
+using grpc_core::testing::grpc_fuzzer_get_next_byte;
+using grpc_core::testing::grpc_fuzzer_get_next_string;
+using grpc_core::testing::grpc_fuzzer_get_next_uint32;
+using grpc_core::testing::input_stream;
+
////////////////////////////////////////////////////////////////////////////////
// logging
@@ -65,58 +71,20 @@ static gpr_timespec now_impl(gpr_clock_type clock_type) {
return ts;
}
-////////////////////////////////////////////////////////////////////////////////
-// input_stream: allows easy access to input bytes, and allows reading a little
-// past the end (avoiding needing to check everywhere)
-
-typedef struct {
- const uint8_t* cur;
- const uint8_t* end;
-} input_stream;
-
-static uint8_t next_byte(input_stream* inp) {
- if (inp->cur == inp->end) {
- return 0;
- }
- return *inp->cur++;
-}
-
static void end(input_stream* inp) { inp->cur = inp->end; }
-static char* read_string(input_stream* inp, bool* special) {
- char* str = nullptr;
- size_t cap = 0;
- size_t sz = 0;
- char c;
- do {
- if (cap == sz) {
- cap = GPR_MAX(3 * cap / 2, cap + 8);
- str = static_cast<char*>(gpr_realloc(str, cap));
- }
- c = static_cast<char>(next_byte(inp));
- str[sz++] = c;
- } while (c != 0 && c != 1);
- if (special != nullptr) {
- *special = (c == 1);
- }
- if (c == 1) {
- str[sz - 1] = 0;
- }
- return str;
-}
-
static void read_buffer(input_stream* inp, char** buffer, size_t* length,
bool* special) {
- *length = next_byte(inp);
+ *length = grpc_fuzzer_get_next_byte(inp);
if (*length == 255) {
if (special != nullptr) *special = true;
- *length = next_byte(inp);
+ *length = grpc_fuzzer_get_next_byte(inp);
} else {
if (special != nullptr) *special = false;
}
*buffer = static_cast<char*>(gpr_malloc(*length));
for (size_t i = 0; i < *length; i++) {
- (*buffer)[i] = static_cast<char>(next_byte(inp));
+ (*buffer)[i] = static_cast<char>(grpc_fuzzer_get_next_byte(inp));
}
}
@@ -128,7 +96,7 @@ static grpc_slice maybe_intern(grpc_slice s, bool intern) {
static grpc_slice read_string_like_slice(input_stream* inp) {
bool special;
- char* s = read_string(inp, &special);
+ char* s = grpc_fuzzer_get_next_string(inp, &special);
grpc_slice r = maybe_intern(grpc_slice_from_copied_string(s), special);
gpr_free(s);
return r;
@@ -146,39 +114,15 @@ static grpc_slice read_buffer_like_slice(input_stream* inp) {
}
static uint32_t read_uint22(input_stream* inp) {
- uint8_t b = next_byte(inp);
+ uint8_t b = grpc_fuzzer_get_next_byte(inp);
uint32_t x = b & 0x7f;
if (b & 0x80) {
x <<= 7;
- b = next_byte(inp);
+ b = grpc_fuzzer_get_next_byte(inp);
x |= b & 0x7f;
if (b & 0x80) {
x <<= 8;
- x |= next_byte(inp);
- }
- }
- return x;
-}
-
-static uint32_t read_uint32(input_stream* inp) {
- uint8_t b = next_byte(inp);
- uint32_t x = b & 0x7f;
- if (b & 0x80) {
- x <<= 7;
- b = next_byte(inp);
- x |= b & 0x7f;
- if (b & 0x80) {
- x <<= 7;
- b = next_byte(inp);
- x |= b & 0x7f;
- if (b & 0x80) {
- x <<= 7;
- b = next_byte(inp);
- x |= b & 0x7f;
- if (b & 0x80) {
- x = (x << 4) | (next_byte(inp) & 0x0f);
- }
- }
+ x |= grpc_fuzzer_get_next_byte(inp);
}
}
return x;
@@ -193,22 +137,22 @@ static grpc_byte_buffer* read_message(input_stream* inp) {
}
static int read_int(input_stream* inp) {
- return static_cast<int>(read_uint32(inp));
+ return static_cast<int>(grpc_fuzzer_get_next_uint32(inp));
}
static grpc_channel_args* read_args(input_stream* inp) {
- size_t n = next_byte(inp);
+ size_t n = grpc_fuzzer_get_next_byte(inp);
grpc_arg* args = static_cast<grpc_arg*>(gpr_malloc(sizeof(*args) * n));
for (size_t i = 0; i < n; i++) {
- switch (next_byte(inp)) {
+ switch (grpc_fuzzer_get_next_byte(inp)) {
case 1:
args[i].type = GRPC_ARG_STRING;
- args[i].key = read_string(inp, nullptr);
- args[i].value.string = read_string(inp, nullptr);
+ args[i].key = grpc_fuzzer_get_next_string(inp, nullptr);
+ args[i].value.string = grpc_fuzzer_get_next_string(inp, nullptr);
break;
case 2:
args[i].type = GRPC_ARG_INTEGER;
- args[i].key = read_string(inp, nullptr);
+ args[i].key = grpc_fuzzer_get_next_string(inp, nullptr);
args[i].value.integer = read_int(inp);
break;
case 3:
@@ -249,10 +193,11 @@ static void cred_artifact_ctx_finish(cred_artifact_ctx* ctx) {
static const char* read_cred_artifact(cred_artifact_ctx* ctx, input_stream* inp,
const char** builtins,
size_t num_builtins) {
- uint8_t b = next_byte(inp);
+ uint8_t b = grpc_fuzzer_get_next_byte(inp);
if (b == 0) return nullptr;
if (b == 1)
- return ctx->release[ctx->num_release++] = read_string(inp, nullptr);
+ return ctx->release[ctx->num_release++] =
+ grpc_fuzzer_get_next_string(inp, nullptr);
if (b >= num_builtins + 1) {
end(inp);
return nullptr;
@@ -288,7 +233,7 @@ static grpc_call_credentials* read_call_creds(input_stream* inp, int depth) {
end(inp);
return nullptr;
}
- switch (next_byte(inp)) {
+ switch (grpc_fuzzer_get_next_byte(inp)) {
default:
end(inp);
return nullptr;
@@ -339,7 +284,7 @@ static grpc_call_credentials* read_call_creds(input_stream* inp, int depth) {
}
static grpc_channel_credentials* read_channel_creds(input_stream* inp) {
- switch (next_byte(inp)) {
+ switch (grpc_fuzzer_get_next_byte(inp)) {
case 0:
return read_ssl_channel_creds(inp);
break;
@@ -426,6 +371,9 @@ void my_resolve_address(const char* addr, const char* default_port,
GRPC_CLOSURE_CREATE(finish_resolve, r, grpc_schedule_on_exec_ctx));
}
+static grpc_address_resolver_vtable fuzzer_resolver = {my_resolve_address,
+ nullptr};
+
grpc_ares_request* my_dns_lookup_ares(const char* dns_server, const char* addr,
const char* default_port,
grpc_pollset_set* interested_parties,
@@ -447,12 +395,6 @@ grpc_ares_request* my_dns_lookup_ares(const char* dns_server, const char* addr,
////////////////////////////////////////////////////////////////////////////////
// client connection
-// defined in tcp_client_posix.c
-extern void (*grpc_tcp_client_connect_impl)(
- grpc_closure* closure, grpc_endpoint** ep,
- grpc_pollset_set* interested_parties, const grpc_channel_args* channel_args,
- const grpc_resolved_address* addr, grpc_millis deadline);
-
static void sched_connect(grpc_closure* closure, grpc_endpoint** ep,
gpr_timespec deadline);
@@ -513,6 +455,8 @@ static void my_tcp_client_connect(grpc_closure* closure, grpc_endpoint** ep,
grpc_millis_to_timespec(deadline, GPR_CLOCK_MONOTONIC));
}
+grpc_tcp_client_vtable fuzz_tcp_client_vtable = {my_tcp_client_connect};
+
////////////////////////////////////////////////////////////////////////////////
// test driver
@@ -674,7 +618,7 @@ static grpc_slice* add_slice_to_unref(call_state* call, grpc_slice s) {
static void read_metadata(input_stream* inp, size_t* count,
grpc_metadata** metadata, call_state* cs) {
- *count = next_byte(inp);
+ *count = grpc_fuzzer_get_next_byte(inp);
if (*count) {
*metadata =
static_cast<grpc_metadata*>(gpr_malloc(*count * sizeof(**metadata)));
@@ -682,7 +626,7 @@ static void read_metadata(input_stream* inp, size_t* count,
for (size_t i = 0; i < *count; i++) {
(*metadata)[i].key = read_string_like_slice(inp);
(*metadata)[i].value = read_buffer_like_slice(inp);
- (*metadata)[i].flags = read_uint32(inp);
+ (*metadata)[i].flags = grpc_fuzzer_get_next_uint32(inp);
add_slice_to_unref(cs, (*metadata)[i].key);
add_slice_to_unref(cs, (*metadata)[i].value);
}
@@ -753,7 +697,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
if (squelch && grpc_trace_fuzzer == nullptr) gpr_set_log_function(dont_log);
gpr_free(grpc_trace_fuzzer);
input_stream inp = {data, data + size};
- grpc_tcp_client_connect_impl = my_tcp_client_connect;
+ grpc_set_tcp_client_impl(&fuzz_tcp_client_vtable);
gpr_now_impl = now_impl;
grpc_init();
grpc_timer_manager_set_threading(false);
@@ -761,7 +705,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_core::ExecCtx exec_ctx;
grpc_executor_set_threading(false);
}
- grpc_resolve_address = my_resolve_address;
+ grpc_set_resolver_impl(&fuzzer_resolver);
grpc_dns_lookup_ares = my_dns_lookup_ares;
GPR_ASSERT(g_channel == nullptr);
@@ -812,7 +756,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_timer_manager_tick();
- switch (next_byte(&inp)) {
+ switch (grpc_fuzzer_get_next_byte(&inp)) {
// terminate on bad bytes
default:
end(&inp);
@@ -839,13 +783,14 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
// increment global time
case 1: {
g_now = gpr_time_add(
- g_now, gpr_time_from_micros(read_uint32(&inp), GPR_TIMESPAN));
+ g_now, gpr_time_from_micros(grpc_fuzzer_get_next_uint32(&inp),
+ GPR_TIMESPAN));
break;
}
// create an insecure channel
case 2: {
if (g_channel == nullptr) {
- char* target = read_string(&inp, nullptr);
+ char* target = grpc_fuzzer_get_next_string(&inp, nullptr);
char* target_uri;
gpr_asprintf(&target_uri, "dns:%s", target);
grpc_channel_args* args = read_args(&inp);
@@ -928,7 +873,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
// check connectivity
case 8: {
if (g_channel != nullptr) {
- uint8_t try_to_connect = next_byte(&inp);
+ uint8_t try_to_connect = grpc_fuzzer_get_next_byte(&inp);
if (try_to_connect == 0 || try_to_connect == 1) {
grpc_channel_check_connectivity_state(g_channel, try_to_connect);
} else {
@@ -947,7 +892,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
if (st != GRPC_CHANNEL_SHUTDOWN) {
gpr_timespec deadline = gpr_time_add(
gpr_now(GPR_CLOCK_REALTIME),
- gpr_time_from_micros(read_uint32(&inp), GPR_TIMESPAN));
+ gpr_time_from_micros(grpc_fuzzer_get_next_uint32(&inp),
+ GPR_TIMESPAN));
grpc_channel_watch_connectivity_state(
g_channel, st, deadline, cq,
create_validator(validate_connectivity_watch,
@@ -972,7 +918,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
}
parent_call = g_active_call->call;
}
- uint32_t propagation_mask = read_uint32(&inp);
+ uint32_t propagation_mask = grpc_fuzzer_get_next_uint32(&inp);
grpc_slice method = read_string_like_slice(&inp);
if (GRPC_SLICE_LENGTH(method) == 0) {
ok = false;
@@ -980,7 +926,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_slice host = read_string_like_slice(&inp);
gpr_timespec deadline =
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
- gpr_time_from_micros(read_uint32(&inp), GPR_TIMESPAN));
+ gpr_time_from_micros(grpc_fuzzer_get_next_uint32(&inp),
+ GPR_TIMESPAN));
if (ok) {
call_state* cs = new_call(g_active_call, CLIENT);
@@ -1006,7 +953,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
end(&inp);
break;
}
- size_t num_ops = next_byte(&inp);
+ size_t num_ops = grpc_fuzzer_get_next_byte(&inp);
if (num_ops > 6) {
end(&inp);
break;
@@ -1020,7 +967,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
uint8_t has_ops = 0;
for (i = 0; i < num_ops; i++) {
op = &ops[i];
- switch (next_byte(&inp)) {
+ switch (grpc_fuzzer_get_next_byte(&inp)) {
default:
/* invalid value */
op->op = (grpc_op_type)-1;
@@ -1061,7 +1008,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
&op->data.send_status_from_server.trailing_metadata,
g_active_call);
op->data.send_status_from_server.status =
- static_cast<grpc_status_code>(next_byte(&inp));
+ static_cast<grpc_status_code>(
+ grpc_fuzzer_get_next_byte(&inp));
op->data.send_status_from_server.status_details =
add_slice_to_unref(g_active_call,
read_buffer_like_slice(&inp));
@@ -1098,7 +1046,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
break;
}
op->reserved = nullptr;
- op->flags = read_uint32(&inp);
+ op->flags = grpc_fuzzer_get_next_uint32(&inp);
}
if (ok) {
validator* v = make_finished_batch_validator(g_active_call, has_ops);
@@ -1161,14 +1109,14 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
}
// enable a tracer
case 17: {
- char* tracer = read_string(&inp, nullptr);
+ char* tracer = grpc_fuzzer_get_next_string(&inp, nullptr);
grpc_tracer_set_enabled(tracer, 1);
gpr_free(tracer);
break;
}
// disable a tracer
case 18: {
- char* tracer = read_string(&inp, nullptr);
+ char* tracer = grpc_fuzzer_get_next_string(&inp, nullptr);
grpc_tracer_set_enabled(tracer, 0);
gpr_free(tracer);
break;
@@ -1210,7 +1158,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
// create a secure channel
case 22: {
if (g_channel == nullptr) {
- char* target = read_string(&inp, nullptr);
+ char* target = grpc_fuzzer_get_next_string(&inp, nullptr);
char* target_uri;
gpr_asprintf(&target_uri, "dns:%s", target);
grpc_channel_args* args = read_args(&inp);
diff --git a/test/core/end2end/fuzzers/api_fuzzer_corpus/clusterfuzz-testcase-api_fuzzer-5406804084260864 b/test/core/end2end/fuzzers/api_fuzzer_corpus/clusterfuzz-testcase-api_fuzzer-5406804084260864
new file mode 100644
index 0000000000..121aac7ec8
--- /dev/null
+++ b/test/core/end2end/fuzzers/api_fuzzer_corpus/clusterfuzz-testcase-api_fuzzer-5406804084260864
Binary files differ
diff --git a/test/core/end2end/fuzzers/api_fuzzer_corpus/clusterfuzz-testcase-api_fuzzer-5471994809155584 b/test/core/end2end/fuzzers/api_fuzzer_corpus/clusterfuzz-testcase-api_fuzzer-5471994809155584
new file mode 100644
index 0000000000..e5d3d38e96
--- /dev/null
+++ b/test/core/end2end/fuzzers/api_fuzzer_corpus/clusterfuzz-testcase-api_fuzzer-5471994809155584
Binary files differ
diff --git a/test/core/end2end/fuzzers/api_fuzzer_corpus/clusterfuzz-testcase-api_fuzzer-6609852341157888 b/test/core/end2end/fuzzers/api_fuzzer_corpus/clusterfuzz-testcase-api_fuzzer-6609852341157888
new file mode 100644
index 0000000000..b7debabf19
--- /dev/null
+++ b/test/core/end2end/fuzzers/api_fuzzer_corpus/clusterfuzz-testcase-api_fuzzer-6609852341157888
Binary files differ
diff --git a/test/core/end2end/fuzzers/client_fuzzer.cc b/test/core/end2end/fuzzers/client_fuzzer.cc
index 16acf8ef28..e21006bb67 100644
--- a/test/core/end2end/fuzzers/client_fuzzer.cc
+++ b/test/core/end2end/fuzzers/client_fuzzer.cc
@@ -20,6 +20,7 @@
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
+#include <grpc/support/string_util.h>
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
#include "src/core/lib/iomgr/executor.h"
@@ -58,8 +59,14 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_create_chttp2_transport(nullptr, mock_endpoint, true);
grpc_chttp2_transport_start_reading(transport, nullptr, nullptr);
+ grpc_arg authority_arg = grpc_channel_arg_string_create(
+ const_cast<char*>(GRPC_ARG_DEFAULT_AUTHORITY),
+ const_cast<char*>("test-authority"));
+ grpc_channel_args* args =
+ grpc_channel_args_copy_and_add(nullptr, &authority_arg, 1);
grpc_channel* channel = grpc_channel_create(
- "test-target", nullptr, GRPC_CLIENT_DIRECT_CHANNEL, transport);
+ "test-target", args, GRPC_CLIENT_DIRECT_CHANNEL, transport);
+ grpc_channel_args_destroy(args);
grpc_slice host = grpc_slice_from_static_string("localhost");
grpc_call* call = grpc_channel_create_call(
channel, nullptr, 0, cq, grpc_slice_from_static_string("/foo"), &host,
diff --git a/test/core/end2end/gen_build_yaml.py b/test/core/end2end/gen_build_yaml.py
index 4e20b0b334..c355fc24b5 100755
--- a/test/core/end2end/gen_build_yaml.py
+++ b/test/core/end2end/gen_build_yaml.py
@@ -108,6 +108,8 @@ END2END_TESTS = {
proxyable=False, cpu_cost=LOWCPU, exclude_iomgrs=['uv']),
'default_host': default_test_options._replace(
needs_fullstack=True, needs_dns=True, needs_names=True),
+ 'call_host_override': default_test_options._replace(
+ needs_fullstack=True, needs_dns=True, needs_names=True),
'disappearing_server': connectivity_test_options._replace(flaky=True,
needs_names=True),
'empty_batch': default_test_options._replace(cpu_cost=LOWCPU),
@@ -168,6 +170,9 @@ END2END_TESTS = {
proxyable=False),
'retry_non_retriable_status': default_test_options._replace(
cpu_cost=LOWCPU, needs_client_channel=True, proxyable=False),
+ 'retry_non_retriable_status_before_recv_trailing_metadata_started':
+ default_test_options._replace(
+ cpu_cost=LOWCPU, needs_client_channel=True, proxyable=False),
'retry_recv_initial_metadata': default_test_options._replace(
cpu_cost=LOWCPU, needs_client_channel=True, proxyable=False),
'retry_recv_message': default_test_options._replace(
diff --git a/test/core/end2end/generate_tests.bzl b/test/core/end2end/generate_tests.bzl
index 8e723fd609..11fc576165 100755
--- a/test/core/end2end/generate_tests.bzl
+++ b/test/core/end2end/generate_tests.bzl
@@ -101,6 +101,8 @@ END2END_TESTS = {
'binary_metadata': test_options(),
'resource_quota_server': test_options(proxyable=False),
'call_creds': test_options(secure=True),
+ 'call_host_override': test_options(needs_fullstack=True, needs_dns=True,
+ needs_names=True),
'cancel_after_accept': test_options(),
'cancel_after_client_done': test_options(),
'cancel_after_invoke': test_options(),
@@ -156,6 +158,8 @@ END2END_TESTS = {
needs_client_channel=True, proxyable=False),
'retry_non_retriable_status': test_options(needs_client_channel=True,
proxyable=False),
+ 'retry_non_retriable_status_before_recv_trailing_metadata_started':
+ test_options(needs_client_channel=True, proxyable=False),
'retry_recv_initial_metadata': test_options(needs_client_channel=True,
proxyable=False),
'retry_recv_message': test_options(needs_client_channel=True,
diff --git a/test/core/end2end/goaway_server_test.cc b/test/core/end2end/goaway_server_test.cc
index 09f0301c44..0188698f17 100644
--- a/test/core/end2end/goaway_server_test.cc
+++ b/test/core/end2end/goaway_server_test.cc
@@ -21,6 +21,7 @@
including windows.h on Windows, uv.h must be included before other system
headers. Therefore, sockaddr.h must always be included first */
#include "src/core/lib/iomgr/sockaddr.h"
+#include "src/core/lib/iomgr/socket_utils.h"
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
@@ -35,14 +36,13 @@
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
+extern grpc_address_resolver_vtable* grpc_resolve_address_impl;
+static grpc_address_resolver_vtable* default_resolver;
+
static void* tag(intptr_t i) { return (void*)i; }
static gpr_mu g_mu;
static int g_resolve_port = -1;
-static void (*iomgr_resolve_address)(const char* addr, const char* default_port,
- grpc_pollset_set* interested_parties,
- grpc_closure* on_done,
- grpc_resolved_addresses** addresses);
static grpc_ares_request* (*iomgr_dns_lookup_ares)(
const char* dns_server, const char* addr, const char* default_port,
@@ -61,8 +61,8 @@ static void my_resolve_address(const char* addr, const char* default_port,
grpc_closure* on_done,
grpc_resolved_addresses** addrs) {
if (0 != strcmp(addr, "test")) {
- iomgr_resolve_address(addr, default_port, interested_parties, on_done,
- addrs);
+ default_resolver->resolve_address(addr, default_port, interested_parties,
+ on_done, addrs);
return;
}
@@ -77,17 +77,27 @@ static void my_resolve_address(const char* addr, const char* default_port,
(*addrs)->addrs = static_cast<grpc_resolved_address*>(
gpr_malloc(sizeof(*(*addrs)->addrs)));
memset((*addrs)->addrs, 0, sizeof(*(*addrs)->addrs));
- struct sockaddr_in* sa =
- reinterpret_cast<struct sockaddr_in*>((*addrs)->addrs[0].addr);
- sa->sin_family = AF_INET;
- sa->sin_addr.s_addr = htonl(0x7f000001);
- sa->sin_port = htons(static_cast<uint16_t>(g_resolve_port));
- (*addrs)->addrs[0].len = sizeof(*sa);
+ grpc_sockaddr_in* sa =
+ reinterpret_cast<grpc_sockaddr_in*>((*addrs)->addrs[0].addr);
+ sa->sin_family = GRPC_AF_INET;
+ sa->sin_addr.s_addr = 0x100007f;
+ sa->sin_port = grpc_htons(static_cast<uint16_t>(g_resolve_port));
+ (*addrs)->addrs[0].len = static_cast<socklen_t>(sizeof(*sa));
gpr_mu_unlock(&g_mu);
}
GRPC_CLOSURE_SCHED(on_done, error);
}
+static grpc_error* my_blocking_resolve_address(
+ const char* name, const char* default_port,
+ grpc_resolved_addresses** addresses) {
+ return default_resolver->blocking_resolve_address(name, default_port,
+ addresses);
+}
+
+static grpc_address_resolver_vtable test_resolver = {
+ my_resolve_address, my_blocking_resolve_address};
+
static grpc_ares_request* my_dns_lookup_ares(
const char* dns_server, const char* addr, const char* default_port,
grpc_pollset_set* interested_parties, grpc_closure* on_done,
@@ -106,11 +116,11 @@ static grpc_ares_request* my_dns_lookup_ares(
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Forced Failure");
} else {
*lb_addrs = grpc_lb_addresses_create(1, nullptr);
- struct sockaddr_in* sa = static_cast<struct sockaddr_in*>(
- gpr_zalloc(sizeof(struct sockaddr_in)));
- sa->sin_family = AF_INET;
- sa->sin_addr.s_addr = htonl(0x7f000001);
- sa->sin_port = htons(static_cast<uint16_t>(g_resolve_port));
+ grpc_sockaddr_in* sa =
+ static_cast<grpc_sockaddr_in*>(gpr_zalloc(sizeof(grpc_sockaddr_in)));
+ sa->sin_family = GRPC_AF_INET;
+ sa->sin_addr.s_addr = 0x100007f;
+ sa->sin_port = grpc_htons(static_cast<uint16_t>(g_resolve_port));
grpc_lb_addresses_set_address(*lb_addrs, 0, sa, sizeof(*sa), false, nullptr,
nullptr);
gpr_free(sa);
@@ -130,9 +140,9 @@ int main(int argc, char** argv) {
gpr_mu_init(&g_mu);
grpc_init();
- iomgr_resolve_address = grpc_resolve_address;
+ default_resolver = grpc_resolve_address_impl;
+ grpc_set_resolver_impl(&test_resolver);
iomgr_dns_lookup_ares = grpc_dns_lookup_ares;
- grpc_resolve_address = my_resolve_address;
grpc_dns_lookup_ares = my_dns_lookup_ares;
int was_cancelled1;
diff --git a/test/core/end2end/h2_ssl_cert_test.cc b/test/core/end2end/h2_ssl_cert_test.cc
index 9e2082ce9d..9ed6f23798 100644
--- a/test/core/end2end/h2_ssl_cert_test.cc
+++ b/test/core/end2end/h2_ssl_cert_test.cc
@@ -57,8 +57,6 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
f.fixture_data = ffd;
f.cq = grpc_completion_queue_create_for_next(nullptr);
- f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
-
return f;
}
@@ -202,6 +200,7 @@ typedef enum { SUCCESS, FAIL } test_result;
FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | \
FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS | \
FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL, \
+ "foo.test.google.fr", \
chttp2_create_fixture_secure_fullstack, \
CLIENT_INIT_NAME(cert_type), \
SERVER_INIT_NAME(request_type), \
@@ -270,27 +269,13 @@ static void drain_cq(grpc_completion_queue* cq) {
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
+// Shuts down the server.
+// Side effect - Also shuts down and drains the completion queue.
static void shutdown_server(grpc_end2end_test_fixture* f) {
if (!f->server) return;
- /* Perform a completion queue next, so that any pending operations can be
- * finished, and resources can be released. This is so that, shutdown does not
- * hang. For example, the server might be stuck in the handshaking code, which
- * keeps a ref to a listener. Unless, it is unref'd, shutdown won't be able
- * to proceed.
- *
- * (If shutdown times out, it is probably because 100ms wasn't enough. In that
- * case, the deadline can be increased. Or, we could simply have another
- * thread for the server to poll the completion queue while the shutdown
- * progresses.)
- */
- GPR_ASSERT(grpc_completion_queue_next(
- f->cq, grpc_timeout_milliseconds_to_deadline(100), nullptr)
- .type == GRPC_QUEUE_TIMEOUT);
- grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
- grpc_timeout_seconds_to_deadline(5),
- nullptr)
- .type == GRPC_OP_COMPLETE);
+ grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
+ grpc_completion_queue_shutdown(f->cq);
+ drain_cq(f->cq);
grpc_server_destroy(f->server);
f->server = nullptr;
}
@@ -304,11 +289,7 @@ static void shutdown_client(grpc_end2end_test_fixture* f) {
static void end_test(grpc_end2end_test_fixture* f) {
shutdown_client(f);
shutdown_server(f);
-
- grpc_completion_queue_shutdown(f->cq);
- drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
- grpc_completion_queue_destroy(f->shutdown_cq);
}
static void simple_request_body(grpc_end2end_test_fixture f,
diff --git a/test/core/end2end/h2_ssl_session_reuse_test.cc b/test/core/end2end/h2_ssl_session_reuse_test.cc
new file mode 100644
index 0000000000..d5984be93f
--- /dev/null
+++ b/test/core/end2end/h2_ssl_session_reuse_test.cc
@@ -0,0 +1,280 @@
+/*
+ *
+ * Copyright 2018 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "test/core/end2end/end2end_tests.h"
+
+#include <stdio.h>
+#include <string.h>
+
+#include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
+
+#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/host_port.h"
+#include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gpr/tmpfile.h"
+#include "src/core/lib/security/credentials/credentials.h"
+#include "test/core/end2end/cq_verifier.h"
+#include "test/core/end2end/data/ssl_test_data.h"
+#include "test/core/util/port.h"
+#include "test/core/util/test_config.h"
+
+#include <gtest/gtest.h>
+
+namespace grpc {
+namespace testing {
+namespace {
+
+void* tag(intptr_t t) { return (void*)t; }
+
+gpr_timespec five_seconds_time() { return grpc_timeout_seconds_to_deadline(5); }
+
+grpc_server* server_create(grpc_completion_queue* cq, char* server_addr) {
+ grpc_ssl_pem_key_cert_pair pem_cert_key_pair = {test_server1_key,
+ test_server1_cert};
+ grpc_server_credentials* server_creds = grpc_ssl_server_credentials_create_ex(
+ test_root_cert, &pem_cert_key_pair, 1,
+ GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_AND_VERIFY, nullptr);
+
+ grpc_server* server = grpc_server_create(nullptr, nullptr);
+ grpc_server_register_completion_queue(server, cq, nullptr);
+ GPR_ASSERT(
+ grpc_server_add_secure_http2_port(server, server_addr, server_creds));
+ grpc_server_credentials_release(server_creds);
+ grpc_server_start(server);
+
+ return server;
+}
+
+grpc_channel* client_create(char* server_addr, grpc_ssl_session_cache* cache) {
+ grpc_ssl_pem_key_cert_pair signed_client_key_cert_pair = {
+ test_signed_client_key, test_signed_client_cert};
+ grpc_channel_credentials* client_creds = grpc_ssl_credentials_create(
+ test_root_cert, &signed_client_key_cert_pair, nullptr);
+
+ grpc_arg args[] = {
+ grpc_channel_arg_string_create(
+ const_cast<char*>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG),
+ const_cast<char*>("waterzooi.test.google.be")),
+ grpc_ssl_session_cache_create_channel_arg(cache),
+ };
+
+ grpc_channel_args* client_args =
+ grpc_channel_args_copy_and_add(nullptr, args, GPR_ARRAY_SIZE(args));
+
+ grpc_channel* client = grpc_secure_channel_create(client_creds, server_addr,
+ client_args, nullptr);
+ GPR_ASSERT(client != nullptr);
+ grpc_channel_credentials_release(client_creds);
+
+ {
+ grpc_core::ExecCtx exec_ctx;
+ grpc_channel_args_destroy(client_args);
+ }
+
+ return client;
+}
+
+void do_round_trip(grpc_completion_queue* cq, grpc_server* server,
+ char* server_addr, grpc_ssl_session_cache* cache,
+ bool expect_session_reuse) {
+ grpc_channel* client = client_create(server_addr, cache);
+
+ cq_verifier* cqv = cq_verifier_create(cq);
+ grpc_op ops[6];
+ grpc_op* op;
+ grpc_metadata_array initial_metadata_recv;
+ grpc_metadata_array trailing_metadata_recv;
+ grpc_metadata_array request_metadata_recv;
+ grpc_call_details call_details;
+ grpc_status_code status;
+ grpc_call_error error;
+ grpc_slice details;
+ int was_cancelled = 2;
+
+ gpr_timespec deadline = grpc_timeout_seconds_to_deadline(60);
+ grpc_call* c = grpc_channel_create_call(
+ client, nullptr, GRPC_PROPAGATE_DEFAULTS, cq,
+ grpc_slice_from_static_string("/foo"), nullptr, deadline, nullptr);
+ GPR_ASSERT(c);
+
+ grpc_metadata_array_init(&initial_metadata_recv);
+ grpc_metadata_array_init(&trailing_metadata_recv);
+ grpc_metadata_array_init(&request_metadata_recv);
+ grpc_call_details_init(&call_details);
+
+ memset(ops, 0, sizeof(ops));
+ op = ops;
+ op->op = GRPC_OP_SEND_INITIAL_METADATA;
+ op->data.send_initial_metadata.count = 0;
+ op->flags = 0;
+ op->reserved = nullptr;
+ op++;
+ op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
+ op->flags = 0;
+ op->reserved = nullptr;
+ op++;
+ op->op = GRPC_OP_RECV_INITIAL_METADATA;
+ op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv;
+ op->flags = 0;
+ op->reserved = nullptr;
+ op++;
+ op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
+ op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
+ op->data.recv_status_on_client.status = &status;
+ op->data.recv_status_on_client.status_details = &details;
+ op->flags = 0;
+ op->reserved = nullptr;
+ op++;
+ error = grpc_call_start_batch(c, ops, static_cast<size_t>(op - ops), tag(1),
+ nullptr);
+ GPR_ASSERT(GRPC_CALL_OK == error);
+
+ grpc_call* s;
+ error = grpc_server_request_call(server, &s, &call_details,
+ &request_metadata_recv, cq, cq, tag(101));
+ GPR_ASSERT(GRPC_CALL_OK == error);
+ CQ_EXPECT_COMPLETION(cqv, tag(101), 1);
+ cq_verify(cqv);
+
+ grpc_auth_context* auth = grpc_call_auth_context(s);
+ grpc_auth_property_iterator it = grpc_auth_context_find_properties_by_name(
+ auth, GRPC_SSL_SESSION_REUSED_PROPERTY);
+ const grpc_auth_property* property = grpc_auth_property_iterator_next(&it);
+ GPR_ASSERT(property != nullptr);
+
+ if (expect_session_reuse) {
+ GPR_ASSERT(strcmp(property->value, "true") == 0);
+ } else {
+ GPR_ASSERT(strcmp(property->value, "false") == 0);
+ }
+ grpc_auth_context_release(auth);
+
+ memset(ops, 0, sizeof(ops));
+ op = ops;
+ op->op = GRPC_OP_SEND_INITIAL_METADATA;
+ op->data.send_initial_metadata.count = 0;
+ op->flags = 0;
+ op->reserved = nullptr;
+ op++;
+ op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
+ op->data.recv_close_on_server.cancelled = &was_cancelled;
+ op->flags = 0;
+ op->reserved = nullptr;
+ op++;
+ op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
+ op->data.send_status_from_server.trailing_metadata_count = 0;
+ op->data.send_status_from_server.status = GRPC_STATUS_OK;
+ op->flags = 0;
+ op->reserved = nullptr;
+ op++;
+ error = grpc_call_start_batch(s, ops, static_cast<size_t>(op - ops), tag(103),
+ nullptr);
+ GPR_ASSERT(GRPC_CALL_OK == error);
+
+ CQ_EXPECT_COMPLETION(cqv, tag(103), 1);
+ CQ_EXPECT_COMPLETION(cqv, tag(1), 1);
+ cq_verify(cqv);
+
+ grpc_metadata_array_destroy(&initial_metadata_recv);
+ grpc_metadata_array_destroy(&trailing_metadata_recv);
+ grpc_metadata_array_destroy(&request_metadata_recv);
+ grpc_call_details_destroy(&call_details);
+
+ grpc_call_unref(c);
+ grpc_call_unref(s);
+
+ cq_verifier_destroy(cqv);
+
+ grpc_channel_destroy(client);
+}
+
+void drain_cq(grpc_completion_queue* cq) {
+ grpc_event ev;
+ do {
+ ev = grpc_completion_queue_next(cq, five_seconds_time(), nullptr);
+ } while (ev.type != GRPC_QUEUE_SHUTDOWN);
+}
+
+TEST(H2SessionReuseTest, SingleReuse) {
+ int port = grpc_pick_unused_port_or_die();
+
+ char* server_addr;
+ gpr_join_host_port(&server_addr, "localhost", port);
+
+ grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr);
+ grpc_ssl_session_cache* cache = grpc_ssl_session_cache_create_lru(16);
+
+ grpc_server* server = server_create(cq, server_addr);
+
+ do_round_trip(cq, server, server_addr, cache, false);
+ do_round_trip(cq, server, server_addr, cache, true);
+ do_round_trip(cq, server, server_addr, cache, true);
+
+ gpr_free(server_addr);
+ grpc_ssl_session_cache_destroy(cache);
+
+ GPR_ASSERT(grpc_completion_queue_next(
+ cq, grpc_timeout_milliseconds_to_deadline(100), nullptr)
+ .type == GRPC_QUEUE_TIMEOUT);
+
+ grpc_completion_queue* shutdown_cq =
+ grpc_completion_queue_create_for_pluck(nullptr);
+ grpc_server_shutdown_and_notify(server, shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ nullptr)
+ .type == GRPC_OP_COMPLETE);
+ grpc_server_destroy(server);
+ grpc_completion_queue_destroy(shutdown_cq);
+
+ grpc_completion_queue_shutdown(cq);
+ drain_cq(cq);
+ grpc_completion_queue_destroy(cq);
+}
+
+} // namespace
+} // namespace testing
+} // namespace grpc
+
+int main(int argc, char** argv) {
+ FILE* roots_file;
+ size_t roots_size = strlen(test_root_cert);
+ char* roots_filename;
+
+ grpc_test_init(argc, argv);
+ /* Set the SSL roots env var. */
+ roots_file = gpr_tmpfile("chttp2_ssl_session_reuse_test", &roots_filename);
+ GPR_ASSERT(roots_filename != nullptr);
+ GPR_ASSERT(roots_file != nullptr);
+ GPR_ASSERT(fwrite(test_root_cert, 1, roots_size, roots_file) == roots_size);
+ fclose(roots_file);
+ gpr_setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR, roots_filename);
+
+ grpc_init();
+ ::testing::InitGoogleTest(&argc, argv);
+ int ret = RUN_ALL_TESTS();
+ grpc_shutdown();
+
+ /* Cleanup. */
+ remove(roots_filename);
+ gpr_free(roots_filename);
+
+ return ret;
+}
diff --git a/test/core/end2end/no_server_test.cc b/test/core/end2end/no_server_test.cc
index 6113885171..e8ce4032e0 100644
--- a/test/core/end2end/no_server_test.cc
+++ b/test/core/end2end/no_server_test.cc
@@ -22,45 +22,47 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
+#include "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h"
#include "test/core/end2end/cq_verifier.h"
#include "test/core/util/test_config.h"
static void* tag(intptr_t i) { return (void*)i; }
-int main(int argc, char** argv) {
- grpc_channel* chan;
- grpc_call* call;
- gpr_timespec deadline = grpc_timeout_seconds_to_deadline(2);
- grpc_completion_queue* cq;
- cq_verifier* cqv;
- grpc_op ops[6];
- grpc_op* op;
- grpc_metadata_array trailing_metadata_recv;
- grpc_status_code status;
- grpc_slice details;
+void run_test(bool wait_for_ready) {
+ gpr_log(GPR_INFO, "TEST: wait_for_ready=%d", wait_for_ready);
- grpc_test_init(argc, argv);
grpc_init();
- grpc_metadata_array_init(&trailing_metadata_recv);
+ grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr);
+ cq_verifier* cqv = cq_verifier_create(cq);
- cq = grpc_completion_queue_create_for_next(nullptr);
- cqv = cq_verifier_create(cq);
+ grpc_core::RefCountedPtr<grpc_core::FakeResolverResponseGenerator>
+ response_generator =
+ grpc_core::MakeRefCounted<grpc_core::FakeResolverResponseGenerator>();
+ grpc_arg arg = grpc_core::FakeResolverResponseGenerator::MakeChannelArg(
+ response_generator.get());
+ grpc_channel_args args = {1, &arg};
/* create a call, channel to a non existant server */
- chan = grpc_insecure_channel_create("nonexistant:54321", nullptr, nullptr);
- grpc_slice host = grpc_slice_from_static_string("nonexistant");
- call = grpc_channel_create_call(chan, nullptr, GRPC_PROPAGATE_DEFAULTS, cq,
- grpc_slice_from_static_string("/Foo"), &host,
- deadline, nullptr);
+ grpc_channel* chan =
+ grpc_insecure_channel_create("fake:nonexistant", &args, nullptr);
+ gpr_timespec deadline = grpc_timeout_seconds_to_deadline(2);
+ grpc_call* call = grpc_channel_create_call(
+ chan, nullptr, GRPC_PROPAGATE_DEFAULTS, cq,
+ grpc_slice_from_static_string("/Foo"), nullptr, deadline, nullptr);
+ grpc_op ops[6];
memset(ops, 0, sizeof(ops));
- op = ops;
+ grpc_op* op = ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
- op->flags = 0;
+ op->flags = wait_for_ready ? GRPC_INITIAL_METADATA_WAIT_FOR_READY : 0;
op->reserved = nullptr;
op++;
+ grpc_metadata_array trailing_metadata_recv;
+ grpc_metadata_array_init(&trailing_metadata_recv);
+ grpc_status_code status;
+ grpc_slice details;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
op->data.recv_status_on_client.status = &status;
@@ -71,11 +73,25 @@ int main(int argc, char** argv) {
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, ops,
(size_t)(op - ops), tag(1),
nullptr));
+
+ {
+ grpc_core::ExecCtx exec_ctx;
+ response_generator->SetFailure();
+ }
+
/* verify that all tags get completed */
CQ_EXPECT_COMPLETION(cqv, tag(1), 1);
cq_verify(cqv);
- GPR_ASSERT(status == GRPC_STATUS_DEADLINE_EXCEEDED);
+ gpr_log(GPR_INFO, "call status: %d", status);
+ if (wait_for_ready) {
+ GPR_ASSERT(status == GRPC_STATUS_DEADLINE_EXCEEDED);
+ } else {
+ GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE);
+ }
+
+ grpc_slice_unref(details);
+ grpc_metadata_array_destroy(&trailing_metadata_recv);
grpc_completion_queue_shutdown(cq);
while (grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME),
@@ -87,10 +103,12 @@ int main(int argc, char** argv) {
grpc_channel_destroy(chan);
cq_verifier_destroy(cqv);
- grpc_slice_unref(details);
- grpc_metadata_array_destroy(&trailing_metadata_recv);
-
grpc_shutdown();
+}
+int main(int argc, char** argv) {
+ grpc_test_init(argc, argv);
+ run_test(true /* wait_for_ready */);
+ run_test(false /* wait_for_ready */);
return 0;
}
diff --git a/test/core/end2end/tests/bad_ping.cc b/test/core/end2end/tests/bad_ping.cc
index f305ea5703..98d893f64d 100644
--- a/test/core/end2end/tests/bad_ping.cc
+++ b/test/core/end2end/tests/bad_ping.cc
@@ -28,7 +28,7 @@
#include "src/core/lib/gpr/useful.h"
#include "test/core/end2end/cq_verifier.h"
-#define MAX_PING_STRIKES 1
+#define MAX_PING_STRIKES 2
static void* tag(intptr_t t) { return (void*)t; }
@@ -62,6 +62,7 @@ static void end_test(grpc_end2end_test_fixture* f) {
grpc_completion_queue_destroy(f->shutdown_cq);
}
+// Send more pings than server allows to trigger server's GOAWAY.
static void test_bad_ping(grpc_end2end_test_config config) {
grpc_end2end_test_fixture f = config.create_fixture(nullptr, nullptr);
cq_verifier* cqv = cq_verifier_create(f.cq);
@@ -107,11 +108,9 @@ static void test_bad_ping(grpc_end2end_test_config config) {
grpc_slice details;
int was_cancelled = 2;
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -155,14 +154,15 @@ static void test_bad_ping(grpc_end2end_test_config config) {
cq_verify(cqv);
// Send too many pings to the server to trigger the punishment:
- // Each ping will trigger a ping strike, and we need at least MAX_PING_STRIKES
- // strikes to trigger the punishment. So (MAX_PING_STRIKES + 1) pings are
+ // The first ping will let server mark its last_recv time. Afterwards, each
+ // ping will trigger a ping strike, and we need at least MAX_PING_STRIKES
+ // strikes to trigger the punishment. So (MAX_PING_STRIKES + 2) pings are
// needed here.
int i;
- for (i = 1; i <= MAX_PING_STRIKES + 1; i++) {
+ for (i = 1; i <= MAX_PING_STRIKES + 2; i++) {
grpc_channel_ping(f.client, f.cq, tag(200 + i), nullptr);
CQ_EXPECT_COMPLETION(cqv, tag(200 + i), 1);
- if (i == MAX_PING_STRIKES + 1) {
+ if (i == MAX_PING_STRIKES + 2) {
CQ_EXPECT_COMPLETION(cqv, tag(1), 1);
}
cq_verify(cqv);
@@ -205,8 +205,6 @@ static void test_bad_ping(grpc_end2end_test_config config) {
// the in-progress RPC should fail.
GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE);
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(was_cancelled == 1);
grpc_slice_unref(details);
@@ -220,9 +218,171 @@ static void test_bad_ping(grpc_end2end_test_config config) {
config.tear_down_data(&f);
}
+// Try sending more pings than server allows, but server should be fine because
+// max_pings_without_data should limit pings sent out on wire.
+static void test_pings_without_data(grpc_end2end_test_config config) {
+ grpc_end2end_test_fixture f = config.create_fixture(nullptr, nullptr);
+ cq_verifier* cqv = cq_verifier_create(f.cq);
+ grpc_arg client_a[3];
+ client_a[0].type = GRPC_ARG_INTEGER;
+ client_a[0].key =
+ const_cast<char*>(GRPC_ARG_HTTP2_MIN_SENT_PING_INTERVAL_WITHOUT_DATA_MS);
+ client_a[0].value.integer = 10;
+ // Only allow MAX_PING_STRIKES pings without data (DATA/HEADERS/WINDOW_UPDATE)
+ // so that the transport will throttle the excess pings.
+ client_a[1].type = GRPC_ARG_INTEGER;
+ client_a[1].key = const_cast<char*>(GRPC_ARG_HTTP2_MAX_PINGS_WITHOUT_DATA);
+ client_a[1].value.integer = MAX_PING_STRIKES;
+ client_a[2].type = GRPC_ARG_INTEGER;
+ client_a[2].key = const_cast<char*>(GRPC_ARG_HTTP2_BDP_PROBE);
+ client_a[2].value.integer = 0;
+ grpc_arg server_a[3];
+ server_a[0].type = GRPC_ARG_INTEGER;
+ server_a[0].key =
+ const_cast<char*>(GRPC_ARG_HTTP2_MIN_RECV_PING_INTERVAL_WITHOUT_DATA_MS);
+ server_a[0].value.integer = 300000 /* 5 minutes */;
+ server_a[1].type = GRPC_ARG_INTEGER;
+ server_a[1].key = const_cast<char*>(GRPC_ARG_HTTP2_MAX_PING_STRIKES);
+ server_a[1].value.integer = MAX_PING_STRIKES;
+ server_a[2].type = GRPC_ARG_INTEGER;
+ server_a[2].key = const_cast<char*>(GRPC_ARG_HTTP2_BDP_PROBE);
+ server_a[2].value.integer = 0;
+ grpc_channel_args client_args = {GPR_ARRAY_SIZE(client_a), client_a};
+ grpc_channel_args server_args = {GPR_ARRAY_SIZE(server_a), server_a};
+
+ config.init_client(&f, &client_args);
+ config.init_server(&f, &server_args);
+
+ grpc_call* c;
+ grpc_call* s;
+ gpr_timespec deadline = grpc_timeout_seconds_to_deadline(10);
+ grpc_op ops[6];
+ grpc_op* op;
+ grpc_metadata_array initial_metadata_recv;
+ grpc_metadata_array trailing_metadata_recv;
+ grpc_metadata_array request_metadata_recv;
+ grpc_call_details call_details;
+ grpc_status_code status;
+ grpc_call_error error;
+ grpc_slice details;
+ int was_cancelled = 2;
+
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
+ GPR_ASSERT(c);
+
+ grpc_metadata_array_init(&initial_metadata_recv);
+ grpc_metadata_array_init(&trailing_metadata_recv);
+ grpc_metadata_array_init(&request_metadata_recv);
+ grpc_call_details_init(&call_details);
+
+ memset(ops, 0, sizeof(ops));
+ op = ops;
+ op->op = GRPC_OP_SEND_INITIAL_METADATA;
+ op->data.send_initial_metadata.count = 0;
+ op->data.send_initial_metadata.metadata = nullptr;
+ op->flags = 0;
+ op->reserved = nullptr;
+ op++;
+ op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
+ op->flags = 0;
+ op->reserved = nullptr;
+ op++;
+ op->op = GRPC_OP_RECV_INITIAL_METADATA;
+ op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv;
+ op->flags = 0;
+ op->reserved = nullptr;
+ op++;
+ op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
+ op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
+ op->data.recv_status_on_client.status = &status;
+ op->data.recv_status_on_client.status_details = &details;
+ op->flags = 0;
+ op->reserved = nullptr;
+ op++;
+ error = grpc_call_start_batch(c, ops, static_cast<size_t>(op - ops), tag(1),
+ nullptr);
+ GPR_ASSERT(GRPC_CALL_OK == error);
+
+ error =
+ grpc_server_request_call(f.server, &s, &call_details,
+ &request_metadata_recv, f.cq, f.cq, tag(101));
+ GPR_ASSERT(GRPC_CALL_OK == error);
+ CQ_EXPECT_COMPLETION(cqv, tag(101), 1);
+ cq_verify(cqv);
+
+ // Send too many pings to the server similar to the prevous test case.
+ // However, since we set the MAX_PINGS_WITHOUT_DATA at the client side, only
+ // MAX_PING_STRIKES will actually be sent and the rpc will still succeed.
+ int i;
+ for (i = 1; i <= MAX_PING_STRIKES + 2; i++) {
+ grpc_channel_ping(f.client, f.cq, tag(200 + i), nullptr);
+ if (i <= MAX_PING_STRIKES) {
+ CQ_EXPECT_COMPLETION(cqv, tag(200 + i), 1);
+ }
+ cq_verify(cqv);
+ }
+
+ memset(ops, 0, sizeof(ops));
+ op = ops;
+ op->op = GRPC_OP_SEND_INITIAL_METADATA;
+ op->data.send_initial_metadata.count = 0;
+ op->flags = 0;
+ op->reserved = nullptr;
+ op++;
+ op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
+ op->data.send_status_from_server.trailing_metadata_count = 0;
+ op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED;
+ grpc_slice status_details = grpc_slice_from_static_string("xyz");
+ op->data.send_status_from_server.status_details = &status_details;
+ op->flags = 0;
+ op->reserved = nullptr;
+ op++;
+ op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
+ op->data.recv_close_on_server.cancelled = &was_cancelled;
+ op->flags = 0;
+ op->reserved = nullptr;
+ op++;
+ error = grpc_call_start_batch(s, ops, static_cast<size_t>(op - ops), tag(102),
+ nullptr);
+ GPR_ASSERT(GRPC_CALL_OK == error);
+
+ CQ_EXPECT_COMPLETION(cqv, tag(102), 1);
+ // Client call should return.
+ CQ_EXPECT_COMPLETION(cqv, tag(1), 1);
+ cq_verify(cqv);
+
+ grpc_server_shutdown_and_notify(f.server, f.cq, tag(0xdead));
+ CQ_EXPECT_COMPLETION(cqv, tag(0xdead), 1);
+
+ // Also expect the previously blocked pings to complete with an error
+ CQ_EXPECT_COMPLETION(cqv, tag(200 + MAX_PING_STRIKES + 1), 0);
+ CQ_EXPECT_COMPLETION(cqv, tag(200 + MAX_PING_STRIKES + 2), 0);
+
+ cq_verify(cqv);
+
+ grpc_call_unref(s);
+
+ // The rpc should be successful.
+ GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED);
+ GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
+
+ grpc_slice_unref(details);
+ grpc_metadata_array_destroy(&initial_metadata_recv);
+ grpc_metadata_array_destroy(&trailing_metadata_recv);
+ grpc_metadata_array_destroy(&request_metadata_recv);
+ grpc_call_details_destroy(&call_details);
+ grpc_call_unref(c);
+ cq_verifier_destroy(cqv);
+ end_test(&f);
+ config.tear_down_data(&f);
+}
+
void bad_ping(grpc_end2end_test_config config) {
GPR_ASSERT(config.feature_mask & FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION);
test_bad_ping(config);
+ test_pings_without_data(config);
}
void bad_ping_pre_init(void) {}
diff --git a/test/core/end2end/tests/binary_metadata.cc b/test/core/end2end/tests/binary_metadata.cc
index e66b4da6cc..cdf5b1eb94 100644
--- a/test/core/end2end/tests/binary_metadata.cc
+++ b/test/core/end2end/tests/binary_metadata.cc
@@ -136,11 +136,9 @@ static void test_request_response_with_metadata_and_payload(
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -278,8 +276,6 @@ static void test_request_response_with_metadata_and_payload(
"\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0"
"\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(was_cancelled == 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.cc b/test/core/end2end/tests/call_creds.cc
index e9cbaa3088..ead6ecb1f7 100644
--- a/test/core/end2end/tests/call_creds.cc
+++ b/test/core/end2end/tests/call_creds.cc
@@ -156,11 +156,9 @@ static void request_response_with_payload_and_call_creds(
cqv = cq_verifier_create(f.cq);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
creds = grpc_google_iam_credentials_create(iam_token, iam_selector, nullptr);
GPR_ASSERT(creds != nullptr);
@@ -292,8 +290,6 @@ static void request_response_with_payload_and_call_creds(
GPR_ASSERT(status == GRPC_STATUS_OK);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(was_cancelled == 0);
GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world"));
GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you"));
@@ -396,11 +392,9 @@ 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, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
creds = grpc_google_iam_credentials_create(iam_token, iam_selector, nullptr);
diff --git a/test/core/end2end/tests/call_host_override.cc b/test/core/end2end/tests/call_host_override.cc
new file mode 100644
index 0000000000..251dc6d045
--- /dev/null
+++ b/test/core/end2end/tests/call_host_override.cc
@@ -0,0 +1,230 @@
+/*
+ *
+ * Copyright 2015 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "test/core/end2end/end2end_tests.h"
+
+#include <stdio.h>
+#include <string.h>
+
+#include <grpc/byte_buffer.h>
+#include <grpc/grpc.h>
+#include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
+#include <grpc/support/time.h>
+
+#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/gpr/string.h"
+#include "test/core/end2end/cq_verifier.h"
+
+static void* tag(intptr_t t) { return (void*)t; }
+
+static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
+ const char* test_name,
+ grpc_channel_args* client_args,
+ grpc_channel_args* server_args) {
+ grpc_end2end_test_fixture f;
+ gpr_log(GPR_INFO, "Running test: %s/%s", test_name, config.name);
+ f = config.create_fixture(client_args, server_args);
+ grpc_arg fake_security_name_override = {
+ GRPC_ARG_STRING,
+ const_cast<char*>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG),
+ {const_cast<char*>("foo.test.google.fr:1234")}};
+ grpc_channel_args* new_client_args = grpc_channel_args_copy_and_add(
+ client_args, &fake_security_name_override, 1);
+ config.init_client(&f, new_client_args);
+ grpc_channel_args_destroy(new_client_args);
+ config.init_server(&f, server_args);
+ return f;
+}
+
+static gpr_timespec n_seconds_from_now(int n) {
+ return grpc_timeout_seconds_to_deadline(n);
+}
+
+static gpr_timespec five_seconds_from_now(void) {
+ return n_seconds_from_now(5);
+}
+
+static void drain_cq(grpc_completion_queue* cq) {
+ grpc_event ev;
+ do {
+ ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr);
+ } while (ev.type != GRPC_QUEUE_SHUTDOWN);
+}
+
+static void shutdown_server(grpc_end2end_test_fixture* f) {
+ if (!f->server) return;
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ nullptr)
+ .type == GRPC_OP_COMPLETE);
+ grpc_server_destroy(f->server);
+ f->server = nullptr;
+}
+
+static void shutdown_client(grpc_end2end_test_fixture* f) {
+ if (!f->client) return;
+ grpc_channel_destroy(f->client);
+ f->client = nullptr;
+}
+
+static void end_test(grpc_end2end_test_fixture* f) {
+ shutdown_server(f);
+ shutdown_client(f);
+
+ grpc_completion_queue_shutdown(f->cq);
+ drain_cq(f->cq);
+ grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
+}
+
+static void test_invoke_simple_request(grpc_end2end_test_config config) {
+ grpc_end2end_test_fixture f =
+ begin_test(config, "test_invoke_simple_request", nullptr, nullptr);
+ grpc_call* c;
+ grpc_call* s;
+ cq_verifier* cqv = cq_verifier_create(f.cq);
+ grpc_op ops[6];
+ grpc_op* op;
+ grpc_metadata_array initial_metadata_recv;
+ grpc_metadata_array trailing_metadata_recv;
+ grpc_metadata_array request_metadata_recv;
+ grpc_call_details call_details;
+ grpc_status_code status;
+ grpc_call_error error;
+ grpc_slice details;
+ int was_cancelled = 2;
+ char* peer;
+
+ gpr_timespec deadline = five_seconds_from_now();
+ c = grpc_channel_create_call(
+ f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"),
+ get_host_override_slice("foo.test.google.fr:1234", config), deadline,
+ nullptr);
+ GPR_ASSERT(c);
+
+ peer = grpc_call_get_peer(c);
+ GPR_ASSERT(peer != nullptr);
+ gpr_log(GPR_DEBUG, "client_peer_before_call=%s", peer);
+ gpr_free(peer);
+
+ grpc_metadata_array_init(&initial_metadata_recv);
+ grpc_metadata_array_init(&trailing_metadata_recv);
+ grpc_metadata_array_init(&request_metadata_recv);
+ grpc_call_details_init(&call_details);
+
+ memset(ops, 0, sizeof(ops));
+ op = ops;
+ op->op = GRPC_OP_SEND_INITIAL_METADATA;
+ op->data.send_initial_metadata.count = 0;
+ op->flags = 0;
+ op->reserved = nullptr;
+ op++;
+ op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
+ op->flags = 0;
+ op->reserved = nullptr;
+ op++;
+ op->op = GRPC_OP_RECV_INITIAL_METADATA;
+ op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv;
+ op->flags = 0;
+ op->reserved = nullptr;
+ op++;
+ op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
+ op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
+ op->data.recv_status_on_client.status = &status;
+ op->data.recv_status_on_client.status_details = &details;
+ op->flags = 0;
+ op->reserved = nullptr;
+ op++;
+ error = grpc_call_start_batch(c, ops, static_cast<size_t>(op - ops), tag(1),
+ nullptr);
+ GPR_ASSERT(error == GRPC_CALL_OK);
+
+ error =
+ grpc_server_request_call(f.server, &s, &call_details,
+ &request_metadata_recv, f.cq, f.cq, tag(101));
+ GPR_ASSERT(error == GRPC_CALL_OK);
+ CQ_EXPECT_COMPLETION(cqv, tag(101), 1);
+ cq_verify(cqv);
+
+ peer = grpc_call_get_peer(s);
+ GPR_ASSERT(peer != nullptr);
+ gpr_log(GPR_DEBUG, "server_peer=%s", peer);
+ gpr_free(peer);
+ peer = grpc_call_get_peer(c);
+ GPR_ASSERT(peer != nullptr);
+ gpr_log(GPR_DEBUG, "client_peer=%s", peer);
+ gpr_free(peer);
+
+ memset(ops, 0, sizeof(ops));
+ op = ops;
+ op->op = GRPC_OP_SEND_INITIAL_METADATA;
+ op->data.send_initial_metadata.count = 0;
+ op->flags = 0;
+ op->reserved = nullptr;
+ op++;
+ op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
+ op->data.send_status_from_server.trailing_metadata_count = 0;
+ op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED;
+ grpc_slice status_details = grpc_slice_from_static_string("xyz");
+ op->data.send_status_from_server.status_details = &status_details;
+ op->flags = 0;
+ op->reserved = nullptr;
+ op++;
+ op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
+ op->data.recv_close_on_server.cancelled = &was_cancelled;
+ op->flags = 0;
+ op->reserved = nullptr;
+ op++;
+ error = grpc_call_start_batch(s, ops, static_cast<size_t>(op - ops), tag(102),
+ nullptr);
+ GPR_ASSERT(error == GRPC_CALL_OK);
+
+ CQ_EXPECT_COMPLETION(cqv, tag(102), 1);
+ CQ_EXPECT_COMPLETION(cqv, tag(1), 1);
+ cq_verify(cqv);
+
+ GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED);
+ GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
+ GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
+ validate_host_override_string("foo.test.google.fr:1234", call_details.host,
+ config);
+ GPR_ASSERT(was_cancelled == 1);
+
+ grpc_slice_unref(details);
+ grpc_metadata_array_destroy(&initial_metadata_recv);
+ grpc_metadata_array_destroy(&trailing_metadata_recv);
+ grpc_metadata_array_destroy(&request_metadata_recv);
+ grpc_call_details_destroy(&call_details);
+
+ grpc_call_unref(c);
+ grpc_call_unref(s);
+
+ cq_verifier_destroy(cqv);
+
+ end_test(&f);
+ config.tear_down_data(&f);
+}
+
+void call_host_override(grpc_end2end_test_config config) {
+ test_invoke_simple_request(config);
+}
+
+void call_host_override_pre_init(void) {}
diff --git a/test/core/end2end/tests/cancel_after_accept.cc b/test/core/end2end/tests/cancel_after_accept.cc
index ee1a0bbccc..788d374baa 100644
--- a/test/core/end2end/tests/cancel_after_accept.cc
+++ b/test/core/end2end/tests/cancel_after_accept.cc
@@ -27,6 +27,7 @@
#include <grpc/support/time.h>
#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/transport/metadata.h"
#include "src/core/lib/transport/service_config.h"
@@ -145,11 +146,9 @@ static void test_cancel_after_accept(grpc_end2end_test_config config,
gpr_timespec deadline = use_service_config
? gpr_inf_future(GPR_CLOCK_MONOTONIC)
: five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/service/method"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/service/method"),
+ nullptr, deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
diff --git a/test/core/end2end/tests/cancel_after_client_done.cc b/test/core/end2end/tests/cancel_after_client_done.cc
index 31c3ea6f74..6e9378378e 100644
--- a/test/core/end2end/tests/cancel_after_client_done.cc
+++ b/test/core/end2end/tests/cancel_after_client_done.cc
@@ -119,11 +119,9 @@ static void test_cancel_after_accept_and_writes_closed(
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
diff --git a/test/core/end2end/tests/cancel_after_invoke.cc b/test/core/end2end/tests/cancel_after_invoke.cc
index a3e36e0e3f..78009eb3bb 100644
--- a/test/core/end2end/tests/cancel_after_invoke.cc
+++ b/test/core/end2end/tests/cancel_after_invoke.cc
@@ -18,6 +18,7 @@
#include "test/core/end2end/end2end_tests.h"
+#include <inttypes.h>
#include <stdio.h>
#include <string.h>
@@ -112,11 +113,9 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config,
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
diff --git a/test/core/end2end/tests/cancel_after_round_trip.cc b/test/core/end2end/tests/cancel_after_round_trip.cc
index bf3be1c8b7..061b273f18 100644
--- a/test/core/end2end/tests/cancel_after_round_trip.cc
+++ b/test/core/end2end/tests/cancel_after_round_trip.cc
@@ -27,6 +27,7 @@
#include <grpc/support/time.h>
#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/transport/metadata.h"
#include "src/core/lib/transport/service_config.h"
@@ -147,11 +148,9 @@ static void test_cancel_after_round_trip(grpc_end2end_test_config config,
gpr_timespec deadline = use_service_config
? gpr_inf_future(GPR_CLOCK_MONOTONIC)
: five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/service/method"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/service/method"),
+ nullptr, deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
diff --git a/test/core/end2end/tests/cancel_before_invoke.cc b/test/core/end2end/tests/cancel_before_invoke.cc
index e9fa0466fb..abb2dbc8c3 100644
--- a/test/core/end2end/tests/cancel_before_invoke.cc
+++ b/test/core/end2end/tests/cancel_before_invoke.cc
@@ -18,6 +18,7 @@
#include "test/core/end2end/end2end_tests.h"
+#include <inttypes.h>
#include <stdio.h>
#include <string.h>
@@ -108,11 +109,9 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config,
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
GPR_ASSERT(GRPC_CALL_OK == grpc_call_cancel(c, nullptr));
diff --git a/test/core/end2end/tests/cancel_in_a_vacuum.cc b/test/core/end2end/tests/cancel_in_a_vacuum.cc
index 6be2d69095..4672e64a4e 100644
--- a/test/core/end2end/tests/cancel_in_a_vacuum.cc
+++ b/test/core/end2end/tests/cancel_in_a_vacuum.cc
@@ -97,11 +97,9 @@ static void test_cancel_in_a_vacuum(grpc_end2end_test_config config,
cq_verifier* v_client = cq_verifier_create(f.cq);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, nullptr));
diff --git a/test/core/end2end/tests/cancel_with_status.cc b/test/core/end2end/tests/cancel_with_status.cc
index 6820ba5a2f..2fc9d2ff27 100644
--- a/test/core/end2end/tests/cancel_with_status.cc
+++ b/test/core/end2end/tests/cancel_with_status.cc
@@ -18,6 +18,7 @@
#include "test/core/end2end/end2end_tests.h"
+#include <inttypes.h>
#include <stdio.h>
#include <string.h>
@@ -103,11 +104,9 @@ static void simple_request_body(grpc_end2end_test_config config,
gpr_log(GPR_DEBUG, "test with %" PRIuPTR " ops", num_ops);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
diff --git a/test/core/end2end/tests/compressed_payload.cc b/test/core/end2end/tests/compressed_payload.cc
index 85cfe16508..178d68c608 100644
--- a/test/core/end2end/tests/compressed_payload.cc
+++ b/test/core/end2end/tests/compressed_payload.cc
@@ -137,11 +137,9 @@ static void request_for_disabled_algorithm(
cqv = cq_verifier_create(f.cq);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -239,8 +237,6 @@ static void request_for_disabled_algorithm(
GPR_ASSERT(0 == grpc_slice_str_cmp(details, expected_details));
gpr_free(expected_details);
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
grpc_slice_unref(details);
grpc_metadata_array_destroy(&initial_metadata_recv);
@@ -320,11 +316,9 @@ static void request_with_payload_template(
cqv = cq_verifier_create(f.cq);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -529,8 +523,6 @@ static void request_with_payload_template(
GPR_ASSERT(status == GRPC_STATUS_OK);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(was_cancelled == 0);
grpc_slice_unref(details);
diff --git a/test/core/end2end/tests/default_host.cc b/test/core/end2end/tests/default_host.cc
index 3191f76688..22c3102d1a 100644
--- a/test/core/end2end/tests/default_host.cc
+++ b/test/core/end2end/tests/default_host.cc
@@ -85,7 +85,9 @@ static void end_test(grpc_end2end_test_fixture* f) {
grpc_completion_queue_destroy(f->shutdown_cq);
}
-static void simple_request_body(grpc_end2end_test_fixture f) {
+static void test_invoke_simple_request(grpc_end2end_test_config config) {
+ grpc_end2end_test_fixture f =
+ begin_test(config, "test_invoke_simple_request", nullptr, nullptr);
grpc_call* c;
grpc_call* s;
cq_verifier* cqv = cq_verifier_create(f.cq);
@@ -191,7 +193,14 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- GPR_ASSERT(grpc_slice_buf_start_eq(call_details.host, "localhost", 9));
+
+ if (config.overridden_call_host != nullptr) {
+ validate_host_override_string(config.overridden_call_host,
+ call_details.host, config);
+ } else {
+ GPR_ASSERT(grpc_slice_buf_start_eq(call_details.host, "localhost", 9) ||
+ grpc_slice_buf_start_eq(call_details.host, "127.0.0.1", 9));
+ }
GPR_ASSERT(was_cancelled == 1);
grpc_slice_unref(details);
@@ -204,22 +213,12 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
grpc_call_unref(s);
cq_verifier_destroy(cqv);
-}
-
-static void test_invoke_simple_request(grpc_end2end_test_config config) {
- grpc_end2end_test_fixture f;
- f = begin_test(config, "test_invoke_simple_request", nullptr, nullptr);
- simple_request_body(f);
end_test(&f);
config.tear_down_data(&f);
}
void default_host(grpc_end2end_test_config config) {
- if ((config.feature_mask & FEATURE_MASK_SUPPORTS_HOSTNAME_VERIFICATION) == 0)
- return;
- if ((config.feature_mask & FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION) == 0)
- return;
test_invoke_simple_request(config);
}
diff --git a/test/core/end2end/tests/disappearing_server.cc b/test/core/end2end/tests/disappearing_server.cc
index d5b6f8fbf0..fdd780f117 100644
--- a/test/core/end2end/tests/disappearing_server.cc
+++ b/test/core/end2end/tests/disappearing_server.cc
@@ -85,11 +85,9 @@ static void do_request_and_shutdown_server(grpc_end2end_test_config config,
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f->client, nullptr, GRPC_PROPAGATE_DEFAULTS, f->cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f->client, nullptr, GRPC_PROPAGATE_DEFAULTS,
+ f->cq, grpc_slice_from_static_string("/foo"),
+ nullptr, deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -167,8 +165,6 @@ static void do_request_and_shutdown_server(grpc_end2end_test_config config,
GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(was_cancelled == 1);
grpc_slice_unref(details);
diff --git a/test/core/end2end/tests/empty_batch.cc b/test/core/end2end/tests/empty_batch.cc
index 1de4b8fda8..317bb7aeb0 100644
--- a/test/core/end2end/tests/empty_batch.cc
+++ b/test/core/end2end/tests/empty_batch.cc
@@ -93,11 +93,9 @@ static void empty_batch_body(grpc_end2end_test_config config,
grpc_op* op = nullptr;
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
error = grpc_call_start_batch(c, op, 0, tag(1), nullptr);
diff --git a/test/core/end2end/tests/filter_call_init_fails.cc b/test/core/end2end/tests/filter_call_init_fails.cc
index 6f72a1843a..ab96879fe4 100644
--- a/test/core/end2end/tests/filter_call_init_fails.cc
+++ b/test/core/end2end/tests/filter_call_init_fails.cc
@@ -117,11 +117,9 @@ static void test_server_channel_filter(grpc_end2end_test_config config) {
grpc_slice details;
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -213,11 +211,9 @@ static void test_client_channel_filter(grpc_end2end_test_config config) {
grpc_call_error error;
grpc_slice details;
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -304,11 +300,9 @@ static void test_client_subchannel_filter(grpc_end2end_test_config config) {
grpc_call_error error;
grpc_slice details;
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -364,11 +358,9 @@ static void test_client_subchannel_filter(grpc_end2end_test_config config) {
grpc_slice_unref(details);
details = grpc_empty_slice();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
error = grpc_call_start_batch(c, ops, static_cast<size_t>(op - ops), tag(2),
diff --git a/test/core/end2end/tests/filter_causes_close.cc b/test/core/end2end/tests/filter_causes_close.cc
index bc4cb8633d..a7f4268803 100644
--- a/test/core/end2end/tests/filter_causes_close.cc
+++ b/test/core/end2end/tests/filter_causes_close.cc
@@ -111,11 +111,9 @@ static void test_request(grpc_end2end_test_config config) {
grpc_slice details;
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
diff --git a/test/core/end2end/tests/filter_latency.cc b/test/core/end2end/tests/filter_latency.cc
index 51f54c9742..a89db7b094 100644
--- a/test/core/end2end/tests/filter_latency.cc
+++ b/test/core/end2end/tests/filter_latency.cc
@@ -125,10 +125,9 @@ static void test_request(grpc_end2end_test_config config) {
const gpr_timespec start_time = gpr_now(GPR_CLOCK_MONOTONIC);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr", config), deadline, nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
diff --git a/test/core/end2end/tests/filter_status_code.cc b/test/core/end2end/tests/filter_status_code.cc
index 32cd95410e..ba3cbfa6d1 100644
--- a/test/core/end2end/tests/filter_status_code.cc
+++ b/test/core/end2end/tests/filter_status_code.cc
@@ -126,10 +126,9 @@ static void test_request(grpc_end2end_test_config config) {
gpr_mu_unlock(&g_mu);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr", config), deadline, nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
gpr_mu_lock(&g_mu);
g_client_call_stack = grpc_call_get_call_stack(c);
diff --git a/test/core/end2end/tests/graceful_server_shutdown.cc b/test/core/end2end/tests/graceful_server_shutdown.cc
index 3ef414f83c..42f2d1a414 100644
--- a/test/core/end2end/tests/graceful_server_shutdown.cc
+++ b/test/core/end2end/tests/graceful_server_shutdown.cc
@@ -99,11 +99,9 @@ static void test_early_server_shutdown_finishes_inflight_calls(
int was_cancelled = 2;
gpr_timespec deadline = n_seconds_from_now(10);
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -183,8 +181,6 @@ static void test_early_server_shutdown_finishes_inflight_calls(
GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED);
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(was_cancelled == 1);
grpc_slice_unref(details);
diff --git a/test/core/end2end/tests/high_initial_seqno.cc b/test/core/end2end/tests/high_initial_seqno.cc
index 8767437802..18e6ee90ef 100644
--- a/test/core/end2end/tests/high_initial_seqno.cc
+++ b/test/core/end2end/tests/high_initial_seqno.cc
@@ -104,11 +104,9 @@ static void simple_request_body(grpc_end2end_test_config config,
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -181,8 +179,6 @@ static void simple_request_body(grpc_end2end_test_config config,
GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(was_cancelled == 1);
grpc_slice_unref(details);
diff --git a/test/core/end2end/tests/hpack_size.cc b/test/core/end2end/tests/hpack_size.cc
index b49736841e..7c51294e1c 100644
--- a/test/core/end2end/tests/hpack_size.cc
+++ b/test/core/end2end/tests/hpack_size.cc
@@ -257,11 +257,9 @@ static void simple_request_body(grpc_end2end_test_config config,
grpc_slice_from_static_string(dragons[index % GPR_ARRAY_SIZE(dragons)]);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -335,8 +333,6 @@ static void simple_request_body(grpc_end2end_test_config config,
GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(was_cancelled == 1);
grpc_slice_unref(details);
diff --git a/test/core/end2end/tests/idempotent_request.cc b/test/core/end2end/tests/idempotent_request.cc
index 56be2d6afe..80908d5210 100644
--- a/test/core/end2end/tests/idempotent_request.cc
+++ b/test/core/end2end/tests/idempotent_request.cc
@@ -104,11 +104,9 @@ static void simple_request_body(grpc_end2end_test_config config,
char* peer;
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
peer = grpc_call_get_peer(c);
@@ -195,8 +193,6 @@ static void simple_request_body(grpc_end2end_test_config config,
GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST == call_details.flags);
GPR_ASSERT(was_cancelled == 1);
diff --git a/test/core/end2end/tests/invoke_large_request.cc b/test/core/end2end/tests/invoke_large_request.cc
index 1aab34c2ce..39d90ab64d 100644
--- a/test/core/end2end/tests/invoke_large_request.cc
+++ b/test/core/end2end/tests/invoke_large_request.cc
@@ -131,11 +131,9 @@ static void test_invoke_large_request(grpc_end2end_test_config config,
int was_cancelled = 2;
gpr_timespec deadline = n_seconds_from_now(30);
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -237,8 +235,6 @@ static void test_invoke_large_request(grpc_end2end_test_config config,
GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(was_cancelled == 1);
grpc_slice_unref(details);
diff --git a/test/core/end2end/tests/keepalive_timeout.cc b/test/core/end2end/tests/keepalive_timeout.cc
index f0dd061e33..1ee5285027 100644
--- a/test/core/end2end/tests/keepalive_timeout.cc
+++ b/test/core/end2end/tests/keepalive_timeout.cc
@@ -102,7 +102,7 @@ static void test_keepalive_timeout(grpc_end2end_test_config config) {
grpc_arg keepalive_arg_elems[3];
keepalive_arg_elems[0].type = GRPC_ARG_INTEGER;
keepalive_arg_elems[0].key = const_cast<char*>(GRPC_ARG_KEEPALIVE_TIME_MS);
- keepalive_arg_elems[0].value.integer = 1500;
+ keepalive_arg_elems[0].value.integer = 3500;
keepalive_arg_elems[1].type = GRPC_ARG_INTEGER;
keepalive_arg_elems[1].key = const_cast<char*>(GRPC_ARG_KEEPALIVE_TIMEOUT_MS);
keepalive_arg_elems[1].value.integer = 0;
@@ -130,11 +130,9 @@ static void test_keepalive_timeout(grpc_end2end_test_config config) {
grpc_set_disable_ping_ack(true);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -200,8 +198,6 @@ static void test_keepalive_timeout(grpc_end2end_test_config config) {
GPR_ASSERT(status == GRPC_STATUS_INTERNAL);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "keepalive watchdog timeout"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
gpr_free(details_str);
gpr_free(method_str);
diff --git a/test/core/end2end/tests/large_metadata.cc b/test/core/end2end/tests/large_metadata.cc
index da0615bf6e..c7f72a1cab 100644
--- a/test/core/end2end/tests/large_metadata.cc
+++ b/test/core/end2end/tests/large_metadata.cc
@@ -114,11 +114,9 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) {
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
meta.key = grpc_slice_from_static_string("key");
@@ -220,8 +218,6 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) {
GPR_ASSERT(status == GRPC_STATUS_OK);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(was_cancelled == 0);
GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world"));
GPR_ASSERT(contains_metadata_slices(&request_metadata_recv,
diff --git a/test/core/end2end/tests/load_reporting_hook.cc b/test/core/end2end/tests/load_reporting_hook.cc
index 9e79d02be4..4324e9dfc1 100644
--- a/test/core/end2end/tests/load_reporting_hook.cc
+++ b/test/core/end2end/tests/load_reporting_hook.cc
@@ -138,11 +138,9 @@ static void request_response_with_payload(
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string(method_name),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string(method_name),
+ nullptr, deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
diff --git a/test/core/end2end/tests/max_concurrent_streams.cc b/test/core/end2end/tests/max_concurrent_streams.cc
index 789b3d4b77..86a8d22443 100644
--- a/test/core/end2end/tests/max_concurrent_streams.cc
+++ b/test/core/end2end/tests/max_concurrent_streams.cc
@@ -100,11 +100,9 @@ static void simple_request_body(grpc_end2end_test_config config,
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -177,8 +175,6 @@ static void simple_request_body(grpc_end2end_test_config config,
GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(was_cancelled == 1);
grpc_slice_unref(details);
@@ -248,17 +244,13 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
/* start two requests - ensuring that the second is not accepted until
the first completes */
deadline = n_seconds_from_now(1000);
- c1 = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/alpha"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c1 = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS,
+ f.cq, grpc_slice_from_static_string("/alpha"),
+ nullptr, deadline, nullptr);
GPR_ASSERT(c1);
- c2 = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/beta"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c2 = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS,
+ f.cq, grpc_slice_from_static_string("/beta"),
+ nullptr, deadline, nullptr);
GPR_ASSERT(c2);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
@@ -494,17 +486,13 @@ static void test_max_concurrent_streams_with_timeout_on_first(
/* start two requests - ensuring that the second is not accepted until
the first completes */
- c1 = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/alpha"),
- get_host_override_slice("foo.test.google.fr:1234", config),
- n_seconds_from_now(3), nullptr);
+ c1 = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS,
+ f.cq, grpc_slice_from_static_string("/alpha"),
+ nullptr, n_seconds_from_now(3), nullptr);
GPR_ASSERT(c1);
- c2 = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/beta"),
- get_host_override_slice("foo.test.google.fr:1234", config),
- n_seconds_from_now(1000), nullptr);
+ c2 = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS,
+ f.cq, grpc_slice_from_static_string("/beta"),
+ nullptr, n_seconds_from_now(1000), nullptr);
GPR_ASSERT(c2);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
@@ -694,17 +682,13 @@ static void test_max_concurrent_streams_with_timeout_on_second(
/* start two requests - ensuring that the second is not accepted until
the first completes , and the second request will timeout in the
concurrent_list */
- c1 = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/alpha"),
- get_host_override_slice("foo.test.google.fr:1234", config),
- n_seconds_from_now(1000), nullptr);
+ c1 = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS,
+ f.cq, grpc_slice_from_static_string("/alpha"),
+ nullptr, n_seconds_from_now(1000), nullptr);
GPR_ASSERT(c1);
- c2 = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/beta"),
- get_host_override_slice("foo.test.google.fr:1234", config),
- n_seconds_from_now(3), nullptr);
+ c2 = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS,
+ f.cq, grpc_slice_from_static_string("/beta"),
+ nullptr, n_seconds_from_now(3), nullptr);
GPR_ASSERT(c2);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
diff --git a/test/core/end2end/tests/max_connection_age.cc b/test/core/end2end/tests/max_connection_age.cc
index e494dad19c..fcb0aaffc4 100644
--- a/test/core/end2end/tests/max_connection_age.cc
+++ b/test/core/end2end/tests/max_connection_age.cc
@@ -109,11 +109,9 @@ static void test_max_age_forcibly_close(grpc_end2end_test_config config) {
grpc_slice details;
int was_cancelled = 2;
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -208,8 +206,6 @@ static void test_max_age_forcibly_close(grpc_end2end_test_config config) {
the in-progress RPC should fail. */
GPR_ASSERT(status == GRPC_STATUS_INTERNAL);
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(was_cancelled == 1);
grpc_slice_unref(details);
@@ -255,11 +251,9 @@ static void test_max_age_gracefully_close(grpc_end2end_test_config config) {
grpc_slice details;
int was_cancelled = 2;
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -348,8 +342,6 @@ static void test_max_age_gracefully_close(grpc_end2end_test_config config) {
GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(was_cancelled == 1);
grpc_slice_unref(details);
diff --git a/test/core/end2end/tests/max_connection_idle.cc b/test/core/end2end/tests/max_connection_idle.cc
index 2f212b965f..faa1383207 100644
--- a/test/core/end2end/tests/max_connection_idle.cc
+++ b/test/core/end2end/tests/max_connection_idle.cc
@@ -60,11 +60,9 @@ static void simple_request_body(grpc_end2end_test_config config,
char* peer;
gpr_timespec deadline = grpc_timeout_seconds_to_deadline(5);
- c = grpc_channel_create_call(
- f->client, nullptr, GRPC_PROPAGATE_DEFAULTS, f->cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f->client, nullptr, GRPC_PROPAGATE_DEFAULTS,
+ f->cq, grpc_slice_from_static_string("/foo"),
+ nullptr, deadline, nullptr);
GPR_ASSERT(c);
peer = grpc_call_get_peer(c);
@@ -151,8 +149,6 @@ static void simple_request_body(grpc_end2end_test_config config,
GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(0 == call_details.flags);
GPR_ASSERT(was_cancelled == 1);
diff --git a/test/core/end2end/tests/max_message_length.cc b/test/core/end2end/tests/max_message_length.cc
index 3dd1737793..6ac941e0da 100644
--- a/test/core/end2end/tests/max_message_length.cc
+++ b/test/core/end2end/tests/max_message_length.cc
@@ -27,6 +27,7 @@
#include <grpc/support/time.h>
#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/transport/metadata.h"
#include "src/core/lib/transport/service_config.h"
@@ -179,11 +180,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, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/service/method"),
- get_host_override_slice("foo.test.google.fr:1234", config),
- gpr_inf_future(GPR_CLOCK_REALTIME), nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/service/method"),
+ nullptr, gpr_inf_future(GPR_CLOCK_REALTIME),
+ nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -257,8 +257,6 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config,
cq_verify(cqv);
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(was_cancelled == 1);
done:
@@ -370,11 +368,10 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config,
}
cqv = cq_verifier_create(f.cq);
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/service/method"),
- get_host_override_slice("foo.test.google.fr:1234", config),
- gpr_inf_future(GPR_CLOCK_REALTIME), nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/service/method"),
+ nullptr, gpr_inf_future(GPR_CLOCK_REALTIME),
+ nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -455,9 +452,6 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config,
cq_verify(cqv);
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method"));
- GPR_ASSERT(0 ==
- grpc_slice_str_cmp(call_details.host, "foo.test.google.fr:1234"));
-
GPR_ASSERT(status == GRPC_STATUS_RESOURCE_EXHAUSTED);
GPR_ASSERT(
grpc_slice_str_cmp(
diff --git a/test/core/end2end/tests/negative_deadline.cc b/test/core/end2end/tests/negative_deadline.cc
index b28bee0fb2..2b2ff126c4 100644
--- a/test/core/end2end/tests/negative_deadline.cc
+++ b/test/core/end2end/tests/negative_deadline.cc
@@ -18,6 +18,7 @@
#include "test/core/end2end/end2end_tests.h"
+#include <inttypes.h>
#include <stdio.h>
#include <string.h>
@@ -100,11 +101,9 @@ static void simple_request_body(grpc_end2end_test_config config,
gpr_log(GPR_DEBUG, "test with %" PRIuPTR " ops", num_ops);
gpr_timespec deadline = gpr_inf_past(GPR_CLOCK_REALTIME);
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
diff --git a/test/core/end2end/tests/network_status_change.cc b/test/core/end2end/tests/network_status_change.cc
index 83cb172f26..98a9558204 100644
--- a/test/core/end2end/tests/network_status_change.cc
+++ b/test/core/end2end/tests/network_status_change.cc
@@ -110,11 +110,9 @@ static void test_invoke_network_status_change(grpc_end2end_test_config config) {
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -209,8 +207,6 @@ static void test_invoke_network_status_change(grpc_end2end_test_config config) {
GPR_ASSERT(status == GRPC_STATUS_OK);
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
grpc_slice_unref(details);
grpc_metadata_array_destroy(&initial_metadata_recv);
diff --git a/test/core/end2end/tests/no_logging.cc b/test/core/end2end/tests/no_logging.cc
index b357e3b0ad..c8154023b8 100644
--- a/test/core/end2end/tests/no_logging.cc
+++ b/test/core/end2end/tests/no_logging.cc
@@ -131,11 +131,9 @@ static void simple_request_body(grpc_end2end_test_config config,
char* peer;
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
peer = grpc_call_get_peer(c);
@@ -219,8 +217,6 @@ static void simple_request_body(grpc_end2end_test_config config,
GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(0 == call_details.flags);
GPR_ASSERT(was_cancelled == 1);
diff --git a/test/core/end2end/tests/payload.cc b/test/core/end2end/tests/payload.cc
index 340c76e173..cb6eb47de9 100644
--- a/test/core/end2end/tests/payload.cc
+++ b/test/core/end2end/tests/payload.cc
@@ -129,11 +129,9 @@ static void request_response_with_payload(grpc_end2end_test_config config,
int was_cancelled = 2;
gpr_timespec deadline = n_seconds_from_now(60);
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -235,8 +233,6 @@ static void request_response_with_payload(grpc_end2end_test_config config,
GPR_ASSERT(status == GRPC_STATUS_OK);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(was_cancelled == 0);
GPR_ASSERT(byte_buffer_eq_slice(request_payload_recv, request_payload_slice));
GPR_ASSERT(
diff --git a/test/core/end2end/tests/ping_pong_streaming.cc b/test/core/end2end/tests/ping_pong_streaming.cc
index 9ca880481f..30ee0bf8b8 100644
--- a/test/core/end2end/tests/ping_pong_streaming.cc
+++ b/test/core/end2end/tests/ping_pong_streaming.cc
@@ -112,11 +112,9 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
grpc_slice_from_copied_string("hello you");
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
diff --git a/test/core/end2end/tests/proxy_auth.cc b/test/core/end2end/tests/proxy_auth.cc
index 5a2e0ef414..3b12869d2f 100644
--- a/test/core/end2end/tests/proxy_auth.cc
+++ b/test/core/end2end/tests/proxy_auth.cc
@@ -108,11 +108,9 @@ static void simple_request_body(grpc_end2end_test_config config,
char* peer;
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
peer = grpc_call_get_peer(c);
@@ -199,8 +197,6 @@ static void simple_request_body(grpc_end2end_test_config config,
GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(0 == call_details.flags);
GPR_ASSERT(was_cancelled == 1);
diff --git a/test/core/end2end/tests/registered_call.cc b/test/core/end2end/tests/registered_call.cc
index d4ca146707..3e05fd1421 100644
--- a/test/core/end2end/tests/registered_call.cc
+++ b/test/core/end2end/tests/registered_call.cc
@@ -177,8 +177,6 @@ static void simple_request_body(grpc_end2end_test_config config,
GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(was_cancelled == 1);
grpc_slice_unref(details);
@@ -196,9 +194,7 @@ static void simple_request_body(grpc_end2end_test_config config,
static void test_invoke_simple_request(grpc_end2end_test_config config) {
grpc_end2end_test_fixture f =
begin_test(config, "test_invoke_simple_request", nullptr, nullptr);
- void* rc = grpc_channel_register_call(
- f.client, "/foo",
- get_host_override_string("foo.test.google.fr:1234", config), nullptr);
+ void* rc = grpc_channel_register_call(f.client, "/foo", nullptr, nullptr);
simple_request_body(config, f, rc);
end_test(&f);
@@ -209,9 +205,7 @@ 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", nullptr, nullptr);
- void* rc = grpc_channel_register_call(
- f.client, "/foo",
- get_host_override_string("foo.test.google.fr:1234", config), nullptr);
+ void* rc = grpc_channel_register_call(f.client, "/foo", nullptr, nullptr);
for (i = 0; i < 10; i++) {
simple_request_body(config, f, rc);
diff --git a/test/core/end2end/tests/request_with_flags.cc b/test/core/end2end/tests/request_with_flags.cc
index 4a54318d0f..f3baf3790f 100644
--- a/test/core/end2end/tests/request_with_flags.cc
+++ b/test/core/end2end/tests/request_with_flags.cc
@@ -48,14 +48,12 @@ static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);
}
-static gpr_timespec five_seconds_from_now(void) {
- return n_seconds_from_now(5);
-}
+static gpr_timespec one_second_from_now(void) { return n_seconds_from_now(1); }
static void drain_cq(grpc_completion_queue* cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr);
+ ev = grpc_completion_queue_next(cq, one_second_from_now(), nullptr);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@@ -109,12 +107,10 @@ static void test_invoke_request_with_flags(
grpc_slice details;
grpc_call_error expectation;
- gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ gpr_timespec deadline = one_second_from_now();
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
diff --git a/test/core/end2end/tests/request_with_payload.cc b/test/core/end2end/tests/request_with_payload.cc
index 44398df52d..37d9481f28 100644
--- a/test/core/end2end/tests/request_with_payload.cc
+++ b/test/core/end2end/tests/request_with_payload.cc
@@ -107,11 +107,9 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) {
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -202,8 +200,6 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) {
GPR_ASSERT(status == GRPC_STATUS_OK);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(was_cancelled == 0);
GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world"));
diff --git a/test/core/end2end/tests/resource_quota_server.cc b/test/core/end2end/tests/resource_quota_server.cc
index 33d6b4ef31..df83caa662 100644
--- a/test/core/end2end/tests/resource_quota_server.cc
+++ b/test/core/end2end/tests/resource_quota_server.cc
@@ -188,11 +188,10 @@ void resource_quota_server(grpc_end2end_test_config config) {
}
for (int i = 0; i < NUM_CALLS; i++) {
- client_calls[i] = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr", config),
- n_seconds_from_now(60), nullptr);
+ client_calls[i] =
+ grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS,
+ f.cq, grpc_slice_from_static_string("/foo"),
+ nullptr, n_seconds_from_now(60), nullptr);
memset(ops, 0, sizeof(ops));
op = ops;
diff --git a/test/core/end2end/tests/retry.cc b/test/core/end2end/tests/retry.cc
index 38ecc6fbb1..243dedc62c 100644
--- a/test/core/end2end/tests/retry.cc
+++ b/test/core/end2end/tests/retry.cc
@@ -145,11 +145,9 @@ static void test_retry(grpc_end2end_test_config config) {
cq_verifier* cqv = cq_verifier_create(f.cq);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/service/method"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/service/method"),
+ nullptr, deadline, nullptr);
GPR_ASSERT(c);
peer = grpc_call_get_peer(c);
@@ -293,8 +291,6 @@ static void test_retry(grpc_end2end_test_config config) {
GPR_ASSERT(status == GRPC_STATUS_OK);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(0 == call_details.flags);
GPR_ASSERT(was_cancelled == 0);
diff --git a/test/core/end2end/tests/retry_cancellation.cc b/test/core/end2end/tests/retry_cancellation.cc
index 0504092c4f..e764fe70a6 100644
--- a/test/core/end2end/tests/retry_cancellation.cc
+++ b/test/core/end2end/tests/retry_cancellation.cc
@@ -146,11 +146,9 @@ static void test_retry_cancellation(grpc_end2end_test_config config,
cq_verifier* cqv = cq_verifier_create(f.cq);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/service/method"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/service/method"),
+ nullptr, deadline, nullptr);
GPR_ASSERT(c);
peer = grpc_call_get_peer(c);
diff --git a/test/core/end2end/tests/retry_disabled.cc b/test/core/end2end/tests/retry_disabled.cc
index cb30502aeb..ed3535409f 100644
--- a/test/core/end2end/tests/retry_disabled.cc
+++ b/test/core/end2end/tests/retry_disabled.cc
@@ -149,11 +149,9 @@ static void test_retry_disabled(grpc_end2end_test_config config) {
cq_verifier* cqv = cq_verifier_create(f.cq);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/service/method"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/service/method"),
+ nullptr, deadline, nullptr);
GPR_ASSERT(c);
peer = grpc_call_get_peer(c);
@@ -230,8 +228,6 @@ static void test_retry_disabled(grpc_end2end_test_config config) {
GPR_ASSERT(status == GRPC_STATUS_ABORTED);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(0 == call_details.flags);
GPR_ASSERT(was_cancelled == 1);
diff --git a/test/core/end2end/tests/retry_exceeds_buffer_size_in_initial_batch.cc b/test/core/end2end/tests/retry_exceeds_buffer_size_in_initial_batch.cc
index 3908f29971..a033a0aa95 100644
--- a/test/core/end2end/tests/retry_exceeds_buffer_size_in_initial_batch.cc
+++ b/test/core/end2end/tests/retry_exceeds_buffer_size_in_initial_batch.cc
@@ -152,11 +152,9 @@ static void test_retry_exceeds_buffer_size_in_initial_batch(
cq_verifier* cqv = cq_verifier_create(f.cq);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/service/method"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/service/method"),
+ nullptr, deadline, nullptr);
GPR_ASSERT(c);
peer = grpc_call_get_peer(c);
@@ -233,8 +231,6 @@ static void test_retry_exceeds_buffer_size_in_initial_batch(
GPR_ASSERT(status == GRPC_STATUS_ABORTED);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(0 == call_details.flags);
GPR_ASSERT(was_cancelled == 1);
diff --git a/test/core/end2end/tests/retry_exceeds_buffer_size_in_subsequent_batch.cc b/test/core/end2end/tests/retry_exceeds_buffer_size_in_subsequent_batch.cc
index 409fac4888..c1070e6191 100644
--- a/test/core/end2end/tests/retry_exceeds_buffer_size_in_subsequent_batch.cc
+++ b/test/core/end2end/tests/retry_exceeds_buffer_size_in_subsequent_batch.cc
@@ -157,11 +157,9 @@ static void test_retry_exceeds_buffer_size_in_subsequent_batch(
cq_verifier* cqv = cq_verifier_create(f.cq);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/service/method"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/service/method"),
+ nullptr, deadline, nullptr);
GPR_ASSERT(c);
peer = grpc_call_get_peer(c);
@@ -245,8 +243,6 @@ static void test_retry_exceeds_buffer_size_in_subsequent_batch(
GPR_ASSERT(status == GRPC_STATUS_ABORTED);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(0 == call_details.flags);
GPR_ASSERT(was_cancelled == 1);
diff --git a/test/core/end2end/tests/retry_non_retriable_status.cc b/test/core/end2end/tests/retry_non_retriable_status.cc
index 6d59db0b04..b8d094749a 100644
--- a/test/core/end2end/tests/retry_non_retriable_status.cc
+++ b/test/core/end2end/tests/retry_non_retriable_status.cc
@@ -144,11 +144,9 @@ static void test_retry_non_retriable_status(grpc_end2end_test_config config) {
cq_verifier* cqv = cq_verifier_create(f.cq);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/service/method"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/service/method"),
+ nullptr, deadline, nullptr);
GPR_ASSERT(c);
peer = grpc_call_get_peer(c);
@@ -225,8 +223,6 @@ static void test_retry_non_retriable_status(grpc_end2end_test_config config) {
GPR_ASSERT(status == GRPC_STATUS_INVALID_ARGUMENT);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(0 == call_details.flags);
GPR_ASSERT(was_cancelled == 1);
diff --git a/test/core/end2end/tests/retry_non_retriable_status_before_recv_trailing_metadata_started.cc b/test/core/end2end/tests/retry_non_retriable_status_before_recv_trailing_metadata_started.cc
new file mode 100644
index 0000000000..eb016a3de9
--- /dev/null
+++ b/test/core/end2end/tests/retry_non_retriable_status_before_recv_trailing_metadata_started.cc
@@ -0,0 +1,266 @@
+/*
+ *
+ * Copyright 2018 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "test/core/end2end/end2end_tests.h"
+
+#include <stdio.h>
+#include <string.h>
+
+#include <grpc/byte_buffer.h>
+#include <grpc/grpc.h>
+#include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
+#include <grpc/support/string_util.h>
+#include <grpc/support/time.h>
+
+#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gpr/useful.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
+#include "src/core/lib/transport/static_metadata.h"
+
+#include "test/core/end2end/cq_verifier.h"
+#include "test/core/end2end/tests/cancel_test_helpers.h"
+
+static void* tag(intptr_t t) { return (void*)t; }
+
+static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
+ const char* test_name,
+ grpc_channel_args* client_args,
+ grpc_channel_args* server_args) {
+ grpc_end2end_test_fixture f;
+ gpr_log(GPR_INFO, "Running test: %s/%s", test_name, config.name);
+ f = config.create_fixture(client_args, server_args);
+ config.init_server(&f, server_args);
+ config.init_client(&f, client_args);
+ return f;
+}
+
+static gpr_timespec n_seconds_from_now(int n) {
+ return grpc_timeout_seconds_to_deadline(n);
+}
+
+static gpr_timespec five_seconds_from_now(void) {
+ return n_seconds_from_now(5);
+}
+
+static void drain_cq(grpc_completion_queue* cq) {
+ grpc_event ev;
+ do {
+ ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr);
+ } while (ev.type != GRPC_QUEUE_SHUTDOWN);
+}
+
+static void shutdown_server(grpc_end2end_test_fixture* f) {
+ if (!f->server) return;
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ nullptr)
+ .type == GRPC_OP_COMPLETE);
+ grpc_server_destroy(f->server);
+ f->server = nullptr;
+}
+
+static void shutdown_client(grpc_end2end_test_fixture* f) {
+ if (!f->client) return;
+ grpc_channel_destroy(f->client);
+ f->client = nullptr;
+}
+
+static void end_test(grpc_end2end_test_fixture* f) {
+ shutdown_server(f);
+ shutdown_client(f);
+
+ grpc_completion_queue_shutdown(f->cq);
+ drain_cq(f->cq);
+ grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
+}
+
+// Tests that we don't retry for non-retryable status codes, even if
+// status is received before the recv_trailing_metadata op is started.
+// - 1 retry allowed for ABORTED status
+// - first attempt gets INVALID_ARGUMENT, so no retry is done
+static void
+test_retry_non_retriable_status_before_recv_trailing_metadata_started(
+ grpc_end2end_test_config config) {
+ grpc_call* c;
+ grpc_call* s;
+ grpc_op ops[6];
+ grpc_op* op;
+ grpc_metadata_array initial_metadata_recv;
+ grpc_metadata_array trailing_metadata_recv;
+ grpc_metadata_array request_metadata_recv;
+ grpc_call_details call_details;
+ grpc_slice request_payload_slice = grpc_slice_from_static_string("foo");
+ grpc_slice response_payload_slice = grpc_slice_from_static_string("bar");
+ grpc_byte_buffer* request_payload =
+ grpc_raw_byte_buffer_create(&request_payload_slice, 1);
+ grpc_byte_buffer* response_payload =
+ grpc_raw_byte_buffer_create(&response_payload_slice, 1);
+ grpc_byte_buffer* request_payload_recv = nullptr;
+ grpc_byte_buffer* response_payload_recv = nullptr;
+ grpc_status_code status;
+ grpc_call_error error;
+ grpc_slice details;
+ int was_cancelled = 2;
+ char* peer;
+
+ grpc_arg arg;
+ arg.type = GRPC_ARG_STRING;
+ arg.key = const_cast<char*>(GRPC_ARG_SERVICE_CONFIG);
+ arg.value.string = const_cast<char*>(
+ "{\n"
+ " \"methodConfig\": [ {\n"
+ " \"name\": [\n"
+ " { \"service\": \"service\", \"method\": \"method\" }\n"
+ " ],\n"
+ " \"retryPolicy\": {\n"
+ " \"maxAttempts\": 2,\n"
+ " \"initialBackoff\": \"1s\",\n"
+ " \"maxBackoff\": \"120s\",\n"
+ " \"backoffMultiplier\": 1.6,\n"
+ " \"retryableStatusCodes\": [ \"ABORTED\" ]\n"
+ " }\n"
+ " } ]\n"
+ "}");
+ grpc_channel_args client_args = {1, &arg};
+ grpc_end2end_test_fixture f =
+ begin_test(config, "retry_non_retriable_status", &client_args, nullptr);
+
+ cq_verifier* cqv = cq_verifier_create(f.cq);
+
+ gpr_timespec deadline = five_seconds_from_now();
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/service/method"),
+ nullptr, deadline, nullptr);
+ GPR_ASSERT(c);
+
+ peer = grpc_call_get_peer(c);
+ GPR_ASSERT(peer != nullptr);
+ gpr_log(GPR_DEBUG, "client_peer_before_call=%s", peer);
+ gpr_free(peer);
+
+ grpc_metadata_array_init(&initial_metadata_recv);
+ grpc_metadata_array_init(&trailing_metadata_recv);
+ grpc_metadata_array_init(&request_metadata_recv);
+ grpc_call_details_init(&call_details);
+ grpc_slice status_details = grpc_slice_from_static_string("xyz");
+
+ memset(ops, 0, sizeof(ops));
+ op = ops;
+ op->op = GRPC_OP_SEND_INITIAL_METADATA;
+ op->data.send_initial_metadata.count = 0;
+ op++;
+ op->op = GRPC_OP_SEND_MESSAGE;
+ op->data.send_message.send_message = request_payload;
+ op++;
+ op->op = GRPC_OP_RECV_MESSAGE;
+ op->data.recv_message.recv_message = &response_payload_recv;
+ op++;
+ op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
+ op++;
+ op->op = GRPC_OP_RECV_INITIAL_METADATA;
+ op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv;
+ op++;
+ error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr);
+ GPR_ASSERT(GRPC_CALL_OK == error);
+
+ error =
+ grpc_server_request_call(f.server, &s, &call_details,
+ &request_metadata_recv, f.cq, f.cq, tag(101));
+ GPR_ASSERT(GRPC_CALL_OK == error);
+ CQ_EXPECT_COMPLETION(cqv, tag(101), true);
+ cq_verify(cqv);
+
+ peer = grpc_call_get_peer(s);
+ GPR_ASSERT(peer != nullptr);
+ gpr_log(GPR_DEBUG, "server_peer=%s", peer);
+ gpr_free(peer);
+ peer = grpc_call_get_peer(c);
+ GPR_ASSERT(peer != nullptr);
+ gpr_log(GPR_DEBUG, "client_peer=%s", peer);
+ gpr_free(peer);
+
+ memset(ops, 0, sizeof(ops));
+ op = ops;
+ op->op = GRPC_OP_SEND_INITIAL_METADATA;
+ op->data.send_initial_metadata.count = 0;
+ op++;
+ op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
+ op->data.send_status_from_server.trailing_metadata_count = 0;
+ op->data.send_status_from_server.status = GRPC_STATUS_INVALID_ARGUMENT;
+ op->data.send_status_from_server.status_details = &status_details;
+ op++;
+ op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
+ op->data.recv_close_on_server.cancelled = &was_cancelled;
+ op++;
+ error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr);
+ GPR_ASSERT(GRPC_CALL_OK == error);
+
+ CQ_EXPECT_COMPLETION(cqv, tag(102), true);
+ CQ_EXPECT_COMPLETION(cqv, tag(1), true);
+ cq_verify(cqv);
+
+ memset(ops, 0, sizeof(ops));
+ op = ops;
+ op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
+ op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
+ op->data.recv_status_on_client.status = &status;
+ op->data.recv_status_on_client.status_details = &details;
+ op++;
+ error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), nullptr);
+ GPR_ASSERT(GRPC_CALL_OK == error);
+
+ CQ_EXPECT_COMPLETION(cqv, tag(2), true);
+ cq_verify(cqv);
+
+ GPR_ASSERT(status == GRPC_STATUS_INVALID_ARGUMENT);
+ GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
+ GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method"));
+ GPR_ASSERT(0 == call_details.flags);
+ GPR_ASSERT(was_cancelled == 1);
+
+ grpc_slice_unref(details);
+ grpc_metadata_array_destroy(&initial_metadata_recv);
+ grpc_metadata_array_destroy(&trailing_metadata_recv);
+ grpc_metadata_array_destroy(&request_metadata_recv);
+ grpc_call_details_destroy(&call_details);
+ grpc_byte_buffer_destroy(request_payload);
+ grpc_byte_buffer_destroy(response_payload);
+ grpc_byte_buffer_destroy(request_payload_recv);
+ grpc_byte_buffer_destroy(response_payload_recv);
+
+ grpc_call_unref(c);
+ grpc_call_unref(s);
+
+ cq_verifier_destroy(cqv);
+
+ end_test(&f);
+ config.tear_down_data(&f);
+}
+
+void retry_non_retriable_status_before_recv_trailing_metadata_started(
+ grpc_end2end_test_config config) {
+ GPR_ASSERT(config.feature_mask & FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL);
+ test_retry_non_retriable_status_before_recv_trailing_metadata_started(config);
+}
+
+void retry_non_retriable_status_before_recv_trailing_metadata_started_pre_init() {
+}
diff --git a/test/core/end2end/tests/retry_recv_initial_metadata.cc b/test/core/end2end/tests/retry_recv_initial_metadata.cc
index 14215e449c..839b870367 100644
--- a/test/core/end2end/tests/retry_recv_initial_metadata.cc
+++ b/test/core/end2end/tests/retry_recv_initial_metadata.cc
@@ -145,11 +145,9 @@ static void test_retry_recv_initial_metadata(grpc_end2end_test_config config) {
cq_verifier* cqv = cq_verifier_create(f.cq);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/service/method"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/service/method"),
+ nullptr, deadline, nullptr);
GPR_ASSERT(c);
peer = grpc_call_get_peer(c);
@@ -236,8 +234,6 @@ static void test_retry_recv_initial_metadata(grpc_end2end_test_config config) {
GPR_ASSERT(status == GRPC_STATUS_ABORTED);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(0 == call_details.flags);
GPR_ASSERT(was_cancelled == 1);
diff --git a/test/core/end2end/tests/retry_recv_message.cc b/test/core/end2end/tests/retry_recv_message.cc
index 86171fdc01..5fdaad0b88 100644
--- a/test/core/end2end/tests/retry_recv_message.cc
+++ b/test/core/end2end/tests/retry_recv_message.cc
@@ -145,11 +145,9 @@ static void test_retry_recv_message(grpc_end2end_test_config config) {
cq_verifier* cqv = cq_verifier_create(f.cq);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/service/method"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/service/method"),
+ nullptr, deadline, nullptr);
GPR_ASSERT(c);
peer = grpc_call_get_peer(c);
@@ -229,8 +227,6 @@ static void test_retry_recv_message(grpc_end2end_test_config config) {
GPR_ASSERT(status == GRPC_STATUS_ABORTED);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(0 == call_details.flags);
GPR_ASSERT(was_cancelled == 1);
diff --git a/test/core/end2end/tests/retry_server_pushback_delay.cc b/test/core/end2end/tests/retry_server_pushback_delay.cc
index 1da986041f..f6a979613d 100644
--- a/test/core/end2end/tests/retry_server_pushback_delay.cc
+++ b/test/core/end2end/tests/retry_server_pushback_delay.cc
@@ -150,11 +150,9 @@ static void test_retry_server_pushback_delay(grpc_end2end_test_config config) {
cq_verifier* cqv = cq_verifier_create(f.cq);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/service/method"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/service/method"),
+ nullptr, deadline, nullptr);
GPR_ASSERT(c);
peer = grpc_call_get_peer(c);
@@ -286,8 +284,6 @@ static void test_retry_server_pushback_delay(grpc_end2end_test_config config) {
GPR_ASSERT(status == GRPC_STATUS_OK);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(0 == call_details.flags);
GPR_ASSERT(was_cancelled == 0);
diff --git a/test/core/end2end/tests/retry_server_pushback_disabled.cc b/test/core/end2end/tests/retry_server_pushback_disabled.cc
index 13d4f01eea..1c56476183 100644
--- a/test/core/end2end/tests/retry_server_pushback_disabled.cc
+++ b/test/core/end2end/tests/retry_server_pushback_disabled.cc
@@ -151,11 +151,9 @@ static void test_retry_server_pushback_disabled(
cq_verifier* cqv = cq_verifier_create(f.cq);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/service/method"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/service/method"),
+ nullptr, deadline, nullptr);
GPR_ASSERT(c);
peer = grpc_call_get_peer(c);
@@ -274,8 +272,6 @@ static void test_retry_server_pushback_disabled(
GPR_ASSERT(status == GRPC_STATUS_ABORTED);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(0 == call_details.flags);
GPR_ASSERT(was_cancelled == 1);
diff --git a/test/core/end2end/tests/retry_streaming.cc b/test/core/end2end/tests/retry_streaming.cc
index e96e57e8bc..d06d124ca4 100644
--- a/test/core/end2end/tests/retry_streaming.cc
+++ b/test/core/end2end/tests/retry_streaming.cc
@@ -158,11 +158,9 @@ static void test_retry_streaming(grpc_end2end_test_config config) {
cq_verifier* cqv = cq_verifier_create(f.cq);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/service/method"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/service/method"),
+ nullptr, deadline, nullptr);
GPR_ASSERT(c);
peer = grpc_call_get_peer(c);
@@ -383,8 +381,6 @@ static void test_retry_streaming(grpc_end2end_test_config config) {
GPR_ASSERT(status == GRPC_STATUS_ABORTED);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(0 == call_details.flags);
GPR_ASSERT(was_cancelled == 1);
diff --git a/test/core/end2end/tests/retry_streaming_after_commit.cc b/test/core/end2end/tests/retry_streaming_after_commit.cc
index 43eee86d95..05025d0a10 100644
--- a/test/core/end2end/tests/retry_streaming_after_commit.cc
+++ b/test/core/end2end/tests/retry_streaming_after_commit.cc
@@ -151,11 +151,9 @@ static void test_retry_streaming_after_commit(grpc_end2end_test_config config) {
cq_verifier* cqv = cq_verifier_create(f.cq);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/service/method"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/service/method"),
+ nullptr, deadline, nullptr);
GPR_ASSERT(c);
peer = grpc_call_get_peer(c);
@@ -312,8 +310,6 @@ static void test_retry_streaming_after_commit(grpc_end2end_test_config config) {
GPR_ASSERT(status == GRPC_STATUS_ABORTED);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(0 == call_details.flags);
GPR_ASSERT(was_cancelled == 1);
diff --git a/test/core/end2end/tests/retry_streaming_succeeds_before_replay_finished.cc b/test/core/end2end/tests/retry_streaming_succeeds_before_replay_finished.cc
index 5c92f64805..14460d2a46 100644
--- a/test/core/end2end/tests/retry_streaming_succeeds_before_replay_finished.cc
+++ b/test/core/end2end/tests/retry_streaming_succeeds_before_replay_finished.cc
@@ -152,11 +152,9 @@ static void test_retry_streaming_succeeds_before_replay_finished(
cq_verifier* cqv = cq_verifier_create(f.cq);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/service/method"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/service/method"),
+ nullptr, deadline, nullptr);
GPR_ASSERT(c);
peer = grpc_call_get_peer(c);
@@ -364,8 +362,6 @@ static void test_retry_streaming_succeeds_before_replay_finished(
GPR_ASSERT(status == GRPC_STATUS_ABORTED);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(0 == call_details.flags);
GPR_ASSERT(was_cancelled == 1);
diff --git a/test/core/end2end/tests/retry_throttled.cc b/test/core/end2end/tests/retry_throttled.cc
index 8cd08487ea..f5b28def0a 100644
--- a/test/core/end2end/tests/retry_throttled.cc
+++ b/test/core/end2end/tests/retry_throttled.cc
@@ -151,11 +151,9 @@ static void test_retry_throttled(grpc_end2end_test_config config) {
cq_verifier* cqv = cq_verifier_create(f.cq);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/service/method"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/service/method"),
+ nullptr, deadline, nullptr);
GPR_ASSERT(c);
peer = grpc_call_get_peer(c);
@@ -232,8 +230,6 @@ static void test_retry_throttled(grpc_end2end_test_config config) {
GPR_ASSERT(status == GRPC_STATUS_ABORTED);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(0 == call_details.flags);
GPR_ASSERT(was_cancelled == 1);
diff --git a/test/core/end2end/tests/retry_too_many_attempts.cc b/test/core/end2end/tests/retry_too_many_attempts.cc
index 5225c9b229..2af32679f1 100644
--- a/test/core/end2end/tests/retry_too_many_attempts.cc
+++ b/test/core/end2end/tests/retry_too_many_attempts.cc
@@ -145,11 +145,9 @@ static void test_retry_too_many_attempts(grpc_end2end_test_config config) {
cq_verifier* cqv = cq_verifier_create(f.cq);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/service/method"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/service/method"),
+ nullptr, deadline, nullptr);
GPR_ASSERT(c);
peer = grpc_call_get_peer(c);
@@ -267,8 +265,6 @@ static void test_retry_too_many_attempts(grpc_end2end_test_config config) {
GPR_ASSERT(status == GRPC_STATUS_ABORTED);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(0 == call_details.flags);
GPR_ASSERT(was_cancelled == 1);
diff --git a/test/core/end2end/tests/server_finishes_request.cc b/test/core/end2end/tests/server_finishes_request.cc
index 6fc06cfaa1..c81b309a1e 100644
--- a/test/core/end2end/tests/server_finishes_request.cc
+++ b/test/core/end2end/tests/server_finishes_request.cc
@@ -102,11 +102,9 @@ static void simple_request_body(grpc_end2end_test_config config,
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -175,8 +173,6 @@ static void simple_request_body(grpc_end2end_test_config config,
GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(was_cancelled == 1);
grpc_slice_unref(details);
diff --git a/test/core/end2end/tests/shutdown_finishes_calls.cc b/test/core/end2end/tests/shutdown_finishes_calls.cc
index 34c4ebbf0a..5dd5bb2ad6 100644
--- a/test/core/end2end/tests/shutdown_finishes_calls.cc
+++ b/test/core/end2end/tests/shutdown_finishes_calls.cc
@@ -92,11 +92,9 @@ static void test_early_server_shutdown_finishes_inflight_calls(
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -150,6 +148,13 @@ static void test_early_server_shutdown_finishes_inflight_calls(
nullptr);
GPR_ASSERT(GRPC_CALL_OK == error);
+ /* Make sure we don't shutdown the server while HTTP/2 PING frames are still
+ * being exchanged on the newly established connection. It can lead to
+ * failures when testing with HTTP proxy. See
+ * https://github.com/grpc/grpc/issues/14471
+ */
+ gpr_sleep_until(n_seconds_from_now(1));
+
/* shutdown and destroy the server */
grpc_server_shutdown_and_notify(f.server, f.cq, tag(1000));
grpc_server_cancel_all_calls(f.server);
@@ -165,8 +170,6 @@ static void test_early_server_shutdown_finishes_inflight_calls(
GPR_ASSERT(status == GRPC_STATUS_INTERNAL ||
status == GRPC_STATUS_UNAVAILABLE);
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(was_cancelled == 1);
grpc_slice_unref(details);
diff --git a/test/core/end2end/tests/simple_cacheable_request.cc b/test/core/end2end/tests/simple_cacheable_request.cc
index 4ae8398a6e..be6d16ecad 100644
--- a/test/core/end2end/tests/simple_cacheable_request.cc
+++ b/test/core/end2end/tests/simple_cacheable_request.cc
@@ -132,11 +132,9 @@ static void test_cacheable_request_response_with_metadata_and_payload(
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -240,8 +238,6 @@ static void test_cacheable_request_response_with_metadata_and_payload(
GPR_ASSERT(status == GRPC_STATUS_OK);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
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.cc b/test/core/end2end/tests/simple_delayed_request.cc
index f8a1ddfdc3..8d11699945 100644
--- a/test/core/end2end/tests/simple_delayed_request.cc
+++ b/test/core/end2end/tests/simple_delayed_request.cc
@@ -94,11 +94,9 @@ static void simple_delayed_request_body(grpc_end2end_test_config config,
config.init_server(f, server_args);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f->client, nullptr, GRPC_PROPAGATE_DEFAULTS, f->cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f->client, nullptr, GRPC_PROPAGATE_DEFAULTS,
+ f->cq, grpc_slice_from_static_string("/foo"),
+ nullptr, deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -171,8 +169,6 @@ static void simple_delayed_request_body(grpc_end2end_test_config config,
GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(was_cancelled == 1);
grpc_slice_unref(details);
diff --git a/test/core/end2end/tests/simple_metadata.cc b/test/core/end2end/tests/simple_metadata.cc
index 1f39f8983b..3e476c2129 100644
--- a/test/core/end2end/tests/simple_metadata.cc
+++ b/test/core/end2end/tests/simple_metadata.cc
@@ -130,11 +130,9 @@ static void test_request_response_with_metadata_and_payload(
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -238,8 +236,6 @@ static void test_request_response_with_metadata_and_payload(
GPR_ASSERT(status == GRPC_STATUS_OK);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(was_cancelled == 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.cc b/test/core/end2end/tests/simple_request.cc
index 926e2c7452..2d6ccad0ec 100644
--- a/test/core/end2end/tests/simple_request.cc
+++ b/test/core/end2end/tests/simple_request.cc
@@ -111,11 +111,9 @@ static void simple_request_body(grpc_end2end_test_config config,
grpc_stats_collect(before);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
peer = grpc_call_get_peer(c);
@@ -212,8 +210,6 @@ static void simple_request_body(grpc_end2end_test_config config,
GPR_ASSERT(nullptr != strstr(error_string, "grpc_message"));
GPR_ASSERT(nullptr != strstr(error_string, "grpc_status"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(0 == call_details.flags);
GPR_ASSERT(was_cancelled == 1);
diff --git a/test/core/end2end/tests/stream_compression_compressed_payload.cc b/test/core/end2end/tests/stream_compression_compressed_payload.cc
index e90d54f054..839f0912a8 100644
--- a/test/core/end2end/tests/stream_compression_compressed_payload.cc
+++ b/test/core/end2end/tests/stream_compression_compressed_payload.cc
@@ -137,11 +137,9 @@ static void request_for_disabled_algorithm(
cqv = cq_verifier_create(f.cq);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -239,8 +237,6 @@ static void request_for_disabled_algorithm(
GPR_ASSERT(0 == grpc_slice_str_cmp(details, expected_details));
gpr_free(expected_details);
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
grpc_slice_unref(details);
grpc_metadata_array_destroy(&initial_metadata_recv);
@@ -327,11 +323,9 @@ static void request_with_payload_template(
cqv = cq_verifier_create(f.cq);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -529,8 +523,6 @@ static void request_with_payload_template(
GPR_ASSERT(status == GRPC_STATUS_OK);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(was_cancelled == 0);
grpc_slice_unref(details);
diff --git a/test/core/end2end/tests/stream_compression_payload.cc b/test/core/end2end/tests/stream_compression_payload.cc
index 9eace97afd..4c08150723 100644
--- a/test/core/end2end/tests/stream_compression_payload.cc
+++ b/test/core/end2end/tests/stream_compression_payload.cc
@@ -132,11 +132,9 @@ static void request_response_with_payload(grpc_end2end_test_config config,
int was_cancelled = 2;
gpr_timespec deadline = n_seconds_from_now(60);
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -238,8 +236,6 @@ static void request_response_with_payload(grpc_end2end_test_config config,
GPR_ASSERT(status == GRPC_STATUS_OK);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(was_cancelled == 0);
GPR_ASSERT(byte_buffer_eq_slice(request_payload_recv, request_payload_slice));
GPR_ASSERT(
diff --git a/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc b/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc
index 5b033292b0..f7af59febe 100644
--- a/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc
+++ b/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc
@@ -120,11 +120,9 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
grpc_slice_from_copied_string("hello you");
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
diff --git a/test/core/end2end/tests/streaming_error_response.cc b/test/core/end2end/tests/streaming_error_response.cc
index 7c7d778d1e..4c357e077e 100644
--- a/test/core/end2end/tests/streaming_error_response.cc
+++ b/test/core/end2end/tests/streaming_error_response.cc
@@ -116,11 +116,9 @@ static void test(grpc_end2end_test_config config, bool request_status_early) {
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -244,8 +242,6 @@ static void test(grpc_end2end_test_config config, bool request_status_early) {
GPR_ASSERT(status == GRPC_STATUS_FAILED_PRECONDITION);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(was_cancelled == 1);
grpc_slice_unref(details);
diff --git a/test/core/end2end/tests/trailing_metadata.cc b/test/core/end2end/tests/trailing_metadata.cc
index 24069854ac..5cf6f2bb11 100644
--- a/test/core/end2end/tests/trailing_metadata.cc
+++ b/test/core/end2end/tests/trailing_metadata.cc
@@ -138,11 +138,9 @@ static void test_request_response_with_metadata_and_payload(
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -247,8 +245,6 @@ static void test_request_response_with_metadata_and_payload(
GPR_ASSERT(status == GRPC_STATUS_OK);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(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"));
diff --git a/test/core/end2end/tests/workaround_cronet_compression.cc b/test/core/end2end/tests/workaround_cronet_compression.cc
index 4d4c369a42..f44ddca3b1 100644
--- a/test/core/end2end/tests/workaround_cronet_compression.cc
+++ b/test/core/end2end/tests/workaround_cronet_compression.cc
@@ -155,11 +155,9 @@ static void request_with_payload_template(
cqv = cq_verifier_create(f.cq);
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -338,8 +336,6 @@ static void request_with_payload_template(
GPR_ASSERT(status == GRPC_STATUS_OK);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(was_cancelled == 0);
grpc_slice_unref(details);
diff --git a/test/core/end2end/tests/write_buffering.cc b/test/core/end2end/tests/write_buffering.cc
index 5d76d238b9..2f7ee9c892 100644
--- a/test/core/end2end/tests/write_buffering.cc
+++ b/test/core/end2end/tests/write_buffering.cc
@@ -111,11 +111,9 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) {
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -255,8 +253,6 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) {
GPR_ASSERT(status == GRPC_STATUS_OK);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(was_cancelled == 0);
GPR_ASSERT(byte_buffer_eq_string(request_payload_recv1, "hello world"));
GPR_ASSERT(byte_buffer_eq_string(request_payload_recv2, "abc123"));
diff --git a/test/core/end2end/tests/write_buffering_at_end.cc b/test/core/end2end/tests/write_buffering_at_end.cc
index bd046ef9cc..886d491a10 100644
--- a/test/core/end2end/tests/write_buffering_at_end.cc
+++ b/test/core/end2end/tests/write_buffering_at_end.cc
@@ -108,11 +108,9 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) {
int was_cancelled = 2;
gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(
- f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"),
- get_host_override_slice("foo.test.google.fr:1234", config), deadline,
- nullptr);
+ c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
+ grpc_slice_from_static_string("/foo"), nullptr,
+ deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@@ -246,8 +244,6 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) {
GPR_ASSERT(status == GRPC_STATUS_OK);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- validate_host_override_string("foo.test.google.fr:1234", call_details.host,
- config);
GPR_ASSERT(was_cancelled == 0);
GPR_ASSERT(byte_buffer_eq_string(request_payload_recv1, "hello world"));
GPR_ASSERT(request_payload_recv2 == nullptr);
diff --git a/test/core/gpr/mpscq_test.cc b/test/core/gpr/mpscq_test.cc
index 8c0873941f..f51bdf8c50 100644
--- a/test/core/gpr/mpscq_test.cc
+++ b/test/core/gpr/mpscq_test.cc
@@ -18,6 +18,7 @@
#include "src/core/lib/gpr/mpscq.h"
+#include <inttypes.h>
#include <stdlib.h>
#include <grpc/support/alloc.h>
diff --git a/test/core/gpr/time_test.cc b/test/core/gpr/time_test.cc
index c80aac649d..6f070f58df 100644
--- a/test/core/gpr/time_test.cc
+++ b/test/core/gpr/time_test.cc
@@ -21,6 +21,7 @@
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
+#include <inttypes.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/test/core/gprpp/inlined_vector_test.cc b/test/core/gprpp/inlined_vector_test.cc
index b900afaf3d..ae34947718 100644
--- a/test/core/gprpp/inlined_vector_test.cc
+++ b/test/core/gprpp/inlined_vector_test.cc
@@ -33,6 +33,7 @@ TEST(InlinedVectorTest, CreateAndIterate) {
EXPECT_EQ(static_cast<size_t>(kNumElements), v.size());
for (int i = 0; i < kNumElements; ++i) {
EXPECT_EQ(i, v[i]);
+ EXPECT_EQ(i, &v[i] - &v[0]); // Ensure contiguous allocation.
}
}
@@ -87,14 +88,17 @@ TEST(InlinedVectorTest, ClearAndRepopulate) {
}
TEST(InlinedVectorTest, ConstIndexOperator) {
- const int kNumElements = 10;
+ constexpr int kNumElements = 10;
InlinedVector<int, 5> v;
EXPECT_EQ(0UL, v.size());
for (int i = 0; i < kNumElements; ++i) {
v.push_back(i);
EXPECT_EQ(i + 1UL, v.size());
}
- auto const_func = [kNumElements](const InlinedVector<int, 5>& v) {
+ // The following lambda function is exceptionally allowed to use an anonymous
+ // capture due to the erroneous behavior of the MSVC compiler, that refuses to
+ // capture the kNumElements constexpr, something allowed by the standard.
+ auto const_func = [&](const InlinedVector<int, 5>& v) {
for (int i = 0; i < kNumElements; ++i) {
EXPECT_EQ(i, v[i]);
}
diff --git a/test/core/gprpp/ref_counted_ptr_test.cc b/test/core/gprpp/ref_counted_ptr_test.cc
index 2e398a7722..c810345166 100644
--- a/test/core/gprpp/ref_counted_ptr_test.cc
+++ b/test/core/gprpp/ref_counted_ptr_test.cc
@@ -88,7 +88,7 @@ TEST(RefCountedPtr, CopyAssignmentWhenEmpty) {
TEST(RefCountedPtr, CopyAssignmentToSelf) {
RefCountedPtr<Foo> foo(New<Foo>());
- foo = foo;
+ foo = *&foo; // The "*&" avoids warnings from LLVM -Wself-assign.
}
TEST(RefCountedPtr, EnclosedScope) {
diff --git a/test/core/handshake/readahead_handshaker_server_ssl.cc b/test/core/handshake/readahead_handshaker_server_ssl.cc
index 9788320e0d..97e9c20ee4 100644
--- a/test/core/handshake/readahead_handshaker_server_ssl.cc
+++ b/test/core/handshake/readahead_handshaker_server_ssl.cc
@@ -64,7 +64,7 @@ static void readahead_handshaker_do_handshake(
const grpc_handshaker_vtable readahead_handshaker_vtable = {
readahead_handshaker_destroy, readahead_handshaker_shutdown,
- readahead_handshaker_do_handshake};
+ readahead_handshaker_do_handshake, "read_ahead"};
static grpc_handshaker* readahead_handshaker_create() {
grpc_handshaker* h =
diff --git a/test/core/http/httpcli_test.cc b/test/core/http/httpcli_test.cc
index 346568fcf2..16448d9e14 100644
--- a/test/core/http/httpcli_test.cc
+++ b/test/core/http/httpcli_test.cc
@@ -47,6 +47,7 @@ static void on_finish(void* arg, grpc_error* error) {
"<body><p>This is a test</p></body></html>";
grpc_http_response* response = static_cast<grpc_http_response*>(arg);
GPR_ASSERT(response);
+ gpr_log(GPR_INFO, "response status %d", response->status);
GPR_ASSERT(response->status == 200);
GPR_ASSERT(response->body_length == strlen(expect));
GPR_ASSERT(0 == memcmp(expect, response->body, response->body_length));
diff --git a/test/core/http/httpscli_test.cc b/test/core/http/httpscli_test.cc
index a38f306ef3..b8f2e438a4 100644
--- a/test/core/http/httpscli_test.cc
+++ b/test/core/http/httpscli_test.cc
@@ -49,6 +49,7 @@ static void on_finish(void* arg, grpc_error* error) {
"<body><p>This is a test</p></body></html>";
grpc_http_response* response = static_cast<grpc_http_response*>(arg);
GPR_ASSERT(response);
+ gpr_log(GPR_INFO, "response status %d", response->status);
GPR_ASSERT(response->status == 200);
GPR_ASSERT(response->body_length == strlen(expect));
GPR_ASSERT(0 == memcmp(expect, response->body, response->body_length));
diff --git a/test/core/iomgr/resource_quota_test.cc b/test/core/iomgr/resource_quota_test.cc
index 921a24ebf2..059ff7b5f8 100644
--- a/test/core/iomgr/resource_quota_test.cc
+++ b/test/core/iomgr/resource_quota_test.cc
@@ -21,6 +21,7 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
#include "test/core/util/test_config.h"
diff --git a/test/core/iomgr/sockaddr_utils_test.cc b/test/core/iomgr/sockaddr_utils_test.cc
index 32d2a384bd..3783f968b7 100644
--- a/test/core/iomgr/sockaddr_utils_test.cc
+++ b/test/core/iomgr/sockaddr_utils_test.cc
@@ -22,6 +22,7 @@
headers. Therefore, sockaddr.h must always be included first */
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/iomgr/sockaddr.h"
+#include "src/core/lib/iomgr/socket_utils.h"
#include <errno.h>
#include <string.h>
@@ -33,34 +34,33 @@
static grpc_resolved_address make_addr4(const uint8_t* data, size_t data_len) {
grpc_resolved_address resolved_addr4;
- struct sockaddr_in* addr4 =
- reinterpret_cast<struct sockaddr_in*>(resolved_addr4.addr);
+ grpc_sockaddr_in* addr4 =
+ reinterpret_cast<grpc_sockaddr_in*>(resolved_addr4.addr);
memset(&resolved_addr4, 0, sizeof(resolved_addr4));
- addr4->sin_family = AF_INET;
+ addr4->sin_family = GRPC_AF_INET;
GPR_ASSERT(data_len == sizeof(addr4->sin_addr.s_addr));
memcpy(&addr4->sin_addr.s_addr, data, data_len);
- addr4->sin_port = htons(12345);
- resolved_addr4.len = sizeof(struct sockaddr_in);
+ addr4->sin_port = grpc_htons(12345);
+ resolved_addr4.len = static_cast<socklen_t>(sizeof(grpc_sockaddr_in));
return resolved_addr4;
}
static grpc_resolved_address make_addr6(const uint8_t* data, size_t data_len) {
grpc_resolved_address resolved_addr6;
- struct sockaddr_in6* addr6 =
- reinterpret_cast<struct sockaddr_in6*>(resolved_addr6.addr);
+ grpc_sockaddr_in6* addr6 =
+ reinterpret_cast<grpc_sockaddr_in6*>(resolved_addr6.addr);
memset(&resolved_addr6, 0, sizeof(resolved_addr6));
- addr6->sin6_family = AF_INET6;
+ addr6->sin6_family = GRPC_AF_INET6;
GPR_ASSERT(data_len == sizeof(addr6->sin6_addr.s6_addr));
memcpy(&addr6->sin6_addr.s6_addr, data, data_len);
- addr6->sin6_port = htons(12345);
- resolved_addr6.len = sizeof(struct sockaddr_in6);
+ addr6->sin6_port = grpc_htons(12345);
+ resolved_addr6.len = static_cast<socklen_t>(sizeof(grpc_sockaddr_in6));
return resolved_addr6;
}
static void set_addr6_scope_id(grpc_resolved_address* addr, uint32_t scope_id) {
- struct sockaddr_in6* addr6 =
- reinterpret_cast<struct sockaddr_in6*>(addr->addr);
- GPR_ASSERT(addr6->sin6_family == AF_INET6);
+ grpc_sockaddr_in6* addr6 = reinterpret_cast<grpc_sockaddr_in6*>(addr->addr);
+ GPR_ASSERT(addr6->sin6_family == GRPC_AF_INET6);
addr6->sin6_scope_id = scope_id;
}
@@ -131,9 +131,9 @@ static void test_sockaddr_is_wildcard(void) {
grpc_resolved_address wild6;
grpc_resolved_address wild_mapped;
grpc_resolved_address dummy;
- struct sockaddr_in* wild4_addr;
- struct sockaddr_in6* wild6_addr;
- struct sockaddr_in6* wild_mapped_addr;
+ grpc_sockaddr_in* wild4_addr;
+ grpc_sockaddr_in6* wild6_addr;
+ grpc_sockaddr_in6* wild_mapped_addr;
int port;
gpr_log(GPR_INFO, "%s", "test_sockaddr_is_wildcard");
@@ -146,7 +146,7 @@ static void test_sockaddr_is_wildcard(void) {
port = -1;
GPR_ASSERT(grpc_sockaddr_is_wildcard(&wild4, &port));
GPR_ASSERT(port == 555);
- wild4_addr = reinterpret_cast<struct sockaddr_in*>(&wild4.addr);
+ wild4_addr = reinterpret_cast<grpc_sockaddr_in*>(&wild4.addr);
memset(&wild4_addr->sin_addr.s_addr, 0xbd, 1);
GPR_ASSERT(!grpc_sockaddr_is_wildcard(&wild4, &port));
@@ -154,7 +154,7 @@ static void test_sockaddr_is_wildcard(void) {
port = -1;
GPR_ASSERT(grpc_sockaddr_is_wildcard(&wild6, &port));
GPR_ASSERT(port == 555);
- wild6_addr = reinterpret_cast<struct sockaddr_in6*>(&wild6.addr);
+ wild6_addr = reinterpret_cast<grpc_sockaddr_in6*>(&wild6.addr);
memset(&wild6_addr->sin6_addr.s6_addr, 0xbd, 1);
GPR_ASSERT(!grpc_sockaddr_is_wildcard(&wild6, &port));
@@ -162,7 +162,7 @@ static void test_sockaddr_is_wildcard(void) {
port = -1;
GPR_ASSERT(grpc_sockaddr_is_wildcard(&wild_mapped, &port));
GPR_ASSERT(port == 555);
- wild_mapped_addr = reinterpret_cast<struct sockaddr_in6*>(&wild_mapped.addr);
+ wild_mapped_addr = reinterpret_cast<grpc_sockaddr_in6*>(&wild_mapped.addr);
memset(&wild_mapped_addr->sin6_addr.s6_addr, 0xbd, 1);
GPR_ASSERT(!grpc_sockaddr_is_wildcard(&wild_mapped, &port));
@@ -200,7 +200,7 @@ static void test_sockaddr_to_string(void) {
grpc_resolved_address input4;
grpc_resolved_address input6;
grpc_resolved_address dummy;
- struct sockaddr* dummy_addr;
+ grpc_sockaddr* dummy_addr;
gpr_log(GPR_INFO, "%s", "test_sockaddr_to_string");
@@ -237,7 +237,7 @@ static void test_sockaddr_to_string(void) {
expect_sockaddr_uri("ipv6:[::fffe:c000:263]:12345", &input6);
memset(&dummy, 0, sizeof(dummy));
- dummy_addr = reinterpret_cast<struct sockaddr*>(dummy.addr);
+ dummy_addr = reinterpret_cast<grpc_sockaddr*>(dummy.addr);
dummy_addr->sa_family = 123;
expect_sockaddr_str("(sockaddr family=123)", &dummy, 0);
expect_sockaddr_str("(sockaddr family=123)", &dummy, 1);
@@ -248,7 +248,7 @@ static void test_sockaddr_set_get_port(void) {
grpc_resolved_address input4;
grpc_resolved_address input6;
grpc_resolved_address dummy;
- struct sockaddr* dummy_addr;
+ grpc_sockaddr* dummy_addr;
gpr_log(GPR_DEBUG, "test_sockaddr_set_get_port");
@@ -263,7 +263,7 @@ static void test_sockaddr_set_get_port(void) {
GPR_ASSERT(grpc_sockaddr_get_port(&input6) == 54321);
memset(&dummy, 0, sizeof(dummy));
- dummy_addr = reinterpret_cast<struct sockaddr*>(dummy.addr);
+ dummy_addr = reinterpret_cast<grpc_sockaddr*>(dummy.addr);
dummy_addr->sa_family = 123;
GPR_ASSERT(grpc_sockaddr_get_port(&dummy) == 0);
GPR_ASSERT(grpc_sockaddr_set_port(&dummy, 1234) == 0);
diff --git a/test/core/iomgr/tcp_client_posix_test.cc b/test/core/iomgr/tcp_client_posix_test.cc
index 8a43170043..a4c38af86f 100644
--- a/test/core/iomgr/tcp_client_posix_test.cc
+++ b/test/core/iomgr/tcp_client_posix_test.cc
@@ -89,7 +89,7 @@ void test_succeeds(void) {
gpr_log(GPR_DEBUG, "test_succeeds");
memset(&resolved_addr, 0, sizeof(resolved_addr));
- resolved_addr.len = sizeof(struct sockaddr_in);
+ resolved_addr.len = static_cast<socklen_t>(sizeof(struct sockaddr_in));
addr->sin_family = AF_INET;
/* create a dummy server */
@@ -112,7 +112,7 @@ void test_succeeds(void) {
/* await the connection */
do {
- resolved_addr.len = sizeof(addr);
+ resolved_addr.len = static_cast<socklen_t>(sizeof(addr));
r = accept(svr_fd, reinterpret_cast<struct sockaddr*>(addr),
reinterpret_cast<socklen_t*>(&resolved_addr.len));
} while (r == -1 && errno == EINTR);
@@ -147,7 +147,7 @@ void test_fails(void) {
gpr_log(GPR_DEBUG, "test_fails");
memset(&resolved_addr, 0, sizeof(resolved_addr));
- resolved_addr.len = sizeof(struct sockaddr_in);
+ resolved_addr.len = static_cast<socklen_t>(sizeof(struct sockaddr_in));
addr->sin_family = AF_INET;
gpr_mu_lock(g_mu);
diff --git a/test/core/iomgr/tcp_server_posix_test.cc b/test/core/iomgr/tcp_server_posix_test.cc
index dde77da547..d646df1dae 100644
--- a/test/core/iomgr/tcp_server_posix_test.cc
+++ b/test/core/iomgr/tcp_server_posix_test.cc
@@ -188,7 +188,7 @@ static void test_no_op_with_port(void) {
LOG_TEST("test_no_op_with_port");
memset(&resolved_addr, 0, sizeof(resolved_addr));
- resolved_addr.len = sizeof(struct sockaddr_in);
+ resolved_addr.len = static_cast<socklen_t>(sizeof(struct sockaddr_in));
addr->sin_family = AF_INET;
int port = -1;
GPR_ASSERT(grpc_tcp_server_add_port(s, &resolved_addr, &port) ==
@@ -209,7 +209,7 @@ static void test_no_op_with_port_and_start(void) {
int port = -1;
memset(&resolved_addr, 0, sizeof(resolved_addr));
- resolved_addr.len = sizeof(struct sockaddr_in);
+ resolved_addr.len = static_cast<socklen_t>(sizeof(struct sockaddr_in));
addr->sin_family = AF_INET;
GPR_ASSERT(grpc_tcp_server_add_port(s, &resolved_addr, &port) ==
GRPC_ERROR_NONE &&
@@ -314,8 +314,8 @@ static void test_connect(size_t num_connects,
dst_addrs != nullptr ? "<specific>" : "::", test_dst_addrs);
memset(&resolved_addr, 0, sizeof(resolved_addr));
memset(&resolved_addr1, 0, sizeof(resolved_addr1));
- resolved_addr.len = sizeof(struct sockaddr_storage);
- resolved_addr1.len = sizeof(struct sockaddr_storage);
+ resolved_addr.len = static_cast<socklen_t>(sizeof(struct sockaddr_storage));
+ resolved_addr1.len = static_cast<socklen_t>(sizeof(struct sockaddr_storage));
addr->ss_family = addr1->ss_family = AF_INET;
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"grpc_tcp_server_add_port",
@@ -387,7 +387,7 @@ static void test_connect(size_t num_connects,
size_t connect_num;
test_addr dst;
GPR_ASSERT(fd >= 0);
- dst.addr.len = sizeof(dst.addr.addr);
+ dst.addr.len = static_cast<socklen_t>(sizeof(dst.addr.addr));
GPR_ASSERT(getsockname(fd, (struct sockaddr*)dst.addr.addr,
(socklen_t*)&dst.addr.len) == 0);
GPR_ASSERT(dst.addr.len <= sizeof(dst.addr.addr));
@@ -460,10 +460,10 @@ int main(int argc, char** argv) {
continue;
} else if (ifa_it->ifa_addr->sa_family == AF_INET) {
dst_addrs->addrs[dst_addrs->naddrs].addr.len =
- sizeof(struct sockaddr_in);
+ static_cast<socklen_t>(sizeof(struct sockaddr_in));
} else if (ifa_it->ifa_addr->sa_family == AF_INET6) {
dst_addrs->addrs[dst_addrs->naddrs].addr.len =
- sizeof(struct sockaddr_in6);
+ static_cast<socklen_t>(sizeof(struct sockaddr_in6));
} else {
continue;
}
diff --git a/test/core/iomgr/timer_heap_test.cc b/test/core/iomgr/timer_heap_test.cc
index 08f5d632e3..ebe5e32f3a 100644
--- a/test/core/iomgr/timer_heap_test.cc
+++ b/test/core/iomgr/timer_heap_test.cc
@@ -18,9 +18,6 @@
#include "src/core/lib/iomgr/port.h"
-// This test only works with the generic timer implementation
-#ifdef GRPC_TIMER_USE_GENERIC
-
#include "src/core/lib/iomgr/timer_heap.h"
#include <stdlib.h>
@@ -299,9 +296,3 @@ int main(int argc, char** argv) {
return 0;
}
-
-#else /* GRPC_TIMER_USE_GENERIC */
-
-int main(int argc, char** argv) { return 1; }
-
-#endif /* GRPC_TIMER_USE_GENERIC */
diff --git a/test/core/iomgr/timer_list_test.cc b/test/core/iomgr/timer_list_test.cc
index deb8c4d87e..b1d919b292 100644
--- a/test/core/iomgr/timer_list_test.cc
+++ b/test/core/iomgr/timer_list_test.cc
@@ -19,8 +19,9 @@
#include "src/core/lib/iomgr/port.h"
// This test only works with the generic timer implementation
-#ifdef GRPC_TIMER_USE_GENERIC
+#ifndef GRPC_CUSTOM_SOCKET
+#include "src/core/lib/iomgr/iomgr_internal.h"
#include "src/core/lib/iomgr/timer.h"
#include <string.h>
@@ -153,15 +154,19 @@ void destruction_test(void) {
int main(int argc, char** argv) {
grpc_test_init(argc, argv);
grpc_core::ExecCtx::GlobalInit();
+ grpc_core::ExecCtx exec_ctx;
+ grpc_determine_iomgr_platform();
+ grpc_iomgr_platform_init();
gpr_set_log_verbosity(GPR_LOG_SEVERITY_DEBUG);
add_test();
destruction_test();
+ grpc_iomgr_platform_shutdown();
grpc_core::ExecCtx::GlobalShutdown();
return 0;
}
-#else /* GRPC_TIMER_USE_GENERIC */
+#else /* GRPC_CUSTOM_SOCKET */
int main(int argc, char** argv) { return 1; }
-#endif /* GRPC_TIMER_USE_GENERIC */
+#endif /* GRPC_CUSTOM_SOCKET */
diff --git a/test/core/iomgr/udp_server_test.cc b/test/core/iomgr/udp_server_test.cc
index 60f293972e..d167c0131f 100644
--- a/test/core/iomgr/udp_server_test.cc
+++ b/test/core/iomgr/udp_server_test.cc
@@ -40,6 +40,7 @@
#include "src/core/lib/iomgr/ev_posix.h"
#include "src/core/lib/iomgr/iomgr.h"
#include "src/core/lib/iomgr/socket_factory_posix.h"
+#include "src/core/lib/iomgr/socket_utils_posix.h"
#include "test/core/util/test_config.h"
#define LOG_TEST(x) gpr_log(GPR_INFO, "%s", #x)
@@ -55,6 +56,8 @@ static int g_number_of_starts = 0;
int rcv_buf_size = 1024;
int snd_buf_size = 1024;
+static int g_num_listeners = 1;
+
class TestGrpcUdpHandler : public GrpcUdpHandler {
public:
TestGrpcUdpHandler(grpc_fd* emfd, void* user_data)
@@ -75,6 +78,7 @@ class TestGrpcUdpHandler : public GrpcUdpHandler {
g_number_of_reads++;
g_number_of_bytes_read += static_cast<int>(byte_count);
+ gpr_log(GPR_DEBUG, "receive %zu on handler %p", byte_count, this);
GPR_ASSERT(GRPC_LOG_IF_ERROR("pollset_kick",
grpc_pollset_kick(g_pollset, nullptr)));
gpr_mu_unlock(g_mu);
@@ -210,10 +214,11 @@ static void test_no_op_with_port(void) {
LOG_TEST("test_no_op_with_port");
memset(&resolved_addr, 0, sizeof(resolved_addr));
- resolved_addr.len = sizeof(struct sockaddr_in);
+ resolved_addr.len = static_cast<socklen_t>(sizeof(struct sockaddr_in));
addr->sin_family = AF_INET;
GPR_ASSERT(grpc_udp_server_add_port(s, &resolved_addr, rcv_buf_size,
- snd_buf_size, &handler_factory));
+ snd_buf_size, &handler_factory,
+ g_num_listeners));
grpc_udp_server_destroy(s, nullptr);
@@ -241,12 +246,13 @@ static void test_no_op_with_port_and_socket_factory(void) {
LOG_TEST("test_no_op_with_port_and_socket_factory");
memset(&resolved_addr, 0, sizeof(resolved_addr));
- resolved_addr.len = sizeof(struct sockaddr_in);
+ resolved_addr.len = static_cast<socklen_t>(sizeof(struct sockaddr_in));
addr->sin_family = AF_INET;
GPR_ASSERT(grpc_udp_server_add_port(s, &resolved_addr, rcv_buf_size,
- snd_buf_size, &handler_factory));
- GPR_ASSERT(socket_factory->number_of_socket_calls == 1);
- GPR_ASSERT(socket_factory->number_of_bind_calls == 1);
+ snd_buf_size, &handler_factory,
+ g_num_listeners));
+ GPR_ASSERT(socket_factory->number_of_socket_calls == g_num_listeners);
+ GPR_ASSERT(socket_factory->number_of_bind_calls == g_num_listeners);
grpc_udp_server_destroy(s, nullptr);
@@ -268,18 +274,19 @@ static void test_no_op_with_port_and_start(void) {
LOG_TEST("test_no_op_with_port_and_start");
memset(&resolved_addr, 0, sizeof(resolved_addr));
- resolved_addr.len = sizeof(struct sockaddr_in);
+ resolved_addr.len = static_cast<socklen_t>(sizeof(struct sockaddr_in));
addr->sin_family = AF_INET;
GPR_ASSERT(grpc_udp_server_add_port(s, &resolved_addr, rcv_buf_size,
- snd_buf_size, &handler_factory));
+ snd_buf_size, &handler_factory,
+ g_num_listeners));
grpc_udp_server_start(s, nullptr, 0, nullptr);
- GPR_ASSERT(g_number_of_starts == 1);
+ GPR_ASSERT(g_number_of_starts == g_num_listeners);
grpc_udp_server_destroy(s, nullptr);
/* The server had a single FD, which is orphaned exactly once in *
* grpc_udp_server_destroy. */
- GPR_ASSERT(g_number_of_orphan_calls == 1);
+ GPR_ASSERT(g_number_of_orphan_calls == g_num_listeners);
shutdown_and_destroy_pollset();
}
@@ -301,10 +308,11 @@ static void test_receive(int number_of_clients) {
g_number_of_orphan_calls = 0;
memset(&resolved_addr, 0, sizeof(resolved_addr));
- resolved_addr.len = sizeof(struct sockaddr_storage);
+ resolved_addr.len = static_cast<socklen_t>(sizeof(struct sockaddr_storage));
addr->ss_family = AF_INET;
GPR_ASSERT(grpc_udp_server_add_port(s, &resolved_addr, rcv_buf_size,
- snd_buf_size, &handler_factory));
+ snd_buf_size, &handler_factory,
+ g_num_listeners));
svrfd = grpc_udp_server_get_fd(s, 0);
GPR_ASSERT(svrfd >= 0);
@@ -347,13 +355,16 @@ static void test_receive(int number_of_clients) {
/* The server had a single FD, which is orphaned exactly once in *
* grpc_udp_server_destroy. */
- GPR_ASSERT(g_number_of_orphan_calls == 1);
+ GPR_ASSERT(g_number_of_orphan_calls == g_num_listeners);
shutdown_and_destroy_pollset();
}
int main(int argc, char** argv) {
grpc_test_init(argc, argv);
grpc_init();
+ if (grpc_is_socket_reuse_port_supported()) {
+ g_num_listeners = 10;
+ }
{
grpc_core::ExecCtx exec_ctx;
g_pollset = static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
diff --git a/test/core/iomgr/wakeup_fd_cv_test.cc b/test/core/iomgr/wakeup_fd_cv_test.cc
index 9bd7c6e47e..f297a569d2 100644
--- a/test/core/iomgr/wakeup_fd_cv_test.cc
+++ b/test/core/iomgr/wakeup_fd_cv_test.cc
@@ -225,7 +225,7 @@ int main(int argc, char** argv) {
grpc_poll_function = &mock_poll;
gpr_mu_init(&poll_mu);
gpr_cv_init(&poll_cv);
-
+ grpc_determine_iomgr_platform();
grpc_iomgr_platform_init();
test_many_fds();
grpc_iomgr_platform_shutdown();
diff --git a/test/core/security/BUILD b/test/core/security/BUILD
index 68de2d169f..70bcc8c9c3 100644
--- a/test/core/security/BUILD
+++ b/test/core/security/BUILD
@@ -21,6 +21,18 @@ grpc_package(name = "test/core/security")
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_fuzzer(
+ name = "alts_credentials_fuzzer",
+ srcs = ["alts_credentials_fuzzer.cc"],
+ language = "C++",
+ corpus = "corpus/alts_credentials_corpus",
+ deps = [
+ "//:gpr",
+ "//:grpc",
+ "//test/core/util:grpc_test_util",
+ ],
+)
+
+grpc_fuzzer(
name = "ssl_server_fuzzer",
srcs = ["ssl_server_fuzzer.cc"],
language = "C++",
@@ -167,6 +179,9 @@ grpc_cc_test(
srcs = ["check_gcp_environment_linux_test.cc"],
language = "C++",
deps = [
+ "//:alts_util",
+ "//:gpr",
+ "//:gpr_base",
"//:grpc",
],
)
@@ -176,6 +191,9 @@ grpc_cc_test(
srcs = ["check_gcp_environment_windows_test.cc"],
language = "C++",
deps = [
+ "//:alts_util",
+ "//:gpr",
+ "//:gpr_base",
"//:grpc",
],
)
@@ -185,6 +203,8 @@ grpc_cc_test(
srcs = ["grpc_alts_credentials_options_test.cc"],
language = "C++",
deps = [
+ "//:alts_util",
+ "//:gpr",
"//:grpc",
],
)
@@ -194,6 +214,11 @@ grpc_cc_test(
srcs = ["alts_security_connector_test.cc"],
language = "C++",
deps = [
+ "//:gpr",
"//:grpc",
+ "//:grpc_base_c",
+ "//:grpc_secure",
+ "//:tsi",
+ "//:tsi_interface",
],
)
diff --git a/test/core/security/alts_credentials_fuzzer.cc b/test/core/security/alts_credentials_fuzzer.cc
new file mode 100644
index 0000000000..bf18f0a589
--- /dev/null
+++ b/test/core/security/alts_credentials_fuzzer.cc
@@ -0,0 +1,120 @@
+/*
+ *
+ * Copyright 2018 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <string.h>
+
+#include <grpc/grpc.h>
+#include <grpc/grpc_security.h>
+#include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
+#include <grpc/support/string_util.h>
+#include "test/core/util/fuzzer_util.h"
+#include "test/core/util/memory_counters.h"
+
+#include "src/core/lib/gpr/env.h"
+#include "src/core/lib/security/credentials/alts/alts_credentials.h"
+#include "src/core/lib/security/credentials/alts/check_gcp_environment.h"
+#include "src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h"
+
+using grpc_core::testing::grpc_fuzzer_get_next_byte;
+using grpc_core::testing::grpc_fuzzer_get_next_string;
+using grpc_core::testing::input_stream;
+
+// Logging
+bool squelch = true;
+bool leak_check = true;
+
+static void dont_log(gpr_log_func_args* args) {}
+
+// Add a random number of target service accounts to client options.
+static void read_target_service_accounts(
+ input_stream* inp, grpc_alts_credentials_options* options) {
+ size_t n = grpc_fuzzer_get_next_byte(inp);
+ for (size_t i = 0; i < n; i++) {
+ char* service_account = grpc_fuzzer_get_next_string(inp, nullptr);
+ if (service_account != nullptr) {
+ grpc_alts_credentials_client_options_add_target_service_account(
+ options, service_account);
+ gpr_free(service_account);
+ }
+ }
+ // Added to improve code coverage.
+ grpc_alts_credentials_client_options_add_target_service_account(options,
+ nullptr);
+ grpc_alts_credentials_client_options_add_target_service_account(
+ nullptr, "this is service account");
+}
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ char* grpc_trace_fuzzer = gpr_getenv("GRPC_TRACE_FUZZER");
+ if (squelch && grpc_trace_fuzzer == nullptr) {
+ gpr_set_log_function(dont_log);
+ }
+ gpr_free(grpc_trace_fuzzer);
+ struct grpc_memory_counters counters;
+ if (leak_check) {
+ grpc_memory_counters_init();
+ }
+ input_stream inp = {data, data + size};
+ grpc_init();
+ bool is_on_gcp = grpc_alts_is_running_on_gcp();
+ while (inp.cur != inp.end) {
+ bool enable_untrusted_alts = grpc_fuzzer_get_next_byte(&inp) & 0x01;
+ char* handshaker_service_url =
+ grpc_fuzzer_get_next_byte(&inp) & 0x01
+ ? grpc_fuzzer_get_next_string(&inp, nullptr)
+ : nullptr;
+ if (grpc_fuzzer_get_next_byte(&inp) & 0x01) {
+ // Test ALTS channel credentials.
+ grpc_alts_credentials_options* options =
+ grpc_alts_credentials_client_options_create();
+ read_target_service_accounts(&inp, options);
+ grpc_channel_credentials* cred = grpc_alts_credentials_create_customized(
+ options, handshaker_service_url, enable_untrusted_alts);
+ if (!enable_untrusted_alts && !is_on_gcp) {
+ GPR_ASSERT(cred == nullptr);
+ } else {
+ GPR_ASSERT(cred != nullptr);
+ }
+ grpc_channel_credentials_release(cred);
+ grpc_alts_credentials_options_destroy(options);
+ } else {
+ // Test ALTS server credentials.
+ grpc_alts_credentials_options* options =
+ grpc_alts_credentials_server_options_create();
+ grpc_server_credentials* cred =
+ grpc_alts_server_credentials_create_customized(
+ options, handshaker_service_url, enable_untrusted_alts);
+ if (!enable_untrusted_alts && !is_on_gcp) {
+ GPR_ASSERT(cred == nullptr);
+ } else {
+ GPR_ASSERT(cred != nullptr);
+ }
+ grpc_server_credentials_release(cred);
+ grpc_alts_credentials_options_destroy(options);
+ }
+ gpr_free(handshaker_service_url);
+ }
+ grpc_shutdown();
+ if (leak_check) {
+ counters = grpc_memory_counters_snapshot();
+ grpc_memory_counters_destroy();
+ GPR_ASSERT(counters.total_size_relative == 0);
+ }
+ return 0;
+}
diff --git a/test/core/security/corpus/alts_credentials_corpus/0149b46b88d583e05be0fb1423d10f2a14d36c48 b/test/core/security/corpus/alts_credentials_corpus/0149b46b88d583e05be0fb1423d10f2a14d36c48
new file mode 100644
index 0000000000..c062c7f179
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/0149b46b88d583e05be0fb1423d10f2a14d36c48
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/047fc351e73f760d329d5a8845944720be9ce773 b/test/core/security/corpus/alts_credentials_corpus/047fc351e73f760d329d5a8845944720be9ce773
new file mode 100644
index 0000000000..d943cfeacd
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/047fc351e73f760d329d5a8845944720be9ce773
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/04ef96c66d8222d1a2c07e6b2a6548e6a527042b b/test/core/security/corpus/alts_credentials_corpus/04ef96c66d8222d1a2c07e6b2a6548e6a527042b
new file mode 100644
index 0000000000..e7346f33ef
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/04ef96c66d8222d1a2c07e6b2a6548e6a527042b
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/05a7e16c1d7f92111f43e9c777421879920e79a4 b/test/core/security/corpus/alts_credentials_corpus/05a7e16c1d7f92111f43e9c777421879920e79a4
new file mode 100644
index 0000000000..43b8b47d03
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/05a7e16c1d7f92111f43e9c777421879920e79a4
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/063eb46f202fdfe7935c30ca38d7eb81c82db419 b/test/core/security/corpus/alts_credentials_corpus/063eb46f202fdfe7935c30ca38d7eb81c82db419
new file mode 100644
index 0000000000..5b30f12418
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/063eb46f202fdfe7935c30ca38d7eb81c82db419
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/064773597c295fa871c184fc12d17b6de8aab31b b/test/core/security/corpus/alts_credentials_corpus/064773597c295fa871c184fc12d17b6de8aab31b
new file mode 100644
index 0000000000..758709b022
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/064773597c295fa871c184fc12d17b6de8aab31b
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/087449740758b114d16790067707934479946bd6 b/test/core/security/corpus/alts_credentials_corpus/087449740758b114d16790067707934479946bd6
new file mode 100644
index 0000000000..099636f9ca
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/087449740758b114d16790067707934479946bd6
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/0a5d068feb57a2782c6eba57b637abe8668ac82f b/test/core/security/corpus/alts_credentials_corpus/0a5d068feb57a2782c6eba57b637abe8668ac82f
new file mode 100644
index 0000000000..fd7d7c8ebc
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/0a5d068feb57a2782c6eba57b637abe8668ac82f
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/0b81e6d89bf7df80e87e5ee7c49f7cc1431f77e8 b/test/core/security/corpus/alts_credentials_corpus/0b81e6d89bf7df80e87e5ee7c49f7cc1431f77e8
new file mode 100644
index 0000000000..a40664b4ef
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/0b81e6d89bf7df80e87e5ee7c49f7cc1431f77e8
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/11409339cec708a5e353893101bfe76364337d5c b/test/core/security/corpus/alts_credentials_corpus/11409339cec708a5e353893101bfe76364337d5c
new file mode 100644
index 0000000000..c8b350d21c
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/11409339cec708a5e353893101bfe76364337d5c
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/147696a264cd6f197adb7c68aff834c30b1b77f8 b/test/core/security/corpus/alts_credentials_corpus/147696a264cd6f197adb7c68aff834c30b1b77f8
new file mode 100644
index 0000000000..5f68d8a10f
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/147696a264cd6f197adb7c68aff834c30b1b77f8
@@ -0,0 +1 @@
+ø+ú \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/160e5cac38c5c9e919ed6e4fbafee76907d63044 b/test/core/security/corpus/alts_credentials_corpus/160e5cac38c5c9e919ed6e4fbafee76907d63044
new file mode 100644
index 0000000000..c11ad6674d
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/160e5cac38c5c9e919ed6e4fbafee76907d63044
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/173d02167db431040b0540d98f6fc5e8b456587d b/test/core/security/corpus/alts_credentials_corpus/173d02167db431040b0540d98f6fc5e8b456587d
new file mode 100644
index 0000000000..662cc9bc79
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/173d02167db431040b0540d98f6fc5e8b456587d
@@ -0,0 +1 @@
+òÒÒ \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/18a3fe239806b3c7d1af24bcd2bd23aeeb072d5c b/test/core/security/corpus/alts_credentials_corpus/18a3fe239806b3c7d1af24bcd2bd23aeeb072d5c
new file mode 100644
index 0000000000..9239e10f44
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/18a3fe239806b3c7d1af24bcd2bd23aeeb072d5c
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/195abd83b2e9d32b1b5b854fe33da44b6db40880 b/test/core/security/corpus/alts_credentials_corpus/195abd83b2e9d32b1b5b854fe33da44b6db40880
new file mode 100644
index 0000000000..db7815ee2f
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/195abd83b2e9d32b1b5b854fe33da44b6db40880
@@ -0,0 +1 @@
+apÿì~!õìA~;ì \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/19af2509c7d84334b9ec64de4767a07d5294fd72 b/test/core/security/corpus/alts_credentials_corpus/19af2509c7d84334b9ec64de4767a07d5294fd72
new file mode 100644
index 0000000000..b87c814597
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/19af2509c7d84334b9ec64de4767a07d5294fd72
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/1b9864b948fcf08b062fd4401ef55b214c259535 b/test/core/security/corpus/alts_credentials_corpus/1b9864b948fcf08b062fd4401ef55b214c259535
new file mode 100644
index 0000000000..8cb97c5ea7
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/1b9864b948fcf08b062fd4401ef55b214c259535
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/1edddfa67de854d7faaba41418fda845e9c6a89d b/test/core/security/corpus/alts_credentials_corpus/1edddfa67de854d7faaba41418fda845e9c6a89d
new file mode 100644
index 0000000000..035f07c06b
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/1edddfa67de854d7faaba41418fda845e9c6a89d
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/20031bb00e6608e1b570aa96e6afb9de06d42167 b/test/core/security/corpus/alts_credentials_corpus/20031bb00e6608e1b570aa96e6afb9de06d42167
new file mode 100644
index 0000000000..27753dfa09
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/20031bb00e6608e1b570aa96e6afb9de06d42167
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/22b4c7ce7db99b0df63c9eae9265de484b695922 b/test/core/security/corpus/alts_credentials_corpus/22b4c7ce7db99b0df63c9eae9265de484b695922
new file mode 100644
index 0000000000..ab8f18d934
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/22b4c7ce7db99b0df63c9eae9265de484b695922
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/27416437ad287bd3cc1c5efdecebc39f20df73c1 b/test/core/security/corpus/alts_credentials_corpus/27416437ad287bd3cc1c5efdecebc39f20df73c1
new file mode 100644
index 0000000000..c400e3e3af
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/27416437ad287bd3cc1c5efdecebc39f20df73c1
@@ -0,0 +1 @@
+Ä=ļyyyyy‡†yyyyz \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/27e8cd785c2b9346f68dba75761b52fbabaf2b72 b/test/core/security/corpus/alts_credentials_corpus/27e8cd785c2b9346f68dba75761b52fbabaf2b72
new file mode 100644
index 0000000000..746dee96af
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/27e8cd785c2b9346f68dba75761b52fbabaf2b72
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/28236f860d3d8e5ea11176746cb4c1c5c4f1f6c0 b/test/core/security/corpus/alts_credentials_corpus/28236f860d3d8e5ea11176746cb4c1c5c4f1f6c0
new file mode 100644
index 0000000000..982c97b1ed
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/28236f860d3d8e5ea11176746cb4c1c5c4f1f6c0
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/29e15b492c5a409938092a30c003c5c34df7e283 b/test/core/security/corpus/alts_credentials_corpus/29e15b492c5a409938092a30c003c5c34df7e283
new file mode 100644
index 0000000000..c3e5b25e0d
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/29e15b492c5a409938092a30c003c5c34df7e283
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/2a47864d77749aa042b772895dbdf46f608ccc6d b/test/core/security/corpus/alts_credentials_corpus/2a47864d77749aa042b772895dbdf46f608ccc6d
new file mode 100644
index 0000000000..141d94d982
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/2a47864d77749aa042b772895dbdf46f608ccc6d
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/2cca5cb1b135c35f6e5e1ec4c37deb9e12d37dc0 b/test/core/security/corpus/alts_credentials_corpus/2cca5cb1b135c35f6e5e1ec4c37deb9e12d37dc0
new file mode 100644
index 0000000000..a956708b56
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/2cca5cb1b135c35f6e5e1ec4c37deb9e12d37dc0
@@ -0,0 +1,2 @@
+ïï \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/2df27b6c42dbaee382a29a87338d64ee87354acb b/test/core/security/corpus/alts_credentials_corpus/2df27b6c42dbaee382a29a87338d64ee87354acb
new file mode 100644
index 0000000000..a35f0e83cd
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/2df27b6c42dbaee382a29a87338d64ee87354acb
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/2e9ddd1339d8e599cef658a08965985c4f45e428 b/test/core/security/corpus/alts_credentials_corpus/2e9ddd1339d8e599cef658a08965985c4f45e428
new file mode 100644
index 0000000000..17c98e7ca0
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/2e9ddd1339d8e599cef658a08965985c4f45e428
@@ -0,0 +1,2 @@
+ïe \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/31a2d12a84a7a56ace831a9668d6ab4847390679 b/test/core/security/corpus/alts_credentials_corpus/31a2d12a84a7a56ace831a9668d6ab4847390679
new file mode 100644
index 0000000000..745dc42bc0
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/31a2d12a84a7a56ace831a9668d6ab4847390679
@@ -0,0 +1,2 @@
+ïé \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/33cb9ec0ce3538ed6079b5fcb127649a5d05955b b/test/core/security/corpus/alts_credentials_corpus/33cb9ec0ce3538ed6079b5fcb127649a5d05955b
new file mode 100644
index 0000000000..293176466e
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/33cb9ec0ce3538ed6079b5fcb127649a5d05955b
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/348d9ae6eebb2e1644addf7f07231d108cf6f3b8 b/test/core/security/corpus/alts_credentials_corpus/348d9ae6eebb2e1644addf7f07231d108cf6f3b8
new file mode 100644
index 0000000000..02326f0b69
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/348d9ae6eebb2e1644addf7f07231d108cf6f3b8
@@ -0,0 +1 @@
+òÒä \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/359f76f3c802292e92b0640de2bfe051e780a3b6 b/test/core/security/corpus/alts_credentials_corpus/359f76f3c802292e92b0640de2bfe051e780a3b6
new file mode 100644
index 0000000000..f31c54bad8
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/359f76f3c802292e92b0640de2bfe051e780a3b6
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/35a479988e965a6e3e75138b64b0bd1f45073e2f b/test/core/security/corpus/alts_credentials_corpus/35a479988e965a6e3e75138b64b0bd1f45073e2f
new file mode 100644
index 0000000000..4e44bcc27f
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/35a479988e965a6e3e75138b64b0bd1f45073e2f
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/362b00d713686ff70cb0199f3d7d0058e5a1a27a b/test/core/security/corpus/alts_credentials_corpus/362b00d713686ff70cb0199f3d7d0058e5a1a27a
new file mode 100644
index 0000000000..3e22fca175
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/362b00d713686ff70cb0199f3d7d0058e5a1a27a
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/3849c1625071791ceae709b9c6c705b28d099d67 b/test/core/security/corpus/alts_credentials_corpus/3849c1625071791ceae709b9c6c705b28d099d67
new file mode 100644
index 0000000000..5bc905de15
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/3849c1625071791ceae709b9c6c705b28d099d67
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/39ef03c66ee2d4bcfb6c8da50486dcd40f02fb12 b/test/core/security/corpus/alts_credentials_corpus/39ef03c66ee2d4bcfb6c8da50486dcd40f02fb12
new file mode 100644
index 0000000000..467004c97d
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/39ef03c66ee2d4bcfb6c8da50486dcd40f02fb12
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/3a3ca061863499ebc171a4f910fa1b49523baad4 b/test/core/security/corpus/alts_credentials_corpus/3a3ca061863499ebc171a4f910fa1b49523baad4
new file mode 100644
index 0000000000..97f09bf5c7
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/3a3ca061863499ebc171a4f910fa1b49523baad4
@@ -0,0 +1 @@
+úÒû9 \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/3a890f3fd01b048ac9db65a9a9b4f4443268b91a b/test/core/security/corpus/alts_credentials_corpus/3a890f3fd01b048ac9db65a9a9b4f4443268b91a
new file mode 100644
index 0000000000..97b05e80ba
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/3a890f3fd01b048ac9db65a9a9b4f4443268b91a
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/3b9554038a425bd1fae057ba41f9366bb467e946 b/test/core/security/corpus/alts_credentials_corpus/3b9554038a425bd1fae057ba41f9366bb467e946
new file mode 100644
index 0000000000..d0ef6342d0
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/3b9554038a425bd1fae057ba41f9366bb467e946
@@ -0,0 +1 @@
+„ÜðððððððððððððððððððððððððððÔððððòððððððÔÜÜÜ \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/3ce0ae4aa226f205a3a4e66bbb253419d9d754bf b/test/core/security/corpus/alts_credentials_corpus/3ce0ae4aa226f205a3a4e66bbb253419d9d754bf
new file mode 100644
index 0000000000..08e6df0ee2
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/3ce0ae4aa226f205a3a4e66bbb253419d9d754bf
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/3dccc5523986c37e27684659bba8a1037e7a92e8 b/test/core/security/corpus/alts_credentials_corpus/3dccc5523986c37e27684659bba8a1037e7a92e8
new file mode 100644
index 0000000000..09b735e831
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/3dccc5523986c37e27684659bba8a1037e7a92e8
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/3e0908c15b1cede4541d25f388b1345e8641e221 b/test/core/security/corpus/alts_credentials_corpus/3e0908c15b1cede4541d25f388b1345e8641e221
new file mode 100644
index 0000000000..eabd458c03
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/3e0908c15b1cede4541d25f388b1345e8641e221
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/3fcb181ff6a8c8e2ba38ed34cf78f7482eb55cb7 b/test/core/security/corpus/alts_credentials_corpus/3fcb181ff6a8c8e2ba38ed34cf78f7482eb55cb7
new file mode 100644
index 0000000000..bbef93b5ad
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/3fcb181ff6a8c8e2ba38ed34cf78f7482eb55cb7
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/41c9b5f720eb8f8fa04c840375a881781a849b43 b/test/core/security/corpus/alts_credentials_corpus/41c9b5f720eb8f8fa04c840375a881781a849b43
new file mode 100644
index 0000000000..d611c732db
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/41c9b5f720eb8f8fa04c840375a881781a849b43
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/4257a018f08f13a3a9adc848ef808e1be50bc4cf b/test/core/security/corpus/alts_credentials_corpus/4257a018f08f13a3a9adc848ef808e1be50bc4cf
new file mode 100644
index 0000000000..607c97117a
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/4257a018f08f13a3a9adc848ef808e1be50bc4cf
@@ -0,0 +1,2 @@
+òÓ99999999999999999999999999999999999¬¬¬¬¬¬¬¬¬ÿÿÿÿÿÿÿÿÿÿÿÿÿ/////ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
+ÿÿÿÿÿÿÿÿÿÿ²²²²²²²ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿNSt6locale5 \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/42dfc5c4d13261b7259e65cd692df9c9d607194e b/test/core/security/corpus/alts_credentials_corpus/42dfc5c4d13261b7259e65cd692df9c9d607194e
new file mode 100644
index 0000000000..48ffa853fb
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/42dfc5c4d13261b7259e65cd692df9c9d607194e
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/43144664aedb585d45d42aa5249ddbfe81afe470 b/test/core/security/corpus/alts_credentials_corpus/43144664aedb585d45d42aa5249ddbfe81afe470
new file mode 100644
index 0000000000..fee2672260
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/43144664aedb585d45d42aa5249ddbfe81afe470
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/43e5ad495a47593b17dbcbd3e70c2e25a417bb6e b/test/core/security/corpus/alts_credentials_corpus/43e5ad495a47593b17dbcbd3e70c2e25a417bb6e
new file mode 100644
index 0000000000..32ffc96267
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/43e5ad495a47593b17dbcbd3e70c2e25a417bb6e
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/446614e45b7bef49118b17e031c48faf167ebe3e b/test/core/security/corpus/alts_credentials_corpus/446614e45b7bef49118b17e031c48faf167ebe3e
new file mode 100644
index 0000000000..849aadf08a
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/446614e45b7bef49118b17e031c48faf167ebe3e
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/46492477fa84ca88e85df914801af0b09b0939f6 b/test/core/security/corpus/alts_credentials_corpus/46492477fa84ca88e85df914801af0b09b0939f6
new file mode 100644
index 0000000000..98885bcde8
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/46492477fa84ca88e85df914801af0b09b0939f6
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/47157f83b166b57e0052c98a65c6db864fa6cb9b b/test/core/security/corpus/alts_credentials_corpus/47157f83b166b57e0052c98a65c6db864fa6cb9b
new file mode 100644
index 0000000000..fad1e0faf1
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/47157f83b166b57e0052c98a65c6db864fa6cb9b
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/473fc9b6d768a925527d3ad805ca363d490dc741 b/test/core/security/corpus/alts_credentials_corpus/473fc9b6d768a925527d3ad805ca363d490dc741
new file mode 100644
index 0000000000..1775a17df6
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/473fc9b6d768a925527d3ad805ca363d490dc741
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/483c0b4015100eee00f6b23d1100d8c4953dd3b1 b/test/core/security/corpus/alts_credentials_corpus/483c0b4015100eee00f6b23d1100d8c4953dd3b1
new file mode 100644
index 0000000000..2d52687fda
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/483c0b4015100eee00f6b23d1100d8c4953dd3b1
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/48be2dc4cdc5462407b319caa855d976cda88153 b/test/core/security/corpus/alts_credentials_corpus/48be2dc4cdc5462407b319caa855d976cda88153
new file mode 100644
index 0000000000..c1c2cd98cf
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/48be2dc4cdc5462407b319caa855d976cda88153
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/4e84eb54a0e438052b0c2e83653135042d9eb59a b/test/core/security/corpus/alts_credentials_corpus/4e84eb54a0e438052b0c2e83653135042d9eb59a
new file mode 100644
index 0000000000..66b525f713
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/4e84eb54a0e438052b0c2e83653135042d9eb59a
@@ -0,0 +1 @@
+òÒ \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/50839d5c8bf33f0970986dcc4b73b024f11a95b7 b/test/core/security/corpus/alts_credentials_corpus/50839d5c8bf33f0970986dcc4b73b024f11a95b7
new file mode 100644
index 0000000000..9673f73c62
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/50839d5c8bf33f0970986dcc4b73b024f11a95b7
@@ -0,0 +1 @@
+òÿt_Ó ÿÿÿÿÿæææ&ææææææææææææææææææææææÿÿÿÿÿÿÿÿÿÿûÿÿÿÿÿÿÿÜ \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/523d964986d8ad966ae07e540a608681098813f9 b/test/core/security/corpus/alts_credentials_corpus/523d964986d8ad966ae07e540a608681098813f9
new file mode 100644
index 0000000000..06e05df73e
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/523d964986d8ad966ae07e540a608681098813f9
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/5410b8190c95dacd36d6e6ec75b7538a630e08de b/test/core/security/corpus/alts_credentials_corpus/5410b8190c95dacd36d6e6ec75b7538a630e08de
new file mode 100644
index 0000000000..4579c6fff2
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/5410b8190c95dacd36d6e6ec75b7538a630e08de
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/549b2891ac79f504a7c9ea00f6d7527c34ce04e6 b/test/core/security/corpus/alts_credentials_corpus/549b2891ac79f504a7c9ea00f6d7527c34ce04e6
new file mode 100644
index 0000000000..6f1a9ed509
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/549b2891ac79f504a7c9ea00f6d7527c34ce04e6
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/55321649e7b7f1b5664ae20724e683c930643fc4 b/test/core/security/corpus/alts_credentials_corpus/55321649e7b7f1b5664ae20724e683c930643fc4
new file mode 100644
index 0000000000..e38fd28e17
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/55321649e7b7f1b5664ae20724e683c930643fc4
@@ -0,0 +1 @@
+ò)Ò \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/55cc52f25865baee3e6e52c3110a9723caa2b3cb b/test/core/security/corpus/alts_credentials_corpus/55cc52f25865baee3e6e52c3110a9723caa2b3cb
new file mode 100644
index 0000000000..aae2fe5fe0
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/55cc52f25865baee3e6e52c3110a9723caa2b3cb
@@ -0,0 +1 @@
+òÒÎ \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/56c22410e3295ad03aa31552ab888f581756cc17 b/test/core/security/corpus/alts_credentials_corpus/56c22410e3295ad03aa31552ab888f581756cc17
new file mode 100644
index 0000000000..e5d7cf9d5d
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/56c22410e3295ad03aa31552ab888f581756cc17
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/5724a705b62a7548ba2df1abe4ef0c970c4e1bd2 b/test/core/security/corpus/alts_credentials_corpus/5724a705b62a7548ba2df1abe4ef0c970c4e1bd2
new file mode 100644
index 0000000000..b0875c947b
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/5724a705b62a7548ba2df1abe4ef0c970c4e1bd2
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/576a148c107d56861d1611641a6f7c7921061c5c b/test/core/security/corpus/alts_credentials_corpus/576a148c107d56861d1611641a6f7c7921061c5c
new file mode 100644
index 0000000000..6d91b58071
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/576a148c107d56861d1611641a6f7c7921061c5c
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/5a6b8263e8939f851cf5b1e347a33d97253b7b3d b/test/core/security/corpus/alts_credentials_corpus/5a6b8263e8939f851cf5b1e347a33d97253b7b3d
new file mode 100644
index 0000000000..add56cac16
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/5a6b8263e8939f851cf5b1e347a33d97253b7b3d
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/5ba93c9db0cff93f52b521d7420e43f6eda2784f b/test/core/security/corpus/alts_credentials_corpus/5ba93c9db0cff93f52b521d7420e43f6eda2784f
new file mode 100644
index 0000000000..f76dd238ad
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/5ba93c9db0cff93f52b521d7420e43f6eda2784f
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/5bd02a339fd7705449388580c75bfcc597aba954 b/test/core/security/corpus/alts_credentials_corpus/5bd02a339fd7705449388580c75bfcc597aba954
new file mode 100644
index 0000000000..f450932939
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/5bd02a339fd7705449388580c75bfcc597aba954
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/5bd6fb6fc4163bf3a9db6ddaf509dce8df8a5000 b/test/core/security/corpus/alts_credentials_corpus/5bd6fb6fc4163bf3a9db6ddaf509dce8df8a5000
new file mode 100644
index 0000000000..aea3da6970
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/5bd6fb6fc4163bf3a9db6ddaf509dce8df8a5000
@@ -0,0 +1 @@
+)applea.ÿÿÿÿ„ÜÜ.ÿßÿÿÿÿÿÜÿÿÿÜÿÿ„ÜÜ. \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/5d06fc38005503af3d084721c60e574fb9d2f370 b/test/core/security/corpus/alts_credentials_corpus/5d06fc38005503af3d084721c60e574fb9d2f370
new file mode 100644
index 0000000000..42eb673e51
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/5d06fc38005503af3d084721c60e574fb9d2f370
@@ -0,0 +1 @@
+ÓÓ× \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/5ddc10489ff3269bdaa3051b70fb7af455ee1104 b/test/core/security/corpus/alts_credentials_corpus/5ddc10489ff3269bdaa3051b70fb7af455ee1104
new file mode 100644
index 0000000000..79db88a7b3
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/5ddc10489ff3269bdaa3051b70fb7af455ee1104
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/5ea9d515f0d10b04f1356b9463139bfe121a6e4a b/test/core/security/corpus/alts_credentials_corpus/5ea9d515f0d10b04f1356b9463139bfe121a6e4a
new file mode 100644
index 0000000000..7efb47e7c8
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/5ea9d515f0d10b04f1356b9463139bfe121a6e4a
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/61c449793347cf2e1ed0c38d54d23c63dfaabeb8 b/test/core/security/corpus/alts_credentials_corpus/61c449793347cf2e1ed0c38d54d23c63dfaabeb8
new file mode 100644
index 0000000000..96031be7fc
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/61c449793347cf2e1ed0c38d54d23c63dfaabeb8
@@ -0,0 +1 @@
+òÿÿÿÿÿÿÿÿÿÿÿÿÿÿÝÿÿÿÿÿÿÿÿÿÿÿÿÿÿ \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/6287389c373e9788dcc04f9747b4be1fd1ef3028 b/test/core/security/corpus/alts_credentials_corpus/6287389c373e9788dcc04f9747b4be1fd1ef3028
new file mode 100644
index 0000000000..799bd0e6b0
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/6287389c373e9788dcc04f9747b4be1fd1ef3028
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/64d4de4d5aafab7ec388a7fe83066c1a4d1d9d68 b/test/core/security/corpus/alts_credentials_corpus/64d4de4d5aafab7ec388a7fe83066c1a4d1d9d68
new file mode 100644
index 0000000000..2e91965059
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/64d4de4d5aafab7ec388a7fe83066c1a4d1d9d68
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/651c37806d2ac579dcfc97643c3c1ea74dbb8774 b/test/core/security/corpus/alts_credentials_corpus/651c37806d2ac579dcfc97643c3c1ea74dbb8774
new file mode 100644
index 0000000000..618e514ec3
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/651c37806d2ac579dcfc97643c3c1ea74dbb8774
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/6551d02d20573cfa2944ec1f12b0c01f264a1326 b/test/core/security/corpus/alts_credentials_corpus/6551d02d20573cfa2944ec1f12b0c01f264a1326
new file mode 100644
index 0000000000..98056c073e
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/6551d02d20573cfa2944ec1f12b0c01f264a1326
@@ -0,0 +1 @@
+‚s \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/65f029414ee10e45ff4b9f305f7b472364cea538 b/test/core/security/corpus/alts_credentials_corpus/65f029414ee10e45ff4b9f305f7b472364cea538
new file mode 100644
index 0000000000..1c3a1a0d28
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/65f029414ee10e45ff4b9f305f7b472364cea538
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/68b75a17fe2db060df3e61a597650ba99079abbf b/test/core/security/corpus/alts_credentials_corpus/68b75a17fe2db060df3e61a597650ba99079abbf
new file mode 100644
index 0000000000..327dd390b9
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/68b75a17fe2db060df3e61a597650ba99079abbf
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/69e80594dbc5c4c648e39883a650b1760f20ab63 b/test/core/security/corpus/alts_credentials_corpus/69e80594dbc5c4c648e39883a650b1760f20ab63
new file mode 100644
index 0000000000..740b987b48
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/69e80594dbc5c4c648e39883a650b1760f20ab63
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/6cb47d0e640b4c41e32f13c0d64ee46eae1b80b5 b/test/core/security/corpus/alts_credentials_corpus/6cb47d0e640b4c41e32f13c0d64ee46eae1b80b5
new file mode 100644
index 0000000000..b22a010648
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/6cb47d0e640b4c41e32f13c0d64ee46eae1b80b5
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/6da5fe063432cb9094c7c083efdbbe5ba4246d18 b/test/core/security/corpus/alts_credentials_corpus/6da5fe063432cb9094c7c083efdbbe5ba4246d18
new file mode 100644
index 0000000000..993620ed92
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/6da5fe063432cb9094c7c083efdbbe5ba4246d18
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/6dd140da774d85f272fb587dc1b2a85d881a7c21 b/test/core/security/corpus/alts_credentials_corpus/6dd140da774d85f272fb587dc1b2a85d881a7c21
new file mode 100644
index 0000000000..d838739e6c
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/6dd140da774d85f272fb587dc1b2a85d881a7c21
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/6ddab273597d73be49e2307d68e00fa18bba4765 b/test/core/security/corpus/alts_credentials_corpus/6ddab273597d73be49e2307d68e00fa18bba4765
new file mode 100644
index 0000000000..3e74467a38
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/6ddab273597d73be49e2307d68e00fa18bba4765
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/6eaf85d84fbf47ea0619d0dba8d366f4e3ff0be6 b/test/core/security/corpus/alts_credentials_corpus/6eaf85d84fbf47ea0619d0dba8d366f4e3ff0be6
new file mode 100644
index 0000000000..42cddf7419
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/6eaf85d84fbf47ea0619d0dba8d366f4e3ff0be6
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/6f751cc09af8113f6ecd491b1830bd8454c4738d b/test/core/security/corpus/alts_credentials_corpus/6f751cc09af8113f6ecd491b1830bd8454c4738d
new file mode 100644
index 0000000000..a51a3d0f6c
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/6f751cc09af8113f6ecd491b1830bd8454c4738d
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/70d9eb29a70d483d07e2faca6b00098af78d1fff b/test/core/security/corpus/alts_credentials_corpus/70d9eb29a70d483d07e2faca6b00098af78d1fff
new file mode 100644
index 0000000000..e9fb9b9317
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/70d9eb29a70d483d07e2faca6b00098af78d1fff
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/7192effa1058382b379fb7b87f1acad5ac554d05 b/test/core/security/corpus/alts_credentials_corpus/7192effa1058382b379fb7b87f1acad5ac554d05
new file mode 100644
index 0000000000..23a3819ebe
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/7192effa1058382b379fb7b87f1acad5ac554d05
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/730e85d6a62e70cb6721009b903782ade4ff73a2 b/test/core/security/corpus/alts_credentials_corpus/730e85d6a62e70cb6721009b903782ade4ff73a2
new file mode 100644
index 0000000000..9c1e71c549
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/730e85d6a62e70cb6721009b903782ade4ff73a2
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/74002471a854059cb29de7cad8f9fb7adc3c5ec2 b/test/core/security/corpus/alts_credentials_corpus/74002471a854059cb29de7cad8f9fb7adc3c5ec2
new file mode 100644
index 0000000000..bb832313c7
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/74002471a854059cb29de7cad8f9fb7adc3c5ec2
@@ -0,0 +1,2 @@
+
+¡Š \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/747f2330cd1fc4a06d54b376a9a6528d0364f0ac b/test/core/security/corpus/alts_credentials_corpus/747f2330cd1fc4a06d54b376a9a6528d0364f0ac
new file mode 100644
index 0000000000..332ac4b672
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/747f2330cd1fc4a06d54b376a9a6528d0364f0ac
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/749d5d7a9e0b1545b297117e834462af32b3e230 b/test/core/security/corpus/alts_credentials_corpus/749d5d7a9e0b1545b297117e834462af32b3e230
new file mode 100644
index 0000000000..a00db592b0
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/749d5d7a9e0b1545b297117e834462af32b3e230
@@ -0,0 +1 @@
+aèÿÿ+ \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/77de0b1de120ac702ca45868b1008a48626daf12 b/test/core/security/corpus/alts_credentials_corpus/77de0b1de120ac702ca45868b1008a48626daf12
new file mode 100644
index 0000000000..352762cf75
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/77de0b1de120ac702ca45868b1008a48626daf12
@@ -0,0 +1 @@
+òÒ^ \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/792c67398bce19a4eeda32653c994436e79456e5 b/test/core/security/corpus/alts_credentials_corpus/792c67398bce19a4eeda32653c994436e79456e5
new file mode 100644
index 0000000000..08342871da
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/792c67398bce19a4eeda32653c994436e79456e5
@@ -0,0 +1 @@
+jþ ù \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/7a3022b248c8960289e4c80c7cc8df409499e5da b/test/core/security/corpus/alts_credentials_corpus/7a3022b248c8960289e4c80c7cc8df409499e5da
new file mode 100644
index 0000000000..f9ef6a4631
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/7a3022b248c8960289e4c80c7cc8df409499e5da
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/7a9372081294a6fbd3fecdd91b99589c98d4948e b/test/core/security/corpus/alts_credentials_corpus/7a9372081294a6fbd3fecdd91b99589c98d4948e
new file mode 100644
index 0000000000..7100f32821
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/7a9372081294a6fbd3fecdd91b99589c98d4948e
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/7bbe4ba828947550f4ad089d5989cb695ecbdb1b b/test/core/security/corpus/alts_credentials_corpus/7bbe4ba828947550f4ad089d5989cb695ecbdb1b
new file mode 100644
index 0000000000..44e3963031
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/7bbe4ba828947550f4ad089d5989cb695ecbdb1b
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/7f1ad514a96f0c3d5ca5d6f7880b929a65eeae96 b/test/core/security/corpus/alts_credentials_corpus/7f1ad514a96f0c3d5ca5d6f7880b929a65eeae96
new file mode 100644
index 0000000000..700c079449
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/7f1ad514a96f0c3d5ca5d6f7880b929a65eeae96
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/7f2b075f0b6707c38db851747e2578343eeab286 b/test/core/security/corpus/alts_credentials_corpus/7f2b075f0b6707c38db851747e2578343eeab286
new file mode 100644
index 0000000000..1f7b5d72ac
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/7f2b075f0b6707c38db851747e2578343eeab286
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/81ebc64bfde3fad37af5a58ef7f1c5c3c54c4b5d b/test/core/security/corpus/alts_credentials_corpus/81ebc64bfde3fad37af5a58ef7f1c5c3c54c4b5d
new file mode 100644
index 0000000000..d89f30fd4c
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/81ebc64bfde3fad37af5a58ef7f1c5c3c54c4b5d
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/82fae081afaea13831404024d39658344d56e1c6 b/test/core/security/corpus/alts_credentials_corpus/82fae081afaea13831404024d39658344d56e1c6
new file mode 100644
index 0000000000..bc3cfc241f
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/82fae081afaea13831404024d39658344d56e1c6
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/83ba41cea1adab707f7f213af5e2ed734bdddc25 b/test/core/security/corpus/alts_credentials_corpus/83ba41cea1adab707f7f213af5e2ed734bdddc25
new file mode 100644
index 0000000000..d465fb4977
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/83ba41cea1adab707f7f213af5e2ed734bdddc25
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/841a3f66c94e5acd836a44cd5a8514d4ad45d83e b/test/core/security/corpus/alts_credentials_corpus/841a3f66c94e5acd836a44cd5a8514d4ad45d83e
new file mode 100644
index 0000000000..cbb7bdcaf8
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/841a3f66c94e5acd836a44cd5a8514d4ad45d83e
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/841ef94ee0f1b0b45983d95b75aba25421d73f2c b/test/core/security/corpus/alts_credentials_corpus/841ef94ee0f1b0b45983d95b75aba25421d73f2c
new file mode 100644
index 0000000000..ba85d1d67e
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/841ef94ee0f1b0b45983d95b75aba25421d73f2c
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/843b0aad4a9707c5dcc92d12d876b78675cfcb65 b/test/core/security/corpus/alts_credentials_corpus/843b0aad4a9707c5dcc92d12d876b78675cfcb65
new file mode 100644
index 0000000000..02d61c52aa
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/843b0aad4a9707c5dcc92d12d876b78675cfcb65
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/8483e3d92eda8df504b1d1d0d012f4bcd778cd33 b/test/core/security/corpus/alts_credentials_corpus/8483e3d92eda8df504b1d1d0d012f4bcd778cd33
new file mode 100644
index 0000000000..3795466779
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/8483e3d92eda8df504b1d1d0d012f4bcd778cd33
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/876830fdff4e59038fa2173b700faef5bffe61de b/test/core/security/corpus/alts_credentials_corpus/876830fdff4e59038fa2173b700faef5bffe61de
new file mode 100644
index 0000000000..26048bd593
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/876830fdff4e59038fa2173b700faef5bffe61de
@@ -0,0 +1 @@
+òÒA \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/87ca3342fdce0c1f678a3f1b62428032ef51442d b/test/core/security/corpus/alts_credentials_corpus/87ca3342fdce0c1f678a3f1b62428032ef51442d
new file mode 100644
index 0000000000..ea35b452ca
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/87ca3342fdce0c1f678a3f1b62428032ef51442d
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/87d044027cdb7d35fadb56532f497764246946a6 b/test/core/security/corpus/alts_credentials_corpus/87d044027cdb7d35fadb56532f497764246946a6
new file mode 100644
index 0000000000..1e474c9134
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/87d044027cdb7d35fadb56532f497764246946a6
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/88ce75ba18bdb7e93a81197d850f4e792f6a8155 b/test/core/security/corpus/alts_credentials_corpus/88ce75ba18bdb7e93a81197d850f4e792f6a8155
new file mode 100644
index 0000000000..70c9ab1fc5
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/88ce75ba18bdb7e93a81197d850f4e792f6a8155
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/89dc55e8e20e811e78c952c8bd2c16f55fe72f57 b/test/core/security/corpus/alts_credentials_corpus/89dc55e8e20e811e78c952c8bd2c16f55fe72f57
new file mode 100644
index 0000000000..00961fdf9e
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/89dc55e8e20e811e78c952c8bd2c16f55fe72f57
@@ -0,0 +1 @@
+òÒŽ \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/8a215a58908f44bdced595ceb01a81977f1d72f0 b/test/core/security/corpus/alts_credentials_corpus/8a215a58908f44bdced595ceb01a81977f1d72f0
new file mode 100644
index 0000000000..296f8b7a24
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/8a215a58908f44bdced595ceb01a81977f1d72f0
@@ -0,0 +1 @@
+Ä=ÒÄ=)†††††††ÄÄÄÄÄÄ \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/8ac7459e918304ca40b1cf29a3ac0f555eada678 b/test/core/security/corpus/alts_credentials_corpus/8ac7459e918304ca40b1cf29a3ac0f555eada678
new file mode 100644
index 0000000000..629a6f95a2
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/8ac7459e918304ca40b1cf29a3ac0f555eada678
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/8b93e50a911f3ea0e0b0377ba4636574f2ee9a5e b/test/core/security/corpus/alts_credentials_corpus/8b93e50a911f3ea0e0b0377ba4636574f2ee9a5e
new file mode 100644
index 0000000000..280aecfb9a
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/8b93e50a911f3ea0e0b0377ba4636574f2ee9a5e
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/8c9ec0ffd803505772693833d56e7a02110645b3 b/test/core/security/corpus/alts_credentials_corpus/8c9ec0ffd803505772693833d56e7a02110645b3
new file mode 100644
index 0000000000..3bd046b7f9
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/8c9ec0ffd803505772693833d56e7a02110645b3
@@ -0,0 +1 @@
+K]//( \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/8e4b361a530dc6825afcfb4106bd482c3fd010fa b/test/core/security/corpus/alts_credentials_corpus/8e4b361a530dc6825afcfb4106bd482c3fd010fa
new file mode 100644
index 0000000000..3733df9e3c
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/8e4b361a530dc6825afcfb4106bd482c3fd010fa
@@ -0,0 +1 @@
+òÒÝ \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/8f6690d97bcda890f2a5b2930a2b7a4d7b56c6e7 b/test/core/security/corpus/alts_credentials_corpus/8f6690d97bcda890f2a5b2930a2b7a4d7b56c6e7
new file mode 100644
index 0000000000..7885e1effb
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/8f6690d97bcda890f2a5b2930a2b7a4d7b56c6e7
@@ -0,0 +1 @@
+òÒÝ \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/917636de2c14dce2580d4308249a94d61d62c305 b/test/core/security/corpus/alts_credentials_corpus/917636de2c14dce2580d4308249a94d61d62c305
new file mode 100644
index 0000000000..cccb20d847
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/917636de2c14dce2580d4308249a94d61d62c305
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/91f11008defda918951bda868cc68c6373fb0e6a b/test/core/security/corpus/alts_credentials_corpus/91f11008defda918951bda868cc68c6373fb0e6a
new file mode 100644
index 0000000000..bf10853bfb
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/91f11008defda918951bda868cc68c6373fb0e6a
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/92e01a34047b660a798086d55a3d8d7100a01939 b/test/core/security/corpus/alts_credentials_corpus/92e01a34047b660a798086d55a3d8d7100a01939
new file mode 100644
index 0000000000..e86bc1d589
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/92e01a34047b660a798086d55a3d8d7100a01939
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/963fafadb4de09dee0e6a852bd61b1740039a465 b/test/core/security/corpus/alts_credentials_corpus/963fafadb4de09dee0e6a852bd61b1740039a465
new file mode 100644
index 0000000000..8933b18c72
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/963fafadb4de09dee0e6a852bd61b1740039a465
@@ -0,0 +1 @@
+ê \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/97bf33ec97b93fcc2449431915911a55b906e3b6 b/test/core/security/corpus/alts_credentials_corpus/97bf33ec97b93fcc2449431915911a55b906e3b6
new file mode 100644
index 0000000000..8101e3720d
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/97bf33ec97b93fcc2449431915911a55b906e3b6
@@ -0,0 +1 @@
+òÓÓÒ \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/99e31e12b02b02479d10b2c08426906bd93a0840 b/test/core/security/corpus/alts_credentials_corpus/99e31e12b02b02479d10b2c08426906bd93a0840
new file mode 100644
index 0000000000..9fe2a6a137
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/99e31e12b02b02479d10b2c08426906bd93a0840
@@ -0,0 +1 @@
+òÓÓÒ \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/9a75ce693e7259d4d3bb9203dfc0a65f8bbaa466 b/test/core/security/corpus/alts_credentials_corpus/9a75ce693e7259d4d3bb9203dfc0a65f8bbaa466
new file mode 100644
index 0000000000..5366cdd4a6
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/9a75ce693e7259d4d3bb9203dfc0a65f8bbaa466
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/9ac0d956f9743e026baad7319ba2a75d9f1a534f b/test/core/security/corpus/alts_credentials_corpus/9ac0d956f9743e026baad7319ba2a75d9f1a534f
new file mode 100644
index 0000000000..adb0583eb6
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/9ac0d956f9743e026baad7319ba2a75d9f1a534f
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/9ae56d4451dd3e1b66ddc250d84dbf6d8cae0dbd b/test/core/security/corpus/alts_credentials_corpus/9ae56d4451dd3e1b66ddc250d84dbf6d8cae0dbd
new file mode 100644
index 0000000000..121d0cb5d6
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/9ae56d4451dd3e1b66ddc250d84dbf6d8cae0dbd
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/9b9a3a1e4023c9b172060249752a482a3437ef2a b/test/core/security/corpus/alts_credentials_corpus/9b9a3a1e4023c9b172060249752a482a3437ef2a
new file mode 100644
index 0000000000..0b19f19a43
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/9b9a3a1e4023c9b172060249752a482a3437ef2a
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/9c81164e10bf612c352dca3ecabf57743b451d42 b/test/core/security/corpus/alts_credentials_corpus/9c81164e10bf612c352dca3ecabf57743b451d42
new file mode 100644
index 0000000000..1cae116cff
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/9c81164e10bf612c352dca3ecabf57743b451d42
@@ -0,0 +1,2 @@
+
+z \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/9d8b420b5d32deb0140ab91eeebba58ca6163722 b/test/core/security/corpus/alts_credentials_corpus/9d8b420b5d32deb0140ab91eeebba58ca6163722
new file mode 100644
index 0000000000..6d0f80948e
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/9d8b420b5d32deb0140ab91eeebba58ca6163722
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/9de687bf1e2cfac54c3b2e2eb85b53014a460ff7 b/test/core/security/corpus/alts_credentials_corpus/9de687bf1e2cfac54c3b2e2eb85b53014a460ff7
new file mode 100644
index 0000000000..789f59cd27
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/9de687bf1e2cfac54c3b2e2eb85b53014a460ff7
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/9f3cda19a186bd11bfac361b464f92daa129a33b b/test/core/security/corpus/alts_credentials_corpus/9f3cda19a186bd11bfac361b464f92daa129a33b
new file mode 100644
index 0000000000..61347c386e
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/9f3cda19a186bd11bfac361b464f92daa129a33b
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/a14fc6a608121f8abf0fe25cf466720f00f25653 b/test/core/security/corpus/alts_credentials_corpus/a14fc6a608121f8abf0fe25cf466720f00f25653
new file mode 100644
index 0000000000..58af76210a
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/a14fc6a608121f8abf0fe25cf466720f00f25653
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/a39906074669a6b76a35b0adf2bf36ad751f3b35 b/test/core/security/corpus/alts_credentials_corpus/a39906074669a6b76a35b0adf2bf36ad751f3b35
new file mode 100644
index 0000000000..e10cdb997e
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/a39906074669a6b76a35b0adf2bf36ad751f3b35
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/a454ca483b4a66b83826d061be2859dd79ff0d6c b/test/core/security/corpus/alts_credentials_corpus/a454ca483b4a66b83826d061be2859dd79ff0d6c
new file mode 100644
index 0000000000..38424fc7a2
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/a454ca483b4a66b83826d061be2859dd79ff0d6c
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/a52df5607370ff0f56d821000f3d5e386a01d489 b/test/core/security/corpus/alts_credentials_corpus/a52df5607370ff0f56d821000f3d5e386a01d489
new file mode 100644
index 0000000000..f16da079ed
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/a52df5607370ff0f56d821000f3d5e386a01d489
@@ -0,0 +1 @@
+úÒû; \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/a56eaf47f7c7263e53efdc55ec39063dbb4ae71c b/test/core/security/corpus/alts_credentials_corpus/a56eaf47f7c7263e53efdc55ec39063dbb4ae71c
new file mode 100644
index 0000000000..3664ce0f99
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/a56eaf47f7c7263e53efdc55ec39063dbb4ae71c
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/a79249fb8f7d53f0a280359d2d9df31594adbdfc b/test/core/security/corpus/alts_credentials_corpus/a79249fb8f7d53f0a280359d2d9df31594adbdfc
new file mode 100644
index 0000000000..d7f1f455b1
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/a79249fb8f7d53f0a280359d2d9df31594adbdfc
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/aa98a46f25004f7436aadb36ff8b7f07ed7bfce1 b/test/core/security/corpus/alts_credentials_corpus/aa98a46f25004f7436aadb36ff8b7f07ed7bfce1
new file mode 100644
index 0000000000..f1db8d9f2c
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/aa98a46f25004f7436aadb36ff8b7f07ed7bfce1
@@ -0,0 +1 @@
+ap“ž’/òÒ+ \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/adc83b19e793491b1c6ea0fd8b46cd9f32e592fc b/test/core/security/corpus/alts_credentials_corpus/adc83b19e793491b1c6ea0fd8b46cd9f32e592fc
new file mode 100644
index 0000000000..8b13789179
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/adc83b19e793491b1c6ea0fd8b46cd9f32e592fc
@@ -0,0 +1 @@
+
diff --git a/test/core/security/corpus/alts_credentials_corpus/afd8e19f7bfd6c963f1856be59b75627864821dc b/test/core/security/corpus/alts_credentials_corpus/afd8e19f7bfd6c963f1856be59b75627864821dc
new file mode 100644
index 0000000000..385405e116
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/afd8e19f7bfd6c963f1856be59b75627864821dc
@@ -0,0 +1,2 @@
+¯+ú
+ä´õ \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/b3966239b8568442baecbeb0f8a1aa29dcdfd7ed b/test/core/security/corpus/alts_credentials_corpus/b3966239b8568442baecbeb0f8a1aa29dcdfd7ed
new file mode 100644
index 0000000000..3d9fb86775
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/b3966239b8568442baecbeb0f8a1aa29dcdfd7ed
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/b430d41ef65493b3e917182c23ce90df983e01ab b/test/core/security/corpus/alts_credentials_corpus/b430d41ef65493b3e917182c23ce90df983e01ab
new file mode 100644
index 0000000000..cbb8cebbb9
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/b430d41ef65493b3e917182c23ce90df983e01ab
@@ -0,0 +1,2 @@
+ÿ
+
diff --git a/test/core/security/corpus/alts_credentials_corpus/b44e715e0cfe05f0c92a9e000ac3c36aae17df9d b/test/core/security/corpus/alts_credentials_corpus/b44e715e0cfe05f0c92a9e000ac3c36aae17df9d
new file mode 100644
index 0000000000..f0b1381e2c
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/b44e715e0cfe05f0c92a9e000ac3c36aae17df9d
@@ -0,0 +1 @@
+]] \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/b4cf4ef7b3f64eff76cf99091fddc04411774708 b/test/core/security/corpus/alts_credentials_corpus/b4cf4ef7b3f64eff76cf99091fddc04411774708
new file mode 100644
index 0000000000..65d4adbeb4
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/b4cf4ef7b3f64eff76cf99091fddc04411774708
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/b53d84468ea93620a9824ca65acf1179f431e763 b/test/core/security/corpus/alts_credentials_corpus/b53d84468ea93620a9824ca65acf1179f431e763
new file mode 100644
index 0000000000..5844d31855
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/b53d84468ea93620a9824ca65acf1179f431e763
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/b6ac4831cc5baabee9c8ab9af9ca3923f91097a0 b/test/core/security/corpus/alts_credentials_corpus/b6ac4831cc5baabee9c8ab9af9ca3923f91097a0
new file mode 100644
index 0000000000..3d54a26e1c
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/b6ac4831cc5baabee9c8ab9af9ca3923f91097a0
@@ -0,0 +1,2 @@
+îÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿAï
+ïé \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/b7f4a484866a8050dbc63bc905c9803c6964eda5 b/test/core/security/corpus/alts_credentials_corpus/b7f4a484866a8050dbc63bc905c9803c6964eda5
new file mode 100644
index 0000000000..e17c966032
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/b7f4a484866a8050dbc63bc905c9803c6964eda5
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/b8f21e59f90431c982d5ec3fb54ae4605f102252 b/test/core/security/corpus/alts_credentials_corpus/b8f21e59f90431c982d5ec3fb54ae4605f102252
new file mode 100644
index 0000000000..79e3486245
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/b8f21e59f90431c982d5ec3fb54ae4605f102252
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/bad10b6581cdead8e7cb96e4f544dcf0ea650fbc b/test/core/security/corpus/alts_credentials_corpus/bad10b6581cdead8e7cb96e4f544dcf0ea650fbc
new file mode 100644
index 0000000000..9deb7606c7
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/bad10b6581cdead8e7cb96e4f544dcf0ea650fbc
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/bb01bed86b43257be9f527388e1183f52438c473 b/test/core/security/corpus/alts_credentials_corpus/bb01bed86b43257be9f527388e1183f52438c473
new file mode 100644
index 0000000000..ad47d46dc2
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/bb01bed86b43257be9f527388e1183f52438c473
@@ -0,0 +1 @@
+òÒûþ \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/bb7497b00f0d999ef39dbf81c6bd0441e32723b6 b/test/core/security/corpus/alts_credentials_corpus/bb7497b00f0d999ef39dbf81c6bd0441e32723b6
new file mode 100644
index 0000000000..3b2f10845c
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/bb7497b00f0d999ef39dbf81c6bd0441e32723b6
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/bf01b72e635deda1b4a8468f1cc36f01a54e1338 b/test/core/security/corpus/alts_credentials_corpus/bf01b72e635deda1b4a8468f1cc36f01a54e1338
new file mode 100644
index 0000000000..7fa6cf8df9
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/bf01b72e635deda1b4a8468f1cc36f01a54e1338
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/bf8b4530d8d246dd74ac53a13471bba17941dff7 b/test/core/security/corpus/alts_credentials_corpus/bf8b4530d8d246dd74ac53a13471bba17941dff7
new file mode 100644
index 0000000000..6b2aaa7640
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/bf8b4530d8d246dd74ac53a13471bba17941dff7
@@ -0,0 +1 @@
+ \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/c08bc84ab6a512b901bb730beb05c8394e4f1c5d b/test/core/security/corpus/alts_credentials_corpus/c08bc84ab6a512b901bb730beb05c8394e4f1c5d
new file mode 100644
index 0000000000..8d753685ca
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/c08bc84ab6a512b901bb730beb05c8394e4f1c5d
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/c244b635d94e6f5d6b344887434be3e001a04b41 b/test/core/security/corpus/alts_credentials_corpus/c244b635d94e6f5d6b344887434be3e001a04b41
new file mode 100644
index 0000000000..92e73a2356
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/c244b635d94e6f5d6b344887434be3e001a04b41
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/c281efe9620da999a637ff6e9b3279ec613fb992 b/test/core/security/corpus/alts_credentials_corpus/c281efe9620da999a637ff6e9b3279ec613fb992
new file mode 100644
index 0000000000..c17a77e0da
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/c281efe9620da999a637ff6e9b3279ec613fb992
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/c30a212824ee71e215f475f453de17c65a200101 b/test/core/security/corpus/alts_credentials_corpus/c30a212824ee71e215f475f453de17c65a200101
new file mode 100644
index 0000000000..86ac99e288
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/c30a212824ee71e215f475f453de17c65a200101
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/c449427f35b7ecdf5641073629f7723df52c4cb0 b/test/core/security/corpus/alts_credentials_corpus/c449427f35b7ecdf5641073629f7723df52c4cb0
new file mode 100644
index 0000000000..87d1a322d7
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/c449427f35b7ecdf5641073629f7723df52c4cb0
@@ -0,0 +1 @@
+ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ‚ÕÒÒÒÒÒÒÒÒÒÒ‘- \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/c60240cd3b02eb71e2bf5ebd59afa3a5dc9b5e4d b/test/core/security/corpus/alts_credentials_corpus/c60240cd3b02eb71e2bf5ebd59afa3a5dc9b5e4d
new file mode 100644
index 0000000000..f8804b84e4
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/c60240cd3b02eb71e2bf5ebd59afa3a5dc9b5e4d
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/c60cdf9c3fb9060838f445b3bc3852b6f81e1e4c b/test/core/security/corpus/alts_credentials_corpus/c60cdf9c3fb9060838f445b3bc3852b6f81e1e4c
new file mode 100644
index 0000000000..327246f1c9
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/c60cdf9c3fb9060838f445b3bc3852b6f81e1e4c
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/c72d0501bacadb45242c553ba292591302f12a6a b/test/core/security/corpus/alts_credentials_corpus/c72d0501bacadb45242c553ba292591302f12a6a
new file mode 100644
index 0000000000..ca02bafb78
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/c72d0501bacadb45242c553ba292591302f12a6a
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/c739e7b5ad999edbdeffdab672dbc30deb3959a0 b/test/core/security/corpus/alts_credentials_corpus/c739e7b5ad999edbdeffdab672dbc30deb3959a0
new file mode 100644
index 0000000000..d7f2d22aa8
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/c739e7b5ad999edbdeffdab672dbc30deb3959a0
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/c7d73b12a7108d82f8dac6d8a6a34f838601aca6 b/test/core/security/corpus/alts_credentials_corpus/c7d73b12a7108d82f8dac6d8a6a34f838601aca6
new file mode 100644
index 0000000000..b38437a65e
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/c7d73b12a7108d82f8dac6d8a6a34f838601aca6
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/ca781e1add632433293e847ae9e71649c217ee5f b/test/core/security/corpus/alts_credentials_corpus/ca781e1add632433293e847ae9e71649c217ee5f
new file mode 100644
index 0000000000..5c79dd1c52
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/ca781e1add632433293e847ae9e71649c217ee5f
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/cc48e916f40e8d69c2d07cfda42c7d3b7fe3447a b/test/core/security/corpus/alts_credentials_corpus/cc48e916f40e8d69c2d07cfda42c7d3b7fe3447a
new file mode 100644
index 0000000000..11ccb07de1
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/cc48e916f40e8d69c2d07cfda42c7d3b7fe3447a
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/cca1aff4c08ee4ccbcb6f80e1cd1480a0a093cfd b/test/core/security/corpus/alts_credentials_corpus/cca1aff4c08ee4ccbcb6f80e1cd1480a0a093cfd
new file mode 100644
index 0000000000..b7bebbe8e9
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/cca1aff4c08ee4ccbcb6f80e1cd1480a0a093cfd
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/cf6ae8bf1d08d25e235b7bee0839984bbc04edf6 b/test/core/security/corpus/alts_credentials_corpus/cf6ae8bf1d08d25e235b7bee0839984bbc04edf6
new file mode 100644
index 0000000000..32eb656fbf
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/cf6ae8bf1d08d25e235b7bee0839984bbc04edf6
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/cfc52fa086292c699efd7bf41d2fae3deb449536 b/test/core/security/corpus/alts_credentials_corpus/cfc52fa086292c699efd7bf41d2fae3deb449536
new file mode 100644
index 0000000000..285e35d40f
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/cfc52fa086292c699efd7bf41d2fae3deb449536
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/cfe13ef3c6c713a059f231f0001ecec97e2a932d b/test/core/security/corpus/alts_credentials_corpus/cfe13ef3c6c713a059f231f0001ecec97e2a932d
new file mode 100644
index 0000000000..1059f60cec
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/cfe13ef3c6c713a059f231f0001ecec97e2a932d
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/d14026ac6421bca7161024f4e735cb80a1068d01 b/test/core/security/corpus/alts_credentials_corpus/d14026ac6421bca7161024f4e735cb80a1068d01
new file mode 100644
index 0000000000..68b7682c71
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/d14026ac6421bca7161024f4e735cb80a1068d01
@@ -0,0 +1,2 @@
+
+ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿûÿ+´úä¯õ \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/d2fb6e8f7867fc1e2ebe723da2b5246dc9cc6b14 b/test/core/security/corpus/alts_credentials_corpus/d2fb6e8f7867fc1e2ebe723da2b5246dc9cc6b14
new file mode 100644
index 0000000000..9854260459
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/d2fb6e8f7867fc1e2ebe723da2b5246dc9cc6b14
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/d4db7d51bdaa4781cf12c3b59914bad414d2a41e b/test/core/security/corpus/alts_credentials_corpus/d4db7d51bdaa4781cf12c3b59914bad414d2a41e
new file mode 100644
index 0000000000..0979d45bca
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/d4db7d51bdaa4781cf12c3b59914bad414d2a41e
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/d533da0e7f8c1e39bb025b4d7a89613142a6f54e b/test/core/security/corpus/alts_credentials_corpus/d533da0e7f8c1e39bb025b4d7a89613142a6f54e
new file mode 100644
index 0000000000..89ef0d2307
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/d533da0e7f8c1e39bb025b4d7a89613142a6f54e
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/d5cf489d01a1b847a7aac5dddabff23fdc218e1e b/test/core/security/corpus/alts_credentials_corpus/d5cf489d01a1b847a7aac5dddabff23fdc218e1e
new file mode 100644
index 0000000000..c544b2793e
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/d5cf489d01a1b847a7aac5dddabff23fdc218e1e
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/d686f8561a249c7c15c78f76a5fceb884286e070 b/test/core/security/corpus/alts_credentials_corpus/d686f8561a249c7c15c78f76a5fceb884286e070
new file mode 100644
index 0000000000..b96c459973
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/d686f8561a249c7c15c78f76a5fceb884286e070
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/d92424daad9d96a40e5ab177e3824c36ef51dc0f b/test/core/security/corpus/alts_credentials_corpus/d92424daad9d96a40e5ab177e3824c36ef51dc0f
new file mode 100644
index 0000000000..509eb39065
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/d92424daad9d96a40e5ab177e3824c36ef51dc0f
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/db242a11ed88b2b26af46770dd1927d9f35301fb b/test/core/security/corpus/alts_credentials_corpus/db242a11ed88b2b26af46770dd1927d9f35301fb
new file mode 100644
index 0000000000..bd5d04676a
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/db242a11ed88b2b26af46770dd1927d9f35301fb
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/db32eb04db13d58f65f46d262608bd088987c063 b/test/core/security/corpus/alts_credentials_corpus/db32eb04db13d58f65f46d262608bd088987c063
new file mode 100644
index 0000000000..5c526d8a28
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/db32eb04db13d58f65f46d262608bd088987c063
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/db39a953317951759e40734de6607a0b4457728e b/test/core/security/corpus/alts_credentials_corpus/db39a953317951759e40734de6607a0b4457728e
new file mode 100644
index 0000000000..d794576b59
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/db39a953317951759e40734de6607a0b4457728e
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/dc5e8f3102456bed90d17303bc4cff1a7e076d5d b/test/core/security/corpus/alts_credentials_corpus/dc5e8f3102456bed90d17303bc4cff1a7e076d5d
new file mode 100644
index 0000000000..53e1bbce92
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/dc5e8f3102456bed90d17303bc4cff1a7e076d5d
@@ -0,0 +1 @@
+‚ \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/dd9542bbed8e5dc58da2789edbfb9c38d578d3b4 b/test/core/security/corpus/alts_credentials_corpus/dd9542bbed8e5dc58da2789edbfb9c38d578d3b4
new file mode 100644
index 0000000000..95fd950be8
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/dd9542bbed8e5dc58da2789edbfb9c38d578d3b4
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/de2ebb1ed324385de500a1a3308846239857c3c7 b/test/core/security/corpus/alts_credentials_corpus/de2ebb1ed324385de500a1a3308846239857c3c7
new file mode 100644
index 0000000000..d0cee5f847
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/de2ebb1ed324385de500a1a3308846239857c3c7
@@ -0,0 +1 @@
+ø+ø \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/de8ba9158254c1cd84b53df1e4cdf1757b1392f1 b/test/core/security/corpus/alts_credentials_corpus/de8ba9158254c1cd84b53df1e4cdf1757b1392f1
new file mode 100644
index 0000000000..1cbbe5b8cb
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/de8ba9158254c1cd84b53df1e4cdf1757b1392f1
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/e1dd260746f50024822a8b729b89545d26decfb8 b/test/core/security/corpus/alts_credentials_corpus/e1dd260746f50024822a8b729b89545d26decfb8
new file mode 100644
index 0000000000..c44854edf7
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/e1dd260746f50024822a8b729b89545d26decfb8
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/e29add81b20dc570fdc885782689f6dccb1c5fad b/test/core/security/corpus/alts_credentials_corpus/e29add81b20dc570fdc885782689f6dccb1c5fad
new file mode 100644
index 0000000000..5c50fe7539
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/e29add81b20dc570fdc885782689f6dccb1c5fad
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/e2e99af62843cd3b29d50daeb118e58830784da9 b/test/core/security/corpus/alts_credentials_corpus/e2e99af62843cd3b29d50daeb118e58830784da9
new file mode 100644
index 0000000000..04da1314d9
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/e2e99af62843cd3b29d50daeb118e58830784da9
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/e46611c5daf99662e1576147c1623409752a1f39 b/test/core/security/corpus/alts_credentials_corpus/e46611c5daf99662e1576147c1623409752a1f39
new file mode 100644
index 0000000000..0334d31def
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/e46611c5daf99662e1576147c1623409752a1f39
@@ -0,0 +1 @@
+ä## \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/e5a1ba11af830e9d2db201c5164f75747a85fe9b b/test/core/security/corpus/alts_credentials_corpus/e5a1ba11af830e9d2db201c5164f75747a85fe9b
new file mode 100644
index 0000000000..8e8b1e2001
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/e5a1ba11af830e9d2db201c5164f75747a85fe9b
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/e6026ee0badf216b326443a5f708446b2f2e579f b/test/core/security/corpus/alts_credentials_corpus/e6026ee0badf216b326443a5f708446b2f2e579f
new file mode 100644
index 0000000000..a99014fa41
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/e6026ee0badf216b326443a5f708446b2f2e579f
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/e6c7d2c0038fa1f03fc6590a726abc98f4c641f3 b/test/core/security/corpus/alts_credentials_corpus/e6c7d2c0038fa1f03fc6590a726abc98f4c641f3
new file mode 100644
index 0000000000..8f5a9f5b33
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/e6c7d2c0038fa1f03fc6590a726abc98f4c641f3
@@ -0,0 +1 @@
+òi \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/eafdef6a630bed71bd0e4f3d4a16b5fa0c920651 b/test/core/security/corpus/alts_credentials_corpus/eafdef6a630bed71bd0e4f3d4a16b5fa0c920651
new file mode 100644
index 0000000000..6fbe750e01
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/eafdef6a630bed71bd0e4f3d4a16b5fa0c920651
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/ece985b9b82e27281514d460709d7edf8203ded7 b/test/core/security/corpus/alts_credentials_corpus/ece985b9b82e27281514d460709d7edf8203ded7
new file mode 100644
index 0000000000..c1243022a0
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/ece985b9b82e27281514d460709d7edf8203ded7
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/edb8f4259f756c2c4bc731f05beaa36f992cf079 b/test/core/security/corpus/alts_credentials_corpus/edb8f4259f756c2c4bc731f05beaa36f992cf079
new file mode 100644
index 0000000000..1cc08a4d39
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/edb8f4259f756c2c4bc731f05beaa36f992cf079
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/edce7778c2e1adb81dda3d057a6536759a7cb293 b/test/core/security/corpus/alts_credentials_corpus/edce7778c2e1adb81dda3d057a6536759a7cb293
new file mode 100644
index 0000000000..39b52cf971
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/edce7778c2e1adb81dda3d057a6536759a7cb293
@@ -0,0 +1 @@
++ \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/ee4040c0dd406dd616c49ed2c37b40478dabfe0f b/test/core/security/corpus/alts_credentials_corpus/ee4040c0dd406dd616c49ed2c37b40478dabfe0f
new file mode 100644
index 0000000000..48325e312e
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/ee4040c0dd406dd616c49ed2c37b40478dabfe0f
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/ee69f2b380663d051a70f30fcfce9f79f5341e5a b/test/core/security/corpus/alts_credentials_corpus/ee69f2b380663d051a70f30fcfce9f79f5341e5a
new file mode 100644
index 0000000000..7e0ad2a61a
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/ee69f2b380663d051a70f30fcfce9f79f5341e5a
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/efc6743e47274058771bb6eda1fefa017bde4a95 b/test/core/security/corpus/alts_credentials_corpus/efc6743e47274058771bb6eda1fefa017bde4a95
new file mode 100644
index 0000000000..4418e8ab73
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/efc6743e47274058771bb6eda1fefa017bde4a95
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/f0038e54162000694d882b1acb80930c807b41d2 b/test/core/security/corpus/alts_credentials_corpus/f0038e54162000694d882b1acb80930c807b41d2
new file mode 100644
index 0000000000..292a5e4bd3
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/f0038e54162000694d882b1acb80930c807b41d2
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/f1deb9e388c877337dabe92f31b01e2a019a10f4 b/test/core/security/corpus/alts_credentials_corpus/f1deb9e388c877337dabe92f31b01e2a019a10f4
new file mode 100644
index 0000000000..46464ee9c2
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/f1deb9e388c877337dabe92f31b01e2a019a10f4
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/f3a09373e4d3c7310d372089e6deb15d6b22c198 b/test/core/security/corpus/alts_credentials_corpus/f3a09373e4d3c7310d372089e6deb15d6b22c198
new file mode 100644
index 0000000000..a974996100
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/f3a09373e4d3c7310d372089e6deb15d6b22c198
@@ -0,0 +1 @@
+üÒûþ \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/f3db7ef6495fa1ac5bb4db293fb38dd59122bb7c b/test/core/security/corpus/alts_credentials_corpus/f3db7ef6495fa1ac5bb4db293fb38dd59122bb7c
new file mode 100644
index 0000000000..8afc32bf9d
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/f3db7ef6495fa1ac5bb4db293fb38dd59122bb7c
@@ -0,0 +1,2 @@
+[ÿÿ[ÿÿÿ
+¡Š \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/f434bb4ceecc573e085d4c3ef453ef01e93d9c89 b/test/core/security/corpus/alts_credentials_corpus/f434bb4ceecc573e085d4c3ef453ef01e93d9c89
new file mode 100644
index 0000000000..2b66a00cd8
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/f434bb4ceecc573e085d4c3ef453ef01e93d9c89
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/f55bceaad42ddf9d2b37fdfca68255d29a696109 b/test/core/security/corpus/alts_credentials_corpus/f55bceaad42ddf9d2b37fdfca68255d29a696109
new file mode 100644
index 0000000000..a8eef8f96a
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/f55bceaad42ddf9d2b37fdfca68255d29a696109
@@ -0,0 +1 @@
+òÒ \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/f62ca5321428a5d23f3c804fb51eb4e65bc58716 b/test/core/security/corpus/alts_credentials_corpus/f62ca5321428a5d23f3c804fb51eb4e65bc58716
new file mode 100644
index 0000000000..0d80f7be69
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/f62ca5321428a5d23f3c804fb51eb4e65bc58716
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/f7c6a558b8d0af64db2b139371a7af7068b01b92 b/test/core/security/corpus/alts_credentials_corpus/f7c6a558b8d0af64db2b139371a7af7068b01b92
new file mode 100644
index 0000000000..d46ea45bc4
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/f7c6a558b8d0af64db2b139371a7af7068b01b92
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/faa1781e1444bba5b8c677bc5e2a38d023a1ec65 b/test/core/security/corpus/alts_credentials_corpus/faa1781e1444bba5b8c677bc5e2a38d023a1ec65
new file mode 100644
index 0000000000..013d565bb4
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/faa1781e1444bba5b8c677bc5e2a38d023a1ec65
@@ -0,0 +1 @@
+‚ \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/fceba33ada1dda05fccedfefd331c9a201f1a2e5 b/test/core/security/corpus/alts_credentials_corpus/fceba33ada1dda05fccedfefd331c9a201f1a2e5
new file mode 100644
index 0000000000..f3db26dc2f
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/fceba33ada1dda05fccedfefd331c9a201f1a2e5
@@ -0,0 +1 @@
+ ¿ \ No newline at end of file
diff --git a/test/core/security/corpus/alts_credentials_corpus/fd668bef6fdaf7f3ffd58d8c60ce550476652e60 b/test/core/security/corpus/alts_credentials_corpus/fd668bef6fdaf7f3ffd58d8c60ce550476652e60
new file mode 100644
index 0000000000..dcefd99985
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/fd668bef6fdaf7f3ffd58d8c60ce550476652e60
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/fdf06b928e37e7c4ae59a568b5723ad98bbed6e5 b/test/core/security/corpus/alts_credentials_corpus/fdf06b928e37e7c4ae59a568b5723ad98bbed6e5
new file mode 100644
index 0000000000..fe28d69b5f
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/fdf06b928e37e7c4ae59a568b5723ad98bbed6e5
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/fe2fc5d499aeb2762387ef2e3ce939280813dec0 b/test/core/security/corpus/alts_credentials_corpus/fe2fc5d499aeb2762387ef2e3ce939280813dec0
new file mode 100644
index 0000000000..cb035e7101
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/fe2fc5d499aeb2762387ef2e3ce939280813dec0
Binary files differ
diff --git a/test/core/security/corpus/alts_credentials_corpus/ff548d368b090409a138e5cc4afc7f43b4a3fbbd b/test/core/security/corpus/alts_credentials_corpus/ff548d368b090409a138e5cc4afc7f43b4a3fbbd
new file mode 100644
index 0000000000..caadbc0309
--- /dev/null
+++ b/test/core/security/corpus/alts_credentials_corpus/ff548d368b090409a138e5cc4afc7f43b4a3fbbd
Binary files differ
diff --git a/test/core/security/credentials_test.cc b/test/core/security/credentials_test.cc
index ce92e21d73..2b90939ab8 100644
--- a/test/core/security/credentials_test.cc
+++ b/test/core/security/credentials_test.cc
@@ -867,6 +867,7 @@ static void set_google_default_creds_env_var_with_file_contents(
static void test_google_default_creds_auth_key(void) {
grpc_core::ExecCtx exec_ctx;
grpc_service_account_jwt_access_credentials* jwt;
+ grpc_google_default_channel_credentials* default_creds;
grpc_composite_channel_credentials* creds;
char* json_key = test_json_key_str();
grpc_flush_cached_google_default_credentials();
@@ -875,7 +876,9 @@ static void test_google_default_creds_auth_key(void) {
gpr_free(json_key);
creds = reinterpret_cast<grpc_composite_channel_credentials*>(
grpc_google_default_credentials_create());
- GPR_ASSERT(creds != nullptr);
+ default_creds = reinterpret_cast<grpc_google_default_channel_credentials*>(
+ creds->inner_creds);
+ GPR_ASSERT(default_creds->ssl_creds != nullptr);
jwt = reinterpret_cast<grpc_service_account_jwt_access_credentials*>(
creds->call_creds);
GPR_ASSERT(
@@ -889,13 +892,16 @@ static void test_google_default_creds_auth_key(void) {
static void test_google_default_creds_refresh_token(void) {
grpc_core::ExecCtx exec_ctx;
grpc_google_refresh_token_credentials* refresh;
+ grpc_google_default_channel_credentials* default_creds;
grpc_composite_channel_credentials* creds;
grpc_flush_cached_google_default_credentials();
set_google_default_creds_env_var_with_file_contents(
"refresh_token_google_default_creds", test_refresh_token_str);
creds = reinterpret_cast<grpc_composite_channel_credentials*>(
grpc_google_default_credentials_create());
- GPR_ASSERT(creds != nullptr);
+ default_creds = reinterpret_cast<grpc_google_default_channel_credentials*>(
+ creds->inner_creds);
+ GPR_ASSERT(default_creds->ssl_creds != nullptr);
refresh = reinterpret_cast<grpc_google_refresh_token_credentials*>(
creds->call_creds);
GPR_ASSERT(strcmp(refresh->refresh_token.client_id,
diff --git a/test/core/security/grpc_alts_credentials_options_test.cc b/test/core/security/grpc_alts_credentials_options_test.cc
index 1217065507..623db48ebc 100644
--- a/test/core/security/grpc_alts_credentials_options_test.cc
+++ b/test/core/security/grpc_alts_credentials_options_test.cc
@@ -30,39 +30,22 @@
const size_t kTargetServiceAccountNum = 2;
-static void test_add_target_service_account_failure() {
- /* Initialization. */
- grpc_alts_credentials_options* options =
- grpc_alts_credentials_client_options_create();
- auto client_options =
- reinterpret_cast<grpc_alts_credentials_client_options*>(options);
-
- /* Test. */
- GPR_ASSERT(!grpc_alts_credentials_client_options_add_target_service_account(
- client_options, nullptr));
- GPR_ASSERT(!grpc_alts_credentials_client_options_add_target_service_account(
- nullptr, ALTS_CLIENT_OPTIONS_TEST_TARGET_SERVICE_ACCOUNT_1));
-
- /* Cleanup. */
- grpc_alts_credentials_options_destroy(options);
-}
-
static void test_copy_client_options_failure() {
/* Initialization. */
grpc_alts_credentials_options* options =
grpc_alts_credentials_client_options_create();
-
/* Test. */
GPR_ASSERT(grpc_alts_credentials_options_copy(nullptr) == nullptr);
-
/* Cleanup. */
grpc_alts_credentials_options_destroy(options);
}
static size_t get_target_service_account_num(
- grpc_alts_credentials_client_options* options) {
+ grpc_alts_credentials_options* options) {
+ auto client_options =
+ reinterpret_cast<grpc_alts_credentials_client_options*>(options);
size_t num = 0;
- target_service_account* node = options->target_account_list_head;
+ target_service_account* node = client_options->target_account_list_head;
while (node != nullptr) {
num++;
node = node->next;
@@ -74,36 +57,31 @@ static void test_client_options_api_success() {
/* Initialization. */
grpc_alts_credentials_options* options =
grpc_alts_credentials_client_options_create();
- auto client_options =
- reinterpret_cast<grpc_alts_credentials_client_options*>(options);
-
/* Set client options fields. */
grpc_alts_credentials_client_options_add_target_service_account(
- client_options, ALTS_CLIENT_OPTIONS_TEST_TARGET_SERVICE_ACCOUNT_1);
+ options, ALTS_CLIENT_OPTIONS_TEST_TARGET_SERVICE_ACCOUNT_1);
grpc_alts_credentials_client_options_add_target_service_account(
- client_options, ALTS_CLIENT_OPTIONS_TEST_TARGET_SERVICE_ACCOUNT_2);
-
+ options, ALTS_CLIENT_OPTIONS_TEST_TARGET_SERVICE_ACCOUNT_2);
/* Validate client option fields. */
- GPR_ASSERT(get_target_service_account_num(client_options) ==
+ GPR_ASSERT(get_target_service_account_num(options) ==
kTargetServiceAccountNum);
+ auto client_options =
+ reinterpret_cast<grpc_alts_credentials_client_options*>(options);
GPR_ASSERT(strcmp(client_options->target_account_list_head->data,
ALTS_CLIENT_OPTIONS_TEST_TARGET_SERVICE_ACCOUNT_2) == 0);
GPR_ASSERT(strcmp(client_options->target_account_list_head->next->data,
ALTS_CLIENT_OPTIONS_TEST_TARGET_SERVICE_ACCOUNT_1) == 0);
-
/* Perform a copy operation and validate its correctness. */
grpc_alts_credentials_options* new_options =
grpc_alts_credentials_options_copy(options);
+ GPR_ASSERT(get_target_service_account_num(new_options) ==
+ kTargetServiceAccountNum);
auto new_client_options =
reinterpret_cast<grpc_alts_credentials_client_options*>(new_options);
-
- GPR_ASSERT(get_target_service_account_num(new_client_options) ==
- kTargetServiceAccountNum);
GPR_ASSERT(strcmp(new_client_options->target_account_list_head->data,
ALTS_CLIENT_OPTIONS_TEST_TARGET_SERVICE_ACCOUNT_2) == 0);
GPR_ASSERT(strcmp(new_client_options->target_account_list_head->next->data,
ALTS_CLIENT_OPTIONS_TEST_TARGET_SERVICE_ACCOUNT_1) == 0);
-
/* Cleanup.*/
grpc_alts_credentials_options_destroy(options);
grpc_alts_credentials_options_destroy(new_options);
@@ -111,7 +89,6 @@ static void test_client_options_api_success() {
int main(int argc, char** argv) {
/* Test. */
- test_add_target_service_account_failure();
test_copy_client_options_failure();
test_client_options_api_success();
return 0;
diff --git a/test/core/security/security_connector_test.cc b/test/core/security/security_connector_test.cc
index ed3849bfc8..e4c3ace6b4 100644
--- a/test/core/security/security_connector_test.cc
+++ b/test/core/security/security_connector_test.cc
@@ -87,15 +87,15 @@ static void test_unauthenticated_ssl_peer(void) {
GPR_ASSERT(tsi_construct_string_peer_property_from_cstring(
TSI_CERTIFICATE_TYPE_PEER_PROPERTY, TSI_X509_CERTIFICATE_TYPE,
&peer.properties[0]) == TSI_OK);
- ctx = tsi_ssl_peer_to_auth_context(&peer);
+ ctx = grpc_ssl_peer_to_auth_context(&peer);
GPR_ASSERT(ctx != nullptr);
GPR_ASSERT(!grpc_auth_context_peer_is_authenticated(ctx));
GPR_ASSERT(check_transport_security_type(ctx));
- rpeer = tsi_shallow_peer_from_ssl_auth_context(ctx);
+ rpeer = grpc_shallow_peer_from_ssl_auth_context(ctx);
GPR_ASSERT(check_ssl_peer_equivalence(&peer, &rpeer));
- tsi_shallow_peer_destruct(&rpeer);
+ grpc_shallow_peer_destruct(&rpeer);
tsi_peer_destruct(&peer);
GRPC_AUTH_CONTEXT_UNREF(ctx, "test");
}
@@ -187,7 +187,7 @@ static void test_cn_only_ssl_peer_to_auth_context(void) {
GPR_ASSERT(tsi_construct_string_peer_property_from_cstring(
TSI_X509_PEM_CERT_PROPERTY, expected_pem_cert,
&peer.properties[2]) == TSI_OK);
- ctx = tsi_ssl_peer_to_auth_context(&peer);
+ ctx = grpc_ssl_peer_to_auth_context(&peer);
GPR_ASSERT(ctx != nullptr);
GPR_ASSERT(grpc_auth_context_peer_is_authenticated(ctx));
GPR_ASSERT(check_identity(ctx, GRPC_X509_CN_PROPERTY_NAME, &expected_cn, 1));
@@ -195,10 +195,10 @@ static void test_cn_only_ssl_peer_to_auth_context(void) {
GPR_ASSERT(check_x509_cn(ctx, expected_cn));
GPR_ASSERT(check_x509_pem_cert(ctx, expected_pem_cert));
- rpeer = tsi_shallow_peer_from_ssl_auth_context(ctx);
+ rpeer = grpc_shallow_peer_from_ssl_auth_context(ctx);
GPR_ASSERT(check_ssl_peer_equivalence(&peer, &rpeer));
- tsi_shallow_peer_destruct(&rpeer);
+ grpc_shallow_peer_destruct(&rpeer);
tsi_peer_destruct(&peer);
GRPC_AUTH_CONTEXT_UNREF(ctx, "test");
}
@@ -223,7 +223,7 @@ static void test_cn_and_one_san_ssl_peer_to_auth_context(void) {
GPR_ASSERT(tsi_construct_string_peer_property_from_cstring(
TSI_X509_PEM_CERT_PROPERTY, expected_pem_cert,
&peer.properties[3]) == TSI_OK);
- ctx = tsi_ssl_peer_to_auth_context(&peer);
+ ctx = grpc_ssl_peer_to_auth_context(&peer);
GPR_ASSERT(ctx != nullptr);
GPR_ASSERT(grpc_auth_context_peer_is_authenticated(ctx));
GPR_ASSERT(
@@ -232,10 +232,10 @@ static void test_cn_and_one_san_ssl_peer_to_auth_context(void) {
GPR_ASSERT(check_x509_cn(ctx, expected_cn));
GPR_ASSERT(check_x509_pem_cert(ctx, expected_pem_cert));
- rpeer = tsi_shallow_peer_from_ssl_auth_context(ctx);
+ rpeer = grpc_shallow_peer_from_ssl_auth_context(ctx);
GPR_ASSERT(check_ssl_peer_equivalence(&peer, &rpeer));
- tsi_shallow_peer_destruct(&rpeer);
+ grpc_shallow_peer_destruct(&rpeer);
tsi_peer_destruct(&peer);
GRPC_AUTH_CONTEXT_UNREF(ctx, "test");
}
@@ -264,7 +264,7 @@ static void test_cn_and_multiple_sans_ssl_peer_to_auth_context(void) {
TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY,
expected_sans[i], &peer.properties[3 + i]) == TSI_OK);
}
- ctx = tsi_ssl_peer_to_auth_context(&peer);
+ ctx = grpc_ssl_peer_to_auth_context(&peer);
GPR_ASSERT(ctx != nullptr);
GPR_ASSERT(grpc_auth_context_peer_is_authenticated(ctx));
GPR_ASSERT(check_identity(ctx, GRPC_X509_SAN_PROPERTY_NAME, expected_sans,
@@ -273,10 +273,10 @@ static void test_cn_and_multiple_sans_ssl_peer_to_auth_context(void) {
GPR_ASSERT(check_x509_cn(ctx, expected_cn));
GPR_ASSERT(check_x509_pem_cert(ctx, expected_pem_cert));
- rpeer = tsi_shallow_peer_from_ssl_auth_context(ctx);
+ rpeer = grpc_shallow_peer_from_ssl_auth_context(ctx);
GPR_ASSERT(check_ssl_peer_equivalence(&peer, &rpeer));
- tsi_shallow_peer_destruct(&rpeer);
+ grpc_shallow_peer_destruct(&rpeer);
tsi_peer_destruct(&peer);
GRPC_AUTH_CONTEXT_UNREF(ctx, "test");
}
@@ -310,7 +310,7 @@ static void test_cn_and_multiple_sans_and_others_ssl_peer_to_auth_context(
TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY,
expected_sans[i], &peer.properties[5 + i]) == TSI_OK);
}
- ctx = tsi_ssl_peer_to_auth_context(&peer);
+ ctx = grpc_ssl_peer_to_auth_context(&peer);
GPR_ASSERT(ctx != nullptr);
GPR_ASSERT(grpc_auth_context_peer_is_authenticated(ctx));
GPR_ASSERT(check_identity(ctx, GRPC_X509_SAN_PROPERTY_NAME, expected_sans,
@@ -319,10 +319,10 @@ static void test_cn_and_multiple_sans_and_others_ssl_peer_to_auth_context(
GPR_ASSERT(check_x509_cn(ctx, expected_cn));
GPR_ASSERT(check_x509_pem_cert(ctx, expected_pem_cert));
- rpeer = tsi_shallow_peer_from_ssl_auth_context(ctx);
+ rpeer = grpc_shallow_peer_from_ssl_auth_context(ctx);
GPR_ASSERT(check_ssl_peer_equivalence(&peer, &rpeer));
- tsi_shallow_peer_destruct(&rpeer);
+ grpc_shallow_peer_destruct(&rpeer);
tsi_peer_destruct(&peer);
GRPC_AUTH_CONTEXT_UNREF(ctx, "test");
}
@@ -340,6 +340,41 @@ static grpc_ssl_roots_override_result override_roots_permanent_failure(
return GRPC_SSL_ROOTS_OVERRIDE_FAIL_PERMANENTLY;
}
+static void test_ipv6_address_san(void) {
+ const char* addresses[] = {
+ "2001:db8::1", "fe80::abcd:ef65:4321%em0", "fd11:feed:beef:0:cafe::4",
+ "128.10.0.1:8888", "[2001:db8::1]:8080", "[2001:db8::1%em1]:8080",
+ };
+ const char* san_ips[] = {
+ "2001:db8::1", "fe80::abcd:ef65:4321", "fd11:feed:beef:0:cafe::4",
+ "128.10.0.1", "2001:db8::1", "2001:db8::1",
+ };
+ tsi_peer peer;
+ GPR_ASSERT(tsi_construct_peer(1, &peer) == TSI_OK);
+ for (size_t i = 0; i < GPR_ARRAY_SIZE(addresses); i++) {
+ GPR_ASSERT(tsi_construct_string_peer_property_from_cstring(
+ TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY, san_ips[i],
+ &peer.properties[0]) == TSI_OK);
+ GPR_ASSERT(grpc_ssl_host_matches_name(&peer, addresses[i]));
+ tsi_peer_property_destruct(&peer.properties[0]);
+ }
+ tsi_peer_destruct(&peer);
+}
+namespace grpc_core {
+namespace {
+
+class TestDefafaultSllRootStore : public DefaultSslRootStore {
+ public:
+ static grpc_slice ComputePemRootCertsForTesting() {
+ return ComputePemRootCerts();
+ }
+};
+
+} // namespace
+} // namespace grpc_core
+
+// TODO: Convert this test to C++ test when security_connector implementation
+// is converted to C++.
static void test_default_ssl_roots(void) {
const char* roots_for_env_var = "roots for env var";
@@ -353,7 +388,8 @@ static void test_default_ssl_roots(void) {
value. */
gpr_setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR, "");
grpc_set_ssl_roots_override_callback(override_roots_success);
- grpc_slice roots = grpc_get_default_ssl_roots_for_testing();
+ grpc_slice roots =
+ grpc_core::TestDefafaultSllRootStore::ComputePemRootCertsForTesting();
char* roots_contents = grpc_slice_to_c_string(roots);
grpc_slice_unref(roots);
GPR_ASSERT(strcmp(roots_contents, roots_for_override_api) == 0);
@@ -362,7 +398,7 @@ static void test_default_ssl_roots(void) {
/* Now let's set the env var: We should get the contents pointed value
instead. */
gpr_setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR, roots_env_var_file_path);
- roots = grpc_get_default_ssl_roots_for_testing();
+ roots = grpc_core::TestDefafaultSllRootStore::ComputePemRootCertsForTesting();
roots_contents = grpc_slice_to_c_string(roots);
grpc_slice_unref(roots);
GPR_ASSERT(strcmp(roots_contents, roots_for_env_var) == 0);
@@ -371,7 +407,7 @@ static void test_default_ssl_roots(void) {
/* Now reset the env var. We should fall back to the value overridden using
the api. */
gpr_setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR, "");
- roots = grpc_get_default_ssl_roots_for_testing();
+ roots = grpc_core::TestDefafaultSllRootStore::ComputePemRootCertsForTesting();
roots_contents = grpc_slice_to_c_string(roots);
grpc_slice_unref(roots);
GPR_ASSERT(strcmp(roots_contents, roots_for_override_api) == 0);
@@ -380,8 +416,11 @@ static void test_default_ssl_roots(void) {
/* Now setup a permanent failure for the overridden roots and we should get
an empty slice. */
grpc_set_ssl_roots_override_callback(override_roots_permanent_failure);
- roots = grpc_get_default_ssl_roots_for_testing();
+ roots = grpc_core::TestDefafaultSllRootStore::ComputePemRootCertsForTesting();
GPR_ASSERT(GRPC_SLICE_IS_EMPTY(roots));
+ const tsi_ssl_root_certs_store* root_store =
+ grpc_core::TestDefafaultSllRootStore::GetRootStore();
+ GPR_ASSERT(root_store == nullptr);
/* Cleanup. */
remove(roots_env_var_file_path);
@@ -397,6 +436,7 @@ int main(int argc, char** argv) {
test_cn_and_one_san_ssl_peer_to_auth_context();
test_cn_and_multiple_sans_ssl_peer_to_auth_context();
test_cn_and_multiple_sans_and_others_ssl_peer_to_auth_context();
+ test_ipv6_address_san();
test_default_ssl_roots();
grpc_shutdown();
diff --git a/test/core/slice/slice_hash_table_test.cc b/test/core/slice/slice_hash_table_test.cc
index 279b543098..43ddfe9bf2 100644
--- a/test/core/slice/slice_hash_table_test.cc
+++ b/test/core/slice/slice_hash_table_test.cc
@@ -28,6 +28,7 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
#include "test/core/util/test_config.h"
diff --git a/test/core/slice/slice_test.cc b/test/core/slice/slice_test.cc
index 5a49793a9e..e683c41f31 100644
--- a/test/core/slice/slice_test.cc
+++ b/test/core/slice/slice_test.cc
@@ -16,8 +16,11 @@
*
*/
+#include <grpc/support/port_platform.h>
+
#include <grpc/slice.h>
+#include <inttypes.h>
#include <string.h>
#include <grpc/grpc.h>
diff --git a/test/core/slice/slice_weak_hash_table_test.cc b/test/core/slice/slice_weak_hash_table_test.cc
index 4711d2fd26..b0a243d572 100644
--- a/test/core/slice/slice_weak_hash_table_test.cc
+++ b/test/core/slice/slice_weak_hash_table_test.cc
@@ -28,6 +28,7 @@
#include <grpc/support/string_util.h>
#include "src/core/lib/gpr/useful.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
#include "test/core/util/test_config.h"
diff --git a/test/core/surface/BUILD b/test/core/surface/BUILD
index e848dded13..77df1cc989 100644
--- a/test/core/surface/BUILD
+++ b/test/core/surface/BUILD
@@ -91,18 +91,6 @@ grpc_cc_test(
)
grpc_cc_test(
- name = "grpc_invalid_channel_args_test",
- srcs = ["invalid_channel_args_test.cc"],
- language = "C++",
- deps = [
- "//:gpr",
- "//:grpc",
- "//test/core/util:gpr_test_util",
- "//test/core/util:grpc_test_util",
- ],
-)
-
-grpc_cc_test(
name = "lame_client_test",
srcs = ["lame_client_test.cc"],
language = "C++",
diff --git a/test/core/surface/concurrent_connectivity_test.cc b/test/core/surface/concurrent_connectivity_test.cc
index c1298b6636..fbc5ec4c54 100644
--- a/test/core/surface/concurrent_connectivity_test.cc
+++ b/test/core/surface/concurrent_connectivity_test.cc
@@ -124,14 +124,13 @@ void bad_server_thread(void* vargs) {
grpc_core::ExecCtx exec_ctx;
grpc_resolved_address resolved_addr;
- struct sockaddr_storage* addr =
- reinterpret_cast<struct sockaddr_storage*>(resolved_addr.addr);
+ grpc_sockaddr* addr = reinterpret_cast<grpc_sockaddr*>(resolved_addr.addr);
int port;
grpc_tcp_server* s;
grpc_error* error = grpc_tcp_server_create(nullptr, nullptr, &s);
GPR_ASSERT(error == GRPC_ERROR_NONE);
memset(&resolved_addr, 0, sizeof(resolved_addr));
- addr->ss_family = AF_INET;
+ addr->sa_family = GRPC_AF_INET;
error = grpc_tcp_server_add_port(s, &resolved_addr, &port);
GPR_ASSERT(GRPC_LOG_IF_ERROR("grpc_tcp_server_add_port", error));
GPR_ASSERT(port > 0);
diff --git a/test/core/surface/invalid_channel_args_test.cc b/test/core/surface/invalid_channel_args_test.cc
deleted file mode 100644
index 7c5f1f0352..0000000000
--- a/test/core/surface/invalid_channel_args_test.cc
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- *
- * Copyright 2015 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <grpc/grpc.h>
-#include <string.h>
-
-#include <grpc/support/alloc.h>
-#include <grpc/support/log.h>
-#include <grpc/support/string_util.h>
-#include "test/core/util/test_config.h"
-
-static char* g_last_log_error_message = nullptr;
-static const char* g_file_name = "channel.cc";
-
-static int ends_with(const char* src, const char* suffix) {
- size_t src_len = strlen(src);
- size_t suffix_len = strlen(suffix);
- if (src_len < suffix_len) {
- return 0;
- }
- return strcmp(src + src_len - suffix_len, suffix) == 0;
-}
-
-static void log_error_sink(gpr_log_func_args* args) {
- if (args->severity == GPR_LOG_SEVERITY_ERROR &&
- ends_with(args->file, g_file_name)) {
- g_last_log_error_message = gpr_strdup(args->message);
- }
-}
-
-static void verify_last_error(const char* message) {
- if (message == nullptr) {
- GPR_ASSERT(g_last_log_error_message == nullptr);
- return;
- }
- GPR_ASSERT(strcmp(message, g_last_log_error_message) == 0);
- gpr_free(g_last_log_error_message);
- g_last_log_error_message = nullptr;
-}
-
-static char* compose_error_string(const char* key, const char* message) {
- char* ret;
- gpr_asprintf(&ret, "%s%s", key, message);
- return ret;
-}
-
-static void one_test(grpc_channel_args* args, char* expected_error_message) {
- grpc_channel* chan =
- grpc_insecure_channel_create("nonexistant:54321", args, nullptr);
- verify_last_error(expected_error_message);
- gpr_free(expected_error_message);
- grpc_channel_destroy(chan);
-}
-
-static void test_no_error_message(void) { one_test(nullptr, nullptr); }
-
-static void test_default_authority_type(void) {
- grpc_arg client_arg;
- grpc_channel_args client_args;
- char* expected_error_message;
-
- client_arg.type = GRPC_ARG_INTEGER;
- client_arg.key = const_cast<char*>(GRPC_ARG_DEFAULT_AUTHORITY);
- client_arg.value.integer = 0;
-
- client_args.num_args = 1;
- client_args.args = &client_arg;
- expected_error_message = compose_error_string(
- GRPC_ARG_DEFAULT_AUTHORITY, " ignored: it must be a string");
- one_test(&client_args, expected_error_message);
-}
-
-static void test_ssl_name_override_type(void) {
- grpc_arg client_arg;
- grpc_channel_args client_args;
- char* expected_error_message;
-
- client_arg.type = GRPC_ARG_INTEGER;
- client_arg.key = const_cast<char*>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG);
- client_arg.value.integer = 0;
-
- client_args.num_args = 1;
- client_args.args = &client_arg;
- expected_error_message = compose_error_string(
- GRPC_SSL_TARGET_NAME_OVERRIDE_ARG, " ignored: it must be a string");
- one_test(&client_args, expected_error_message);
-}
-
-static void test_ssl_name_override_failed(void) {
- grpc_arg client_arg[2];
- grpc_channel_args client_args;
- char* expected_error_message;
-
- client_arg[0].type = GRPC_ARG_STRING;
- client_arg[0].key = const_cast<char*>(GRPC_ARG_DEFAULT_AUTHORITY);
- client_arg[0].value.string = const_cast<char*>("default");
- client_arg[1].type = GRPC_ARG_STRING;
- client_arg[1].key = const_cast<char*>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG);
- client_arg[1].value.string = const_cast<char*>("ssl");
-
- client_args.num_args = 2;
- client_args.args = client_arg;
- expected_error_message =
- compose_error_string(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG,
- " ignored: default host already set some other way");
- one_test(&client_args, expected_error_message);
-}
-
-int main(int argc, char** argv) {
- grpc_test_init(argc, argv);
- grpc_init();
- gpr_set_log_function(log_error_sink);
-
- test_no_error_message();
- test_default_authority_type();
- test_ssl_name_override_type();
- test_ssl_name_override_failed();
-
- grpc_shutdown();
-
- return 0;
-}
diff --git a/test/core/surface/public_headers_must_be_c89.c b/test/core/surface/public_headers_must_be_c89.c
index bd4dc0b60e..52a1b03998 100644
--- a/test/core/surface/public_headers_must_be_c89.c
+++ b/test/core/surface/public_headers_must_be_c89.c
@@ -106,6 +106,8 @@ int main(int argc, char **argv) {
printf("%lx", (unsigned long) grpc_insecure_channel_create);
printf("%lx", (unsigned long) grpc_lame_client_channel_create);
printf("%lx", (unsigned long) grpc_channel_destroy);
+ printf("%lx", (unsigned long) grpc_channel_get_trace);
+ printf("%lx", (unsigned long) grpc_channel_get_uuid);
printf("%lx", (unsigned long) grpc_call_cancel);
printf("%lx", (unsigned long) grpc_call_cancel_with_status);
printf("%lx", (unsigned long) grpc_call_ref);
@@ -141,6 +143,9 @@ int main(int argc, char **argv) {
printf("%lx", (unsigned long) grpc_auth_context_add_property);
printf("%lx", (unsigned long) grpc_auth_context_add_cstring_property);
printf("%lx", (unsigned long) grpc_auth_context_set_peer_identity_property_name);
+ printf("%lx", (unsigned long) grpc_ssl_session_cache_create_lru);
+ printf("%lx", (unsigned long) grpc_ssl_session_cache_destroy);
+ printf("%lx", (unsigned long) grpc_ssl_session_cache_create_channel_arg);
printf("%lx", (unsigned long) grpc_channel_credentials_release);
printf("%lx", (unsigned long) grpc_google_default_credentials_create);
printf("%lx", (unsigned long) grpc_set_ssl_roots_override_callback);
@@ -168,6 +173,12 @@ int main(int argc, char **argv) {
printf("%lx", (unsigned long) grpc_server_add_secure_http2_port);
printf("%lx", (unsigned long) grpc_call_set_credentials);
printf("%lx", (unsigned long) grpc_server_credentials_set_auth_metadata_processor);
+ printf("%lx", (unsigned long) grpc_alts_credentials_client_options_create);
+ printf("%lx", (unsigned long) grpc_alts_credentials_server_options_create);
+ printf("%lx", (unsigned long) grpc_alts_credentials_client_options_add_target_service_account);
+ printf("%lx", (unsigned long) grpc_alts_credentials_options_destroy);
+ printf("%lx", (unsigned long) grpc_alts_credentials_create);
+ printf("%lx", (unsigned long) grpc_alts_server_credentials_create);
printf("%lx", (unsigned long) grpc_raw_byte_buffer_create);
printf("%lx", (unsigned long) grpc_raw_compressed_byte_buffer_create);
printf("%lx", (unsigned long) grpc_byte_buffer_copy);
@@ -238,6 +249,7 @@ int main(int argc, char **argv) {
printf("%lx", (unsigned long) gpr_cpu_current_cpu);
printf("%lx", (unsigned long) gpr_log_severity_string);
printf("%lx", (unsigned long) gpr_log);
+ printf("%lx", (unsigned long) gpr_should_log);
printf("%lx", (unsigned long) gpr_log_message);
printf("%lx", (unsigned long) gpr_set_log_verbosity);
printf("%lx", (unsigned long) gpr_log_verbosity_init);
diff --git a/test/core/surface/server_chttp2_test.cc b/test/core/surface/server_chttp2_test.cc
index f0412d01d9..fd8ab9cd3d 100644
--- a/test/core/surface/server_chttp2_test.cc
+++ b/test/core/surface/server_chttp2_test.cc
@@ -37,6 +37,8 @@ void test_unparsable_target(void) {
grpc_server_destroy(server);
}
+// GRPC_ARG_ALLOW_REUSEPORT isn't supported for custom servers
+#ifndef GRPC_UV
void test_add_same_port_twice() {
grpc_arg a;
a.type = GRPC_ARG_INTEGER;
@@ -62,12 +64,15 @@ void test_add_same_port_twice() {
grpc_server_destroy(server);
grpc_completion_queue_destroy(cq);
}
+#endif
int main(int argc, char** argv) {
grpc_test_init(argc, argv);
grpc_init();
test_unparsable_target();
+#ifndef GRPC_UV
test_add_same_port_twice();
+#endif
grpc_shutdown();
return 0;
}
diff --git a/test/core/surface/server_test.cc b/test/core/surface/server_test.cc
index 3b08efb563..b4eabd8d4d 100644
--- a/test/core/surface/server_test.cc
+++ b/test/core/surface/server_test.cc
@@ -69,6 +69,8 @@ void test_request_call_on_no_server_cq(void) {
grpc_server_destroy(server);
}
+// GRPC_ARG_ALLOW_REUSEPORT isn't supported for custom servers
+#ifndef GRPC_UV
void test_bind_server_twice(void) {
grpc_arg a;
a.type = GRPC_ARG_INTEGER;
@@ -100,6 +102,7 @@ void test_bind_server_twice(void) {
grpc_completion_queue_destroy(cq);
gpr_free(addr);
}
+#endif
void test_bind_server_to_addr(const char* host, bool secure) {
int port = grpc_pick_unused_port_or_die();
@@ -149,7 +152,9 @@ int main(int argc, char** argv) {
grpc_init();
test_register_method_fail();
test_request_call_on_no_server_cq();
+#ifndef GRPC_UV
test_bind_server_twice();
+#endif
static const char* addrs[] = {
"::1", "127.0.0.1", "::ffff:127.0.0.1", "localhost", "0.0.0.0", "::",
diff --git a/test/core/transport/BUILD b/test/core/transport/BUILD
index 2c2d05b9ae..84fb3a1421 100644
--- a/test/core/transport/BUILD
+++ b/test/core/transport/BUILD
@@ -43,6 +43,9 @@ grpc_cc_test(
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
+ external_deps = [
+ "gtest",
+ ],
)
grpc_cc_test(
diff --git a/test/core/transport/byte_stream_test.cc b/test/core/transport/byte_stream_test.cc
index 6947d50976..df09637249 100644
--- a/test/core/transport/byte_stream_test.cc
+++ b/test/core/transport/byte_stream_test.cc
@@ -23,20 +23,23 @@
#include <grpc/support/log.h>
#include "src/core/lib/gpr/useful.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
#include "test/core/util/test_config.h"
+#include <gtest/gtest.h>
+
+namespace grpc_core {
+namespace {
+
//
-// grpc_slice_buffer_stream tests
+// SliceBufferByteStream tests
//
-static void not_called_closure(void* arg, grpc_error* error) {
- GPR_ASSERT(false);
-}
+void NotCalledClosure(void* arg, grpc_error* error) { GPR_ASSERT(false); }
-static void test_slice_buffer_stream_basic(void) {
- gpr_log(GPR_DEBUG, "test_slice_buffer_stream_basic");
+TEST(SliceBufferByteStream, Basic) {
grpc_core::ExecCtx exec_ctx;
// Create and populate slice buffer.
grpc_slice_buffer buffer;
@@ -49,28 +52,26 @@ static void test_slice_buffer_stream_basic(void) {
grpc_slice_buffer_add(&buffer, input[i]);
}
// Create byte stream.
- grpc_slice_buffer_stream stream;
- grpc_slice_buffer_stream_init(&stream, &buffer, 0);
- GPR_ASSERT(stream.base.length == 6);
+ SliceBufferByteStream stream(&buffer, 0);
+ grpc_slice_buffer_destroy_internal(&buffer);
+ EXPECT_EQ(6U, stream.length());
grpc_closure closure;
- GRPC_CLOSURE_INIT(&closure, not_called_closure, nullptr,
+ GRPC_CLOSURE_INIT(&closure, NotCalledClosure, nullptr,
grpc_schedule_on_exec_ctx);
- // Read each slice. Note that next() always returns synchronously.
+ // Read each slice. Note that Next() always returns synchronously.
for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) {
- GPR_ASSERT(grpc_byte_stream_next(&stream.base, ~(size_t)0, &closure));
+ ASSERT_TRUE(stream.Next(~(size_t)0, &closure));
grpc_slice output;
- grpc_error* error = grpc_byte_stream_pull(&stream.base, &output);
- GPR_ASSERT(error == GRPC_ERROR_NONE);
- GPR_ASSERT(grpc_slice_eq(input[i], output));
+ grpc_error* error = stream.Pull(&output);
+ EXPECT_TRUE(error == GRPC_ERROR_NONE);
+ EXPECT_TRUE(grpc_slice_eq(input[i], output));
grpc_slice_unref_internal(output);
}
// Clean up.
- grpc_byte_stream_destroy(&stream.base);
- grpc_slice_buffer_destroy_internal(&buffer);
+ stream.Orphan();
}
-static void test_slice_buffer_stream_shutdown(void) {
- gpr_log(GPR_DEBUG, "test_slice_buffer_stream_shutdown");
+TEST(SliceBufferByteStream, Shutdown) {
grpc_core::ExecCtx exec_ctx;
// Create and populate slice buffer.
grpc_slice_buffer buffer;
@@ -83,40 +84,38 @@ static void test_slice_buffer_stream_shutdown(void) {
grpc_slice_buffer_add(&buffer, input[i]);
}
// Create byte stream.
- grpc_slice_buffer_stream stream;
- grpc_slice_buffer_stream_init(&stream, &buffer, 0);
- GPR_ASSERT(stream.base.length == 6);
+ SliceBufferByteStream stream(&buffer, 0);
+ grpc_slice_buffer_destroy_internal(&buffer);
+ EXPECT_EQ(6U, stream.length());
grpc_closure closure;
- GRPC_CLOSURE_INIT(&closure, not_called_closure, nullptr,
+ GRPC_CLOSURE_INIT(&closure, NotCalledClosure, nullptr,
grpc_schedule_on_exec_ctx);
// Read the first slice.
- GPR_ASSERT(grpc_byte_stream_next(&stream.base, ~(size_t)0, &closure));
+ ASSERT_TRUE(stream.Next(~(size_t)0, &closure));
grpc_slice output;
- grpc_error* error = grpc_byte_stream_pull(&stream.base, &output);
- GPR_ASSERT(error == GRPC_ERROR_NONE);
- GPR_ASSERT(grpc_slice_eq(input[0], output));
+ grpc_error* error = stream.Pull(&output);
+ EXPECT_TRUE(error == GRPC_ERROR_NONE);
+ EXPECT_TRUE(grpc_slice_eq(input[0], output));
grpc_slice_unref_internal(output);
// Now shutdown.
grpc_error* shutdown_error =
GRPC_ERROR_CREATE_FROM_STATIC_STRING("shutdown error");
- grpc_byte_stream_shutdown(&stream.base, GRPC_ERROR_REF(shutdown_error));
+ stream.Shutdown(GRPC_ERROR_REF(shutdown_error));
// After shutdown, the next pull() should return the error.
- GPR_ASSERT(grpc_byte_stream_next(&stream.base, ~(size_t)0, &closure));
- error = grpc_byte_stream_pull(&stream.base, &output);
- GPR_ASSERT(error == shutdown_error);
+ ASSERT_TRUE(stream.Next(~(size_t)0, &closure));
+ error = stream.Pull(&output);
+ EXPECT_TRUE(error == shutdown_error);
GRPC_ERROR_UNREF(error);
GRPC_ERROR_UNREF(shutdown_error);
// Clean up.
- grpc_byte_stream_destroy(&stream.base);
- grpc_slice_buffer_destroy_internal(&buffer);
+ stream.Orphan();
}
//
-// grpc_caching_byte_stream tests
+// CachingByteStream tests
//
-static void test_caching_byte_stream_basic(void) {
- gpr_log(GPR_DEBUG, "test_caching_byte_stream_basic");
+TEST(CachingByteStream, Basic) {
grpc_core::ExecCtx exec_ctx;
// Create and populate slice buffer byte stream.
grpc_slice_buffer buffer;
@@ -128,34 +127,30 @@ static void test_caching_byte_stream_basic(void) {
for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) {
grpc_slice_buffer_add(&buffer, input[i]);
}
- grpc_slice_buffer_stream underlying_stream;
- grpc_slice_buffer_stream_init(&underlying_stream, &buffer, 0);
+ SliceBufferByteStream underlying_stream(&buffer, 0);
+ grpc_slice_buffer_destroy_internal(&buffer);
// Create cache and caching stream.
- grpc_byte_stream_cache cache;
- grpc_byte_stream_cache_init(&cache, &underlying_stream.base);
- grpc_caching_byte_stream stream;
- grpc_caching_byte_stream_init(&stream, &cache);
+ ByteStreamCache cache((OrphanablePtr<ByteStream>(&underlying_stream)));
+ ByteStreamCache::CachingByteStream stream(&cache);
grpc_closure closure;
- GRPC_CLOSURE_INIT(&closure, not_called_closure, nullptr,
+ GRPC_CLOSURE_INIT(&closure, NotCalledClosure, nullptr,
grpc_schedule_on_exec_ctx);
// Read each slice. Note that next() always returns synchronously,
// because the underlying byte stream always does.
for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) {
- GPR_ASSERT(grpc_byte_stream_next(&stream.base, ~(size_t)0, &closure));
+ ASSERT_TRUE(stream.Next(~(size_t)0, &closure));
grpc_slice output;
- grpc_error* error = grpc_byte_stream_pull(&stream.base, &output);
- GPR_ASSERT(error == GRPC_ERROR_NONE);
- GPR_ASSERT(grpc_slice_eq(input[i], output));
+ grpc_error* error = stream.Pull(&output);
+ EXPECT_TRUE(error == GRPC_ERROR_NONE);
+ EXPECT_TRUE(grpc_slice_eq(input[i], output));
grpc_slice_unref_internal(output);
}
// Clean up.
- grpc_byte_stream_destroy(&stream.base);
- grpc_byte_stream_cache_destroy(&cache);
- grpc_slice_buffer_destroy_internal(&buffer);
+ stream.Orphan();
+ cache.Destroy();
}
-static void test_caching_byte_stream_reset(void) {
- gpr_log(GPR_DEBUG, "test_caching_byte_stream_reset");
+TEST(CachingByteStream, Reset) {
grpc_core::ExecCtx exec_ctx;
// Create and populate slice buffer byte stream.
grpc_slice_buffer buffer;
@@ -167,41 +162,37 @@ static void test_caching_byte_stream_reset(void) {
for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) {
grpc_slice_buffer_add(&buffer, input[i]);
}
- grpc_slice_buffer_stream underlying_stream;
- grpc_slice_buffer_stream_init(&underlying_stream, &buffer, 0);
+ SliceBufferByteStream underlying_stream(&buffer, 0);
+ grpc_slice_buffer_destroy_internal(&buffer);
// Create cache and caching stream.
- grpc_byte_stream_cache cache;
- grpc_byte_stream_cache_init(&cache, &underlying_stream.base);
- grpc_caching_byte_stream stream;
- grpc_caching_byte_stream_init(&stream, &cache);
+ ByteStreamCache cache((OrphanablePtr<ByteStream>(&underlying_stream)));
+ ByteStreamCache::CachingByteStream stream(&cache);
grpc_closure closure;
- GRPC_CLOSURE_INIT(&closure, not_called_closure, nullptr,
+ GRPC_CLOSURE_INIT(&closure, NotCalledClosure, nullptr,
grpc_schedule_on_exec_ctx);
// Read one slice.
- GPR_ASSERT(grpc_byte_stream_next(&stream.base, ~(size_t)0, &closure));
+ ASSERT_TRUE(stream.Next(~(size_t)0, &closure));
grpc_slice output;
- grpc_error* error = grpc_byte_stream_pull(&stream.base, &output);
- GPR_ASSERT(error == GRPC_ERROR_NONE);
- GPR_ASSERT(grpc_slice_eq(input[0], output));
+ grpc_error* error = stream.Pull(&output);
+ EXPECT_TRUE(error == GRPC_ERROR_NONE);
+ EXPECT_TRUE(grpc_slice_eq(input[0], output));
grpc_slice_unref_internal(output);
// Reset the caching stream. The reads should start over from the
// first slice.
- grpc_caching_byte_stream_reset(&stream);
+ stream.Reset();
for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) {
- GPR_ASSERT(grpc_byte_stream_next(&stream.base, ~(size_t)0, &closure));
- error = grpc_byte_stream_pull(&stream.base, &output);
- GPR_ASSERT(error == GRPC_ERROR_NONE);
- GPR_ASSERT(grpc_slice_eq(input[i], output));
+ ASSERT_TRUE(stream.Next(~(size_t)0, &closure));
+ error = stream.Pull(&output);
+ EXPECT_TRUE(error == GRPC_ERROR_NONE);
+ EXPECT_TRUE(grpc_slice_eq(input[i], output));
grpc_slice_unref_internal(output);
}
// Clean up.
- grpc_byte_stream_destroy(&stream.base);
- grpc_byte_stream_cache_destroy(&cache);
- grpc_slice_buffer_destroy_internal(&buffer);
+ stream.Orphan();
+ cache.Destroy();
}
-static void test_caching_byte_stream_shared_cache(void) {
- gpr_log(GPR_DEBUG, "test_caching_byte_stream_shared_cache");
+TEST(CachingByteStream, SharedCache) {
grpc_core::ExecCtx exec_ctx;
// Create and populate slice buffer byte stream.
grpc_slice_buffer buffer;
@@ -213,54 +204,50 @@ static void test_caching_byte_stream_shared_cache(void) {
for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) {
grpc_slice_buffer_add(&buffer, input[i]);
}
- grpc_slice_buffer_stream underlying_stream;
- grpc_slice_buffer_stream_init(&underlying_stream, &buffer, 0);
+ SliceBufferByteStream underlying_stream(&buffer, 0);
+ grpc_slice_buffer_destroy_internal(&buffer);
// Create cache and two caching streams.
- grpc_byte_stream_cache cache;
- grpc_byte_stream_cache_init(&cache, &underlying_stream.base);
- grpc_caching_byte_stream stream1;
- grpc_caching_byte_stream_init(&stream1, &cache);
- grpc_caching_byte_stream stream2;
- grpc_caching_byte_stream_init(&stream2, &cache);
+ ByteStreamCache cache((OrphanablePtr<ByteStream>(&underlying_stream)));
+ ByteStreamCache::CachingByteStream stream1(&cache);
+ ByteStreamCache::CachingByteStream stream2(&cache);
grpc_closure closure;
- GRPC_CLOSURE_INIT(&closure, not_called_closure, nullptr,
+ GRPC_CLOSURE_INIT(&closure, NotCalledClosure, nullptr,
grpc_schedule_on_exec_ctx);
// Read one slice from stream1.
- GPR_ASSERT(grpc_byte_stream_next(&stream1.base, ~(size_t)0, &closure));
+ EXPECT_TRUE(stream1.Next(~(size_t)0, &closure));
grpc_slice output;
- grpc_error* error = grpc_byte_stream_pull(&stream1.base, &output);
- GPR_ASSERT(error == GRPC_ERROR_NONE);
- GPR_ASSERT(grpc_slice_eq(input[0], output));
+ grpc_error* error = stream1.Pull(&output);
+ EXPECT_TRUE(error == GRPC_ERROR_NONE);
+ EXPECT_TRUE(grpc_slice_eq(input[0], output));
grpc_slice_unref_internal(output);
// Read all slices from stream2.
for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) {
- GPR_ASSERT(grpc_byte_stream_next(&stream2.base, ~(size_t)0, &closure));
- error = grpc_byte_stream_pull(&stream2.base, &output);
- GPR_ASSERT(error == GRPC_ERROR_NONE);
- GPR_ASSERT(grpc_slice_eq(input[i], output));
+ EXPECT_TRUE(stream2.Next(~(size_t)0, &closure));
+ error = stream2.Pull(&output);
+ EXPECT_TRUE(error == GRPC_ERROR_NONE);
+ EXPECT_TRUE(grpc_slice_eq(input[i], output));
grpc_slice_unref_internal(output);
}
// Now read the second slice from stream1.
- GPR_ASSERT(grpc_byte_stream_next(&stream1.base, ~(size_t)0, &closure));
- error = grpc_byte_stream_pull(&stream1.base, &output);
- GPR_ASSERT(error == GRPC_ERROR_NONE);
- GPR_ASSERT(grpc_slice_eq(input[1], output));
+ EXPECT_TRUE(stream1.Next(~(size_t)0, &closure));
+ error = stream1.Pull(&output);
+ EXPECT_TRUE(error == GRPC_ERROR_NONE);
+ EXPECT_TRUE(grpc_slice_eq(input[1], output));
grpc_slice_unref_internal(output);
// Clean up.
- grpc_byte_stream_destroy(&stream1.base);
- grpc_byte_stream_destroy(&stream2.base);
- grpc_byte_stream_cache_destroy(&cache);
- grpc_slice_buffer_destroy_internal(&buffer);
+ stream1.Orphan();
+ stream2.Orphan();
+ cache.Destroy();
}
+} // namespace
+} // namespace grpc_core
+
int main(int argc, char** argv) {
grpc_init();
grpc_test_init(argc, argv);
- test_slice_buffer_stream_basic();
- test_slice_buffer_stream_shutdown();
- test_caching_byte_stream_basic();
- test_caching_byte_stream_reset();
- test_caching_byte_stream_shared_cache();
+ ::testing::InitGoogleTest(&argc, argv);
+ int retval = RUN_ALL_TESTS();
grpc_shutdown();
- return 0;
+ return retval;
}
diff --git a/test/core/transport/chttp2/bin_decoder_test.cc b/test/core/transport/chttp2/bin_decoder_test.cc
index 751dd90c8c..b4b07986a3 100644
--- a/test/core/transport/chttp2/bin_decoder_test.cc
+++ b/test/core/transport/chttp2/bin_decoder_test.cc
@@ -25,6 +25,7 @@
#include <grpc/support/log.h>
#include "src/core/ext/transport/chttp2/transport/bin_encoder.h"
#include "src/core/lib/gpr/string.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/slice/slice_string_helpers.h"
diff --git a/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc b/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc
index 9a195daee0..a8eec1eefd 100644
--- a/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc
+++ b/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc
@@ -24,6 +24,7 @@
#include <grpc/support/log.h>
#include "src/core/ext/transport/chttp2/transport/hpack_parser.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
bool squelch = true;
diff --git a/test/core/transport/chttp2/hpack_parser_test.cc b/test/core/transport/chttp2/hpack_parser_test.cc
index 9d3456a873..43b6c79e8a 100644
--- a/test/core/transport/chttp2/hpack_parser_test.cc
+++ b/test/core/transport/chttp2/hpack_parser_test.cc
@@ -24,6 +24,8 @@
#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
+
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "test/core/util/parse_hexstring.h"
#include "test/core/util/slice_splitter.h"
#include "test/core/util/test_config.h"
diff --git a/test/core/transport/chttp2/hpack_table_test.cc b/test/core/transport/chttp2/hpack_table_test.cc
index e316cf63a0..3ab463b631 100644
--- a/test/core/transport/chttp2/hpack_table_test.cc
+++ b/test/core/transport/chttp2/hpack_table_test.cc
@@ -27,6 +27,7 @@
#include <grpc/support/string_util.h>
#include "src/core/lib/gpr/string.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "test/core/util/test_config.h"
#define LOG_TEST(x) gpr_log(GPR_INFO, "%s", x)
diff --git a/test/core/transport/connectivity_state_test.cc b/test/core/transport/connectivity_state_test.cc
index f5894599e5..cbd6318f52 100644
--- a/test/core/transport/connectivity_state_test.cc
+++ b/test/core/transport/connectivity_state_test.cc
@@ -22,6 +22,7 @@
#include <grpc/support/log.h>
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "test/core/util/test_config.h"
#include "test/core/util/tracer_util.h"
diff --git a/test/core/transport/metadata_test.cc b/test/core/transport/metadata_test.cc
index 786df97285..4be34f72d9 100644
--- a/test/core/transport/metadata_test.cc
+++ b/test/core/transport/metadata_test.cc
@@ -28,6 +28,7 @@
#include "src/core/ext/transport/chttp2/transport/bin_encoder.h"
#include "src/core/lib/gpr/string.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/transport/static_metadata.h"
#include "test/core/util/test_config.h"
diff --git a/test/core/tsi/BUILD b/test/core/tsi/BUILD
index 8ac3e7687c..ae6e8fdc32 100644
--- a/test/core/tsi/BUILD
+++ b/test/core/tsi/BUILD
@@ -41,6 +41,20 @@ grpc_cc_test(
],
)
+grpc_cc_test(
+ name = "ssl_session_cache_test",
+ srcs = ["ssl_session_cache_test.cc"],
+ language = "C++",
+ external_deps = [
+ "gtest",
+ ],
+ deps = [
+ "//:grpc",
+ "//:gpr",
+ "//:tsi",
+ "//test/core/util:gpr_test_util",
+ ],
+)
grpc_cc_test(
name = "ssl_transport_security_test",
diff --git a/test/core/tsi/alts/crypt/BUILD b/test/core/tsi/alts/crypt/BUILD
index 0057d7f6e6..cf9dbca316 100644
--- a/test/core/tsi/alts/crypt/BUILD
+++ b/test/core/tsi/alts/crypt/BUILD
@@ -16,16 +16,7 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_p
licenses(["notice"]) # Apache v2
-grpc_package(name = "crypt", visibility = "public")
-
-grpc_cc_library(
- name = "alts_crypt_test_util",
- srcs = ["gsec_test_util.cc"],
- hdrs = ["gsec_test_util.h"],
- deps = [
- "//:grpc",
- ],
-)
+grpc_package(name = "test/core/tsi/alts/crypt", visibility = "public")
grpc_cc_test(
name = "alts_crypt_test",
@@ -33,6 +24,19 @@ grpc_cc_test(
language = "C++",
deps = [
":alts_crypt_test_util",
+ "//:alts_frame_protector",
+ "//:gpr",
"//:grpc",
],
)
+
+grpc_cc_library(
+ name = "alts_crypt_test_util",
+ srcs = ["gsec_test_util.cc"],
+ hdrs = ["gsec_test_util.h"],
+ deps = [
+ "//:gpr",
+ "//:grpc",
+ ],
+)
+
diff --git a/test/core/tsi/alts/crypt/gsec_test_util.cc b/test/core/tsi/alts/crypt/gsec_test_util.cc
index 992c91e6bc..c682fb8e4d 100644
--- a/test/core/tsi/alts/crypt/gsec_test_util.cc
+++ b/test/core/tsi/alts/crypt/gsec_test_util.cc
@@ -18,13 +18,15 @@
#include "test/core/tsi/alts/crypt/gsec_test_util.h"
+#include <time.h>
+
#include <grpc/support/alloc.h>
void gsec_test_random_bytes(uint8_t* bytes, size_t length) {
- if (!RAND_bytes(bytes, static_cast<int>(length))) {
- fprintf(stderr,
- "Random bytes generation failed in gsec_test_random_bytes().");
- abort();
+ srand(time(nullptr));
+ size_t ind;
+ for (ind = 0; ind < length; ind++) {
+ bytes[ind] = static_cast<uint8_t>(rand() % 255 + 1);
}
}
diff --git a/test/core/tsi/alts/crypt/gsec_test_util.h b/test/core/tsi/alts/crypt/gsec_test_util.h
index 206ae2fda8..1bd780000f 100644
--- a/test/core/tsi/alts/crypt/gsec_test_util.h
+++ b/test/core/tsi/alts/crypt/gsec_test_util.h
@@ -24,8 +24,6 @@
#include <stdlib.h>
#include <string.h>
-#include <openssl/rand.h>
-
#include <grpc/grpc.h>
/**
diff --git a/test/core/tsi/alts/fake_handshaker/BUILD b/test/core/tsi/alts/fake_handshaker/BUILD
new file mode 100644
index 0000000000..a09a046d27
--- /dev/null
+++ b/test/core/tsi/alts/fake_handshaker/BUILD
@@ -0,0 +1,57 @@
+# Copyright 2018 gRPC authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+licenses(["notice"]) # Apache v2
+
+load("//bazel:grpc_build_system.bzl", "grpc_proto_library", "grpc_cc_library", "grpc_cc_binary", "grpc_package")
+
+grpc_package(name = "test/core/tsi/alts/fake_handshaker", visibility = "public")
+
+grpc_proto_library(
+ name = "transport_security_common_proto",
+ srcs = ["transport_security_common.proto"],
+ has_services = False,
+)
+
+grpc_proto_library(
+ name = "handshaker_proto",
+ srcs = ["handshaker.proto"],
+ has_services = True,
+ deps = [
+ "transport_security_common_proto",
+ ],
+)
+
+grpc_cc_library(
+ name = "fake_handshaker_lib",
+ testonly = True,
+ srcs = ["fake_handshaker_server.cc"],
+ language = "C++",
+ deps = [
+ "handshaker_proto",
+ "transport_security_common_proto",
+ "//:grpc++",
+ "//test/cpp/util:test_config",
+ ],
+)
+
+grpc_cc_binary(
+ name = "fake_handshaker_server",
+ testonly = True,
+ srcs = ["fake_handshaker_server.cc"],
+ language = "C++",
+ deps = [
+ "fake_handshaker_lib",
+ ],
+)
diff --git a/test/core/tsi/alts/fake_handshaker/fake_handshaker_server.cc b/test/core/tsi/alts/fake_handshaker/fake_handshaker_server.cc
new file mode 100644
index 0000000000..f6a4791b49
--- /dev/null
+++ b/test/core/tsi/alts/fake_handshaker/fake_handshaker_server.cc
@@ -0,0 +1,268 @@
+/*
+ *
+ * Copyright 2018 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <memory>
+#include <sstream>
+#include <string>
+
+#include <gflags/gflags.h>
+#include <grpc/grpc.h>
+#include <grpc/support/log.h>
+#include <grpcpp/impl/codegen/async_stream.h>
+#include <grpcpp/security/server_credentials.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
+#include <grpcpp/server_context.h>
+
+#include "test/core/tsi/alts/fake_handshaker/handshaker.grpc.pb.h"
+#include "test/core/tsi/alts/fake_handshaker/handshaker.pb.h"
+#include "test/core/tsi/alts/fake_handshaker/transport_security_common.pb.h"
+#include "test/cpp/util/test_config.h"
+
+DEFINE_int32(handshaker_port, 55056,
+ "TCP port on which the fake handshaker server listens to.");
+
+// Fake handshake messages.
+constexpr char kClientInitFrame[] = "ClientInit";
+constexpr char kServerFrame[] = "ServerInitAndFinished";
+constexpr char kClientFinishFrame[] = "ClientFinished";
+// Error messages.
+constexpr char kInvalidFrameError[] = "Invalid input frame.";
+constexpr char kWrongStateError[] = "Wrong handshake state.";
+
+namespace grpc {
+namespace gcp {
+
+// FakeHandshakeService implements a fake handshaker service using a fake key
+// exchange protocol. The fake key exchange protocol is a 3-message protocol:
+// - Client first sends ClientInit message to Server.
+// - Server then sends ServerInitAndFinished message back to Client.
+// - Client finally sends ClientFinished message to Server.
+// This fake handshaker service is intended for ALTS integration testing without
+// relying on real ALTS handshaker service inside GCE.
+// It is thread-safe.
+class FakeHandshakerService : public HandshakerService::Service {
+ public:
+ Status DoHandshake(
+ ServerContext* server_context,
+ ServerReaderWriter<HandshakerResp, HandshakerReq>* stream) override {
+ Status status;
+ HandshakerContext context;
+ HandshakerReq request;
+ HandshakerResp response;
+ gpr_log(GPR_DEBUG, "Start a new handshake.");
+ while (stream->Read(&request)) {
+ status = ProcessRequest(&context, request, &response);
+ if (!status.ok()) return WriteErrorResponse(stream, status);
+ stream->Write(response);
+ if (context.state == COMPLETED) return Status::OK;
+ request.Clear();
+ }
+ return Status::OK;
+ }
+
+ private:
+ // HandshakeState is used by fake handshaker server to keep track of client's
+ // handshake status. In the beginning of a handshake, the state is INITIAL.
+ // If start_client or start_server request is called, the state becomes at
+ // least STARTED. When the handshaker server produces the first fame, the
+ // state becomes SENT. After the handshaker server processes the final frame
+ // from the peer, the state becomes COMPLETED.
+ enum HandshakeState { INITIAL, STARTED, SENT, COMPLETED };
+
+ struct HandshakerContext {
+ bool is_client = true;
+ HandshakeState state = INITIAL;
+ };
+
+ Status ProcessRequest(HandshakerContext* context,
+ const HandshakerReq& request,
+ HandshakerResp* response) {
+ GPR_ASSERT(context != nullptr && response != nullptr);
+ response->Clear();
+ if (request.has_client_start()) {
+ gpr_log(GPR_DEBUG, "Process client start request.");
+ return ProcessClientStart(context, request.client_start(), response);
+ } else if (request.has_server_start()) {
+ gpr_log(GPR_DEBUG, "Process server start request.");
+ return ProcessServerStart(context, request.server_start(), response);
+ } else if (request.has_next()) {
+ gpr_log(GPR_DEBUG, "Process next request.");
+ return ProcessNext(context, request.next(), response);
+ }
+ return Status(StatusCode::INVALID_ARGUMENT, "Request is empty.");
+ }
+
+ Status ProcessClientStart(HandshakerContext* context,
+ const StartClientHandshakeReq& request,
+ HandshakerResp* response) {
+ GPR_ASSERT(context != nullptr && response != nullptr);
+ // Checks request.
+ if (context->state != INITIAL) {
+ return Status(StatusCode::FAILED_PRECONDITION, kWrongStateError);
+ }
+ if (request.application_protocols_size() == 0) {
+ return Status(StatusCode::INVALID_ARGUMENT,
+ "At least one application protocol needed.");
+ }
+ if (request.record_protocols_size() == 0) {
+ return Status(StatusCode::INVALID_ARGUMENT,
+ "At least one record protocol needed.");
+ }
+ // Sets response.
+ response->set_out_frames(kClientInitFrame);
+ response->set_bytes_consumed(0);
+ response->mutable_status()->set_code(StatusCode::OK);
+ // Updates handshaker context.
+ context->is_client = true;
+ context->state = SENT;
+ return Status::OK;
+ }
+
+ Status ProcessServerStart(HandshakerContext* context,
+ const StartServerHandshakeReq& request,
+ HandshakerResp* response) {
+ GPR_ASSERT(context != nullptr && response != nullptr);
+ // Checks request.
+ if (context->state != INITIAL) {
+ return Status(StatusCode::FAILED_PRECONDITION, kWrongStateError);
+ }
+ if (request.application_protocols_size() == 0) {
+ return Status(StatusCode::INVALID_ARGUMENT,
+ "At least one application protocol needed.");
+ }
+ if (request.handshake_parameters().empty()) {
+ return Status(StatusCode::INVALID_ARGUMENT,
+ "At least one set of handshake parameters needed.");
+ }
+ // Sets response.
+ if (request.in_bytes().empty()) {
+ // start_server request does not have in_bytes.
+ response->set_bytes_consumed(0);
+ context->state = STARTED;
+ } else {
+ // start_server request has in_bytes.
+ if (request.in_bytes() == kClientInitFrame) {
+ response->set_out_frames(kServerFrame);
+ response->set_bytes_consumed(strlen(kClientInitFrame));
+ context->state = SENT;
+ } else {
+ return Status(StatusCode::UNKNOWN, kInvalidFrameError);
+ }
+ }
+ response->mutable_status()->set_code(StatusCode::OK);
+ context->is_client = false;
+ return Status::OK;
+ }
+
+ Status ProcessNext(HandshakerContext* context,
+ const NextHandshakeMessageReq& request,
+ HandshakerResp* response) {
+ GPR_ASSERT(context != nullptr && response != nullptr);
+ if (context->is_client) {
+ // Processes next request on client side.
+ if (context->state != SENT) {
+ return Status(StatusCode::FAILED_PRECONDITION, kWrongStateError);
+ }
+ if (request.in_bytes() != kServerFrame) {
+ return Status(StatusCode::UNKNOWN, kInvalidFrameError);
+ }
+ response->set_out_frames(kClientFinishFrame);
+ response->set_bytes_consumed(strlen(kServerFrame));
+ context->state = COMPLETED;
+ } else {
+ // Processes next request on server side.
+ HandshakeState current_state = context->state;
+ if (current_state == STARTED) {
+ if (request.in_bytes() != kClientInitFrame) {
+ return Status(StatusCode::UNKNOWN, kInvalidFrameError);
+ }
+ response->set_out_frames(kServerFrame);
+ response->set_bytes_consumed(strlen(kClientInitFrame));
+ context->state = SENT;
+ } else if (current_state == SENT) {
+ // Client finish frame may be sent along with the first payload from the
+ // client, handshaker only consumes the client finish frame.
+ if (request.in_bytes().substr(0, strlen(kClientFinishFrame)) !=
+ kClientFinishFrame) {
+ return Status(StatusCode::UNKNOWN, kInvalidFrameError);
+ }
+ response->set_bytes_consumed(strlen(kClientFinishFrame));
+ context->state = COMPLETED;
+ } else {
+ return Status(StatusCode::FAILED_PRECONDITION, kWrongStateError);
+ }
+ }
+ // At this point, processing next request succeeded.
+ response->mutable_status()->set_code(StatusCode::OK);
+ if (context->state == COMPLETED) {
+ *response->mutable_result() = GetHandshakerResult();
+ }
+ return Status::OK;
+ }
+
+ Status WriteErrorResponse(
+ ServerReaderWriter<HandshakerResp, HandshakerReq>* stream,
+ const Status& status) {
+ GPR_ASSERT(!status.ok());
+ HandshakerResp response;
+ response.mutable_status()->set_code(status.error_code());
+ response.mutable_status()->set_details(status.error_message());
+ stream->Write(response);
+ return status;
+ }
+
+ HandshakerResult GetHandshakerResult() {
+ HandshakerResult result;
+ result.set_application_protocol("grpc");
+ result.set_record_protocol("ALTSRP_GCM_AES128_REKEY");
+ result.mutable_peer_identity()->set_service_account("peer_identity");
+ result.mutable_local_identity()->set_service_account("local_identity");
+ string key(1024, '\0');
+ result.set_key_data(key);
+ result.mutable_peer_rpc_versions()->mutable_max_rpc_version()->set_major(2);
+ result.mutable_peer_rpc_versions()->mutable_max_rpc_version()->set_minor(1);
+ result.mutable_peer_rpc_versions()->mutable_min_rpc_version()->set_major(2);
+ result.mutable_peer_rpc_versions()->mutable_min_rpc_version()->set_minor(1);
+ return result;
+ }
+};
+
+} // namespace gcp
+} // namespace grpc
+
+void RunServer() {
+ GPR_ASSERT(FLAGS_handshaker_port != 0);
+ std::ostringstream server_address;
+ server_address << "[::1]:" << FLAGS_handshaker_port;
+ grpc::gcp::FakeHandshakerService service;
+ grpc::ServerBuilder builder;
+ builder.AddListeningPort(server_address.str(),
+ grpc::InsecureServerCredentials());
+ builder.RegisterService(&service);
+ std::unique_ptr<grpc::Server> server(builder.BuildAndStart());
+ gpr_log(GPR_INFO, "Fake handshaker server listening on %s",
+ server_address.str().c_str());
+ server->Wait();
+}
+
+int main(int argc, char** argv) {
+ grpc::testing::InitTest(&argc, &argv, true);
+ RunServer();
+ return 0;
+}
diff --git a/test/core/tsi/alts/fake_handshaker/handshaker.proto b/test/core/tsi/alts/fake_handshaker/handshaker.proto
new file mode 100644
index 0000000000..8af9abfbf5
--- /dev/null
+++ b/test/core/tsi/alts/fake_handshaker/handshaker.proto
@@ -0,0 +1,224 @@
+// Copyright 2018 gRPC authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+syntax = "proto3";
+
+import "test/core/tsi/alts/fake_handshaker/transport_security_common.proto";
+
+package grpc.gcp;
+
+option java_package = "io.grpc.alts.internal";
+
+enum HandshakeProtocol {
+ // Default value.
+ HANDSHAKE_PROTOCOL_UNSPECIFIED = 0;
+
+ // TLS handshake protocol.
+ TLS = 1;
+
+ // Application Layer Transport Security handshake protocol.
+ ALTS = 2;
+}
+
+enum NetworkProtocol {
+ NETWORK_PROTOCOL_UNSPECIFIED = 0;
+ TCP = 1;
+ UDP = 2;
+}
+
+message Endpoint {
+ // IP address. It should contain an IPv4 or IPv6 string literal, e.g.
+ // "192.168.0.1" or "2001:db8::1".
+ string ip_address = 1;
+
+ // Port number.
+ int32 port = 2;
+
+ // Network protocol (e.g., TCP, UDP) associated with this endpoint.
+ NetworkProtocol protocol = 3;
+}
+
+message Identity {
+ oneof identity_oneof {
+ // Service account of a connection endpoint.
+ string service_account = 1;
+
+ // Hostname of a connection endpoint.
+ string hostname = 2;
+ }
+}
+
+message StartClientHandshakeReq {
+ // Handshake security protocol requested by the client.
+ HandshakeProtocol handshake_security_protocol = 1;
+
+ // The application protocols supported by the client, e.g., "h2" (for http2),
+ // "grpc".
+ repeated string application_protocols = 2;
+
+ // The record protocols supported by the client, e.g.,
+ // "ALTSRP_GCM_AES128".
+ repeated string record_protocols = 3;
+
+ // (Optional) Describes which server identities are acceptable by the client.
+ // If target identities are provided and none of them matches the peer
+ // identity of the server, handshake will fail.
+ repeated Identity target_identities = 4;
+
+ // (Optional) Application may specify a local identity. Otherwise, the
+ // handshaker chooses a default local identity.
+ Identity local_identity = 5;
+
+ // (Optional) Local endpoint information of the connection to the server,
+ // such as local IP address, port number, and network protocol.
+ Endpoint local_endpoint = 6;
+
+ // (Optional) Endpoint information of the remote server, such as IP address,
+ // port number, and network protocol.
+ Endpoint remote_endpoint = 7;
+
+ // (Optional) If target name is provided, a secure naming check is performed
+ // to verify that the peer authenticated identity is indeed authorized to run
+ // the target name.
+ string target_name = 8;
+
+ // (Optional) RPC protocol versions supported by the client.
+ RpcProtocolVersions rpc_versions = 9;
+}
+
+message ServerHandshakeParameters {
+ // The record protocols supported by the server, e.g.,
+ // "ALTSRP_GCM_AES128".
+ repeated string record_protocols = 1;
+
+ // (Optional) A list of local identities supported by the server, if
+ // specified. Otherwise, the handshaker chooses a default local identity.
+ repeated Identity local_identities = 2;
+}
+
+message StartServerHandshakeReq {
+ // The application protocols supported by the server, e.g., "h2" (for http2),
+ // "grpc".
+ repeated string application_protocols = 1;
+
+ // Handshake parameters (record protocols and local identities supported by
+ // the server) mapped by the handshake protocol. Each handshake security
+ // protocol (e.g., TLS or ALTS) has its own set of record protocols and local
+ // identities. Since protobuf does not support enum as key to the map, the key
+ // to handshake_parameters is the integer value of HandshakeProtocol enum.
+ map<int32, ServerHandshakeParameters> handshake_parameters = 2;
+
+ // Bytes in out_frames returned from the peer's HandshakerResp. It is possible
+ // that the peer's out_frames are split into multiple HandshakReq messages.
+ bytes in_bytes = 3;
+
+ // (Optional) Local endpoint information of the connection to the client,
+ // such as local IP address, port number, and network protocol.
+ Endpoint local_endpoint = 4;
+
+ // (Optional) Endpoint information of the remote client, such as IP address,
+ // port number, and network protocol.
+ Endpoint remote_endpoint = 5;
+
+ // (Optional) RPC protocol versions supported by the server.
+ RpcProtocolVersions rpc_versions = 6;
+}
+
+message NextHandshakeMessageReq {
+ // Bytes in out_frames returned from the peer's HandshakerResp. It is possible
+ // that the peer's out_frames are split into multiple NextHandshakerMessageReq
+ // messages.
+ bytes in_bytes = 1;
+}
+
+message HandshakerReq {
+ oneof req_oneof {
+ // The start client handshake request message.
+ StartClientHandshakeReq client_start = 1;
+
+ // The start server handshake request message.
+ StartServerHandshakeReq server_start = 2;
+
+ // The next handshake request message.
+ NextHandshakeMessageReq next = 3;
+ }
+}
+
+message HandshakerResult {
+ // The application protocol negotiated for this connection.
+ string application_protocol = 1;
+
+ // The record protocol negotiated for this connection.
+ string record_protocol = 2;
+
+ // Cryptographic key data. The key data may be more than the key length
+ // required for the record protocol, thus the client of the handshaker
+ // service needs to truncate the key data into the right key length.
+ bytes key_data = 3;
+
+ // The authenticated identity of the peer.
+ Identity peer_identity = 4;
+
+ // The local identity used in the handshake.
+ Identity local_identity = 5;
+
+ // Indicate whether the handshaker service client should keep the channel
+ // between the handshaker service open, e.g., in order to handle
+ // post-handshake messages in the future.
+ bool keep_channel_open = 6;
+
+ // The RPC protocol versions supported by the peer.
+ RpcProtocolVersions peer_rpc_versions = 7;
+}
+
+message HandshakerStatus {
+ // The status code. This could be the gRPC status code.
+ uint32 code = 1;
+
+ // The status details.
+ string details = 2;
+}
+
+message HandshakerResp {
+ // Frames to be given to the peer for the NextHandshakeMessageReq. May be
+ // empty if no out_frames have to be sent to the peer or if in_bytes in the
+ // HandshakerReq are incomplete. All the non-empty out frames must be sent to
+ // the peer even if the handshaker status is not OK as these frames may
+ // contain the alert frames.
+ bytes out_frames = 1;
+
+ // Number of bytes in the in_bytes consumed by the handshaker. It is possible
+ // that part of in_bytes in HandshakerReq was unrelated to the handshake
+ // process.
+ uint32 bytes_consumed = 2;
+
+ // This is set iff the handshake was successful. out_frames may still be set
+ // to frames that needs to be forwarded to the peer.
+ HandshakerResult result = 3;
+
+ // Status of the handshaker.
+ HandshakerStatus status = 4;
+}
+
+service HandshakerService {
+ // Handshaker service accepts a stream of handshaker request, returning a
+ // stream of handshaker response. Client is expected to send exactly one
+ // message with either client_start or server_start followed by one or more
+ // messages with next. Each time client sends a request, the handshaker
+ // service expects to respond. Client does not have to wait for service's
+ // response before sending next request.
+ rpc DoHandshake(stream HandshakerReq)
+ returns (stream HandshakerResp) {
+ }
+}
diff --git a/test/core/tsi/alts/fake_handshaker/transport_security_common.proto b/test/core/tsi/alts/fake_handshaker/transport_security_common.proto
new file mode 100644
index 0000000000..d0f861e644
--- /dev/null
+++ b/test/core/tsi/alts/fake_handshaker/transport_security_common.proto
@@ -0,0 +1,40 @@
+// Copyright 2018 gRPC authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+syntax = "proto3";
+
+package grpc.gcp;
+
+option java_package = "io.grpc.alts.internal";
+
+// The security level of the created channel. The list is sorted in increasing
+// level of security. This order must always be maintained.
+enum SecurityLevel {
+ SECURITY_NONE = 0;
+ INTEGRITY_ONLY = 1;
+ INTEGRITY_AND_PRIVACY = 2;
+}
+
+// Max and min supported RPC protocol versions.
+message RpcProtocolVersions {
+ // RPC version contains a major version and a minor version.
+ message Version {
+ uint32 major = 1;
+ uint32 minor = 2;
+ }
+ // Maximum supported RPC version.
+ Version max_rpc_version = 1;
+ // Minimum supported RPC version.
+ Version min_rpc_version = 2;
+}
diff --git a/test/core/tsi/alts/frame_protector/BUILD b/test/core/tsi/alts/frame_protector/BUILD
index 8bbc8c6e5e..dd1966b379 100644
--- a/test/core/tsi/alts/frame_protector/BUILD
+++ b/test/core/tsi/alts/frame_protector/BUILD
@@ -16,13 +16,15 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_p
licenses(["notice"]) # Apache v2
-grpc_package(name = "frame_protector")
+grpc_package(name = "test/core/tsi/alts/frame_protector")
grpc_cc_test(
name = "alts_counter_test",
srcs = ["alts_counter_test.cc"],
language = "C++",
deps = [
+ "//:alts_frame_protector",
+ "//:gpr",
"//:grpc",
"//test/core/tsi/alts/crypt:alts_crypt_test_util",
],
@@ -33,6 +35,8 @@ grpc_cc_test(
srcs = ["alts_crypter_test.cc"],
language = "C++",
deps = [
+ "//:alts_frame_protector",
+ "//:gpr",
"//:grpc",
"//test/core/tsi/alts/crypt:alts_crypt_test_util",
],
@@ -43,7 +47,11 @@ grpc_cc_test(
srcs = ["alts_frame_protector_test.cc"],
language = "C++",
deps = [
+ "//:alts_frame_protector",
+ "//:gpr",
"//:grpc",
+ "//:tsi",
+ "//:tsi_interface",
"//test/core/tsi/alts/crypt:alts_crypt_test_util",
"//test/core/tsi:transport_security_test_lib",
],
@@ -54,6 +62,9 @@ grpc_cc_test(
srcs = ["frame_handler_test.cc"],
language = "C++",
deps = [
+ "//:alts_frame_protector",
+ "//:gpr",
+ "//:gpr_base",
"//:grpc",
"//test/core/tsi/alts/crypt:alts_crypt_test_util",
],
diff --git a/test/core/tsi/alts/handshaker/BUILD b/test/core/tsi/alts/handshaker/BUILD
index db39732c43..809742744c 100644
--- a/test/core/tsi/alts/handshaker/BUILD
+++ b/test/core/tsi/alts/handshaker/BUILD
@@ -16,13 +16,14 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_p
licenses(["notice"]) # Apache v2
-grpc_package(name = "handshaker")
+grpc_package(name = "test/core/tsi/alts/handshaker")
grpc_cc_library(
name = "alts_handshaker_service_api_test_lib",
srcs = ["alts_handshaker_service_api_test_lib.cc"],
hdrs = ["alts_handshaker_service_api_test_lib.h"],
deps = [
+ "//:alts_util",
"//:grpc",
],
)
@@ -33,6 +34,8 @@ grpc_cc_test(
language = "C++",
deps = [
":alts_handshaker_service_api_test_lib",
+ "//:tsi",
+ "//:tsi_interface",
"//:grpc",
],
)
@@ -53,7 +56,10 @@ grpc_cc_test(
language = "C++",
deps = [
":alts_handshaker_service_api_test_lib",
+ "//:gpr",
+ "//:gpr_base",
"//:grpc",
+ "//:tsi",
],
)
@@ -64,6 +70,7 @@ grpc_cc_test(
deps = [
":alts_handshaker_service_api_test_lib",
"//:grpc",
+ "//:tsi",
],
)
@@ -72,6 +79,7 @@ grpc_cc_test(
srcs = ["transport_security_common_api_test.cc"],
language = "C++",
deps = [
+ "//:alts_util",
"//:grpc",
],
)
diff --git a/test/core/tsi/alts/handshaker/alts_handshaker_client_test.cc b/test/core/tsi/alts/handshaker/alts_handshaker_client_test.cc
index 7072be6e3a..c8d88aa72c 100644
--- a/test/core/tsi/alts/handshaker/alts_handshaker_client_test.cc
+++ b/test/core/tsi/alts/handshaker/alts_handshaker_client_test.cc
@@ -54,11 +54,9 @@ static alts_tsi_event* alts_tsi_event_create_for_testing(bool is_client) {
: grpc_alts_credentials_server_options_create();
if (is_client) {
grpc_alts_credentials_client_options_add_target_service_account(
- reinterpret_cast<grpc_alts_credentials_client_options*>(e->options),
- ALTS_HANDSHAKER_CLIENT_TEST_TARGET_SERVICE_ACCOUNT1);
+ e->options, ALTS_HANDSHAKER_CLIENT_TEST_TARGET_SERVICE_ACCOUNT1);
grpc_alts_credentials_client_options_add_target_service_account(
- reinterpret_cast<grpc_alts_credentials_client_options*>(e->options),
- ALTS_HANDSHAKER_CLIENT_TEST_TARGET_SERVICE_ACCOUNT2);
+ e->options, ALTS_HANDSHAKER_CLIENT_TEST_TARGET_SERVICE_ACCOUNT2);
}
grpc_gcp_rpc_protocol_versions* versions = &e->options->rpc_versions;
GPR_ASSERT(grpc_gcp_rpc_protocol_versions_set_max(
@@ -328,6 +326,9 @@ static void schedule_request_invalid_arg_test() {
GPR_ASSERT(alts_handshaker_client_next(nullptr, event, &config->out_frame) ==
TSI_INVALID_ARGUMENT);
+ /* Check shutdown. */
+ alts_handshaker_client_shutdown(nullptr);
+
/* Cleanup. */
alts_tsi_event_destroy(event);
destroy_config(config);
diff --git a/test/core/tsi/alts/handshaker/alts_tsi_handshaker_test.cc b/test/core/tsi/alts/handshaker/alts_tsi_handshaker_test.cc
index 95724f84f4..85a58114ba 100644
--- a/test/core/tsi/alts/handshaker/alts_tsi_handshaker_test.cc
+++ b/test/core/tsi/alts/handshaker/alts_tsi_handshaker_test.cc
@@ -330,6 +330,8 @@ static tsi_result mock_client_start(alts_handshaker_client* self,
return TSI_OK;
}
+static void mock_shutdown(alts_handshaker_client* self) {}
+
static tsi_result mock_server_start(alts_handshaker_client* self,
alts_tsi_event* event,
grpc_slice* bytes_received) {
@@ -400,7 +402,8 @@ static tsi_result mock_next(alts_handshaker_client* self, alts_tsi_event* event,
static void mock_destruct(alts_handshaker_client* client) {}
static const alts_handshaker_client_vtable vtable = {
- mock_client_start, mock_server_start, mock_next, mock_destruct};
+ mock_client_start, mock_server_start, mock_next, mock_shutdown,
+ mock_destruct};
static alts_handshaker_client* alts_mock_handshaker_client_create(
bool used_for_success_test) {
@@ -442,6 +445,16 @@ static void check_handshaker_next_invalid_input() {
tsi_handshaker_destroy(handshaker);
}
+static void check_handshaker_shutdown_invalid_input() {
+ /* Initialization. */
+ tsi_handshaker* handshaker = create_test_handshaker(
+ false /* used_for_success_test */, true /* is_client */);
+ /* Check nullptr handshaker. */
+ tsi_handshaker_shutdown(nullptr);
+ /* Cleanup. */
+ tsi_handshaker_destroy(handshaker);
+}
+
static void check_handshaker_next_success() {
/**
* Create handshakers for which internal mock client is going to do
@@ -480,6 +493,33 @@ static void check_handshaker_next_success() {
tsi_handshaker_destroy(client_handshaker);
}
+static void check_handshaker_next_with_shutdown() {
+ /* Initialization. */
+ tsi_handshaker* handshaker = create_test_handshaker(
+ true /* used_for_success_test */, true /* is_client*/);
+ /* next(success) -- shutdown(success) -- next (fail) */
+ GPR_ASSERT(tsi_handshaker_next(handshaker, nullptr, 0, nullptr, nullptr,
+ nullptr, on_client_start_success_cb,
+ nullptr) == TSI_ASYNC);
+ wait(&tsi_to_caller_notification);
+ tsi_handshaker_shutdown(handshaker);
+ GPR_ASSERT(tsi_handshaker_next(
+ handshaker,
+ (const unsigned char*)ALTS_TSI_HANDSHAKER_TEST_RECV_BYTES,
+ strlen(ALTS_TSI_HANDSHAKER_TEST_RECV_BYTES), nullptr, nullptr,
+ nullptr, on_client_next_success_cb,
+ nullptr) == TSI_HANDSHAKE_SHUTDOWN);
+ /* Cleanup. */
+ tsi_handshaker_destroy(handshaker);
+}
+
+static void check_handle_response_with_shutdown(void* unused) {
+ /* Client start. */
+ wait(&caller_to_tsi_notification);
+ alts_tsi_event_dispatch_to_handshaker(client_start_event, true /* is_ok */);
+ alts_tsi_event_destroy(client_start_event);
+}
+
static void check_handshaker_next_failure() {
/**
* Create handshakers for which internal mock client is always going to fail.
@@ -647,6 +687,49 @@ static void check_handle_response_failure() {
tsi_handshaker_destroy(handshaker);
}
+static void on_shutdown_resp_cb(tsi_result status, void* user_data,
+ const unsigned char* bytes_to_send,
+ size_t bytes_to_send_size,
+ tsi_handshaker_result* result) {
+ GPR_ASSERT(status == TSI_HANDSHAKE_SHUTDOWN);
+ GPR_ASSERT(user_data == nullptr);
+ GPR_ASSERT(bytes_to_send == nullptr);
+ GPR_ASSERT(bytes_to_send_size == 0);
+ GPR_ASSERT(result == nullptr);
+}
+
+static void check_handle_response_after_shutdown() {
+ tsi_handshaker* handshaker = create_test_handshaker(
+ true /* used_for_success_test */, true /* is_client */);
+ alts_tsi_handshaker* alts_handshaker =
+ reinterpret_cast<alts_tsi_handshaker*>(handshaker);
+ /* Tests. */
+ tsi_handshaker_shutdown(handshaker);
+ grpc_byte_buffer* recv_buffer = generate_handshaker_response(CLIENT_START);
+ alts_tsi_handshaker_handle_response(alts_handshaker, recv_buffer,
+ GRPC_STATUS_OK, nullptr,
+ on_shutdown_resp_cb, nullptr, true);
+ grpc_byte_buffer_destroy(recv_buffer);
+ /* Cleanup. */
+ tsi_handshaker_destroy(handshaker);
+}
+
+void check_handshaker_next_fails_after_shutdown() {
+ /* Initialization. */
+ notification_init(&caller_to_tsi_notification);
+ notification_init(&tsi_to_caller_notification);
+ client_start_event = nullptr;
+ /* Tests. */
+ grpc_core::Thread thd("alts_tsi_handshaker_test",
+ &check_handle_response_with_shutdown, nullptr);
+ thd.Start();
+ check_handshaker_next_with_shutdown();
+ thd.Join();
+ /* Cleanup. */
+ notification_destroy(&caller_to_tsi_notification);
+ notification_destroy(&tsi_to_caller_notification);
+}
+
void check_handshaker_success() {
/* Initialization. */
notification_init(&caller_to_tsi_notification);
@@ -672,10 +755,13 @@ int main(int argc, char** argv) {
/* Tests. */
check_handshaker_success();
check_handshaker_next_invalid_input();
+ check_handshaker_shutdown_invalid_input();
+ check_handshaker_next_fails_after_shutdown();
check_handshaker_next_failure();
check_handle_response_invalid_input();
check_handle_response_invalid_resp();
check_handle_response_failure();
+ check_handle_response_after_shutdown();
/* Cleanup. */
grpc_shutdown();
return 0;
diff --git a/test/core/tsi/alts/zero_copy_frame_protector/BUILD b/test/core/tsi/alts/zero_copy_frame_protector/BUILD
index 80f4572d94..2b41dae043 100644
--- a/test/core/tsi/alts/zero_copy_frame_protector/BUILD
+++ b/test/core/tsi/alts/zero_copy_frame_protector/BUILD
@@ -16,14 +16,17 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
licenses(["notice"]) # Apache v2
-grpc_package(name = "zero_copy_frame_protector")
+grpc_package(name = "test/core/tsi/alts/zero_copy_frame_protector")
grpc_cc_test(
name = "alts_grpc_record_protocol_test",
srcs = ["alts_grpc_record_protocol_test.cc"],
language = "C++",
deps = [
+ "//:alts_frame_protector",
+ "//:gpr",
"//:grpc",
+ "//:grpc_base_c",
"//test/core/tsi/alts/crypt:alts_crypt_test_util",
],
)
@@ -33,6 +36,8 @@ grpc_cc_test(
srcs = ["alts_iovec_record_protocol_test.cc"],
language = "C++",
deps = [
+ "//:alts_frame_protector",
+ "//:gpr",
"//:grpc",
"//test/core/tsi/alts/crypt:alts_crypt_test_util",
],
@@ -43,7 +48,10 @@ grpc_cc_test(
srcs = ["alts_zero_copy_grpc_protector_test.cc"],
language = "C++",
deps = [
+ "//:alts_frame_protector",
+ "//:gpr",
"//:grpc",
+ "//:grpc_base_c",
"//test/core/tsi/alts/crypt:alts_crypt_test_util",
],
)
diff --git a/test/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_test.cc b/test/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_test.cc
index fbbea71cb7..b763f19d50 100644
--- a/test/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_test.cc
+++ b/test/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_test.cc
@@ -19,6 +19,7 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h"
#include "src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.h"
diff --git a/test/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector_test.cc b/test/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector_test.cc
index 2388be95cd..32159e22f2 100644
--- a/test/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector_test.cc
+++ b/test/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector_test.cc
@@ -20,6 +20,7 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/tsi/alts/crypt/gsec.h"
#include "src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h"
diff --git a/test/core/tsi/ssl_session_cache_test.cc b/test/core/tsi/ssl_session_cache_test.cc
new file mode 100644
index 0000000000..c86cefb3ff
--- /dev/null
+++ b/test/core/tsi/ssl_session_cache_test.cc
@@ -0,0 +1,153 @@
+/*
+ *
+ * Copyright 2018 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <string>
+#include <unordered_set>
+
+#include "src/core/tsi/ssl/session_cache/ssl_session_cache.h"
+#include "test/core/util/test_config.h"
+
+#include <grpc/grpc.h>
+#include <grpc/support/log.h>
+#include <gtest/gtest.h>
+
+namespace grpc_core {
+
+namespace {
+
+class SessionTracker;
+
+struct SessionExDataId {
+ SessionTracker* tracker;
+ long id;
+};
+
+class SessionTracker {
+ public:
+ SessionTracker() { ssl_context_ = SSL_CTX_new(TLSv1_2_method()); }
+
+ ~SessionTracker() { SSL_CTX_free(ssl_context_); }
+
+ tsi::SslSessionPtr NewSession(long id) {
+ static int ex_data_id = SSL_SESSION_get_ex_new_index(
+ 0, nullptr, nullptr, nullptr, DestroyExData);
+ GPR_ASSERT(ex_data_id != -1);
+ // OpenSSL and different version of BoringSSL don't agree on API
+ // so try both.
+ tsi::SslSessionPtr session = NewSessionInternal(SSL_SESSION_new);
+ SessionExDataId* data = new SessionExDataId{this, id};
+ int result = SSL_SESSION_set_ex_data(session.get(), ex_data_id, data);
+ EXPECT_EQ(result, 1);
+ alive_sessions_.insert(id);
+ return session;
+ }
+
+ bool IsAlive(long id) const {
+ return alive_sessions_.find(id) != alive_sessions_.end();
+ }
+
+ size_t AliveCount() const { return alive_sessions_.size(); }
+
+ private:
+ tsi::SslSessionPtr NewSessionInternal(SSL_SESSION* (*cb)()) {
+ return tsi::SslSessionPtr(cb());
+ }
+
+ tsi::SslSessionPtr NewSessionInternal(SSL_SESSION* (*cb)(const SSL_CTX*)) {
+ return tsi::SslSessionPtr(cb(ssl_context_));
+ }
+
+ static void DestroyExData(void* parent, void* ptr, CRYPTO_EX_DATA* ad,
+ int index, long argl, void* argp) {
+ SessionExDataId* data = static_cast<SessionExDataId*>(ptr);
+ data->tracker->alive_sessions_.erase(data->id);
+ delete data;
+ }
+
+ SSL_CTX* ssl_context_;
+ std::unordered_set<long> alive_sessions_;
+};
+
+TEST(SslSessionCacheTest, InitialState) {
+ SessionTracker tracker;
+ // Verify session initial state.
+ {
+ tsi::SslSessionPtr tmp_sess = tracker.NewSession(1);
+ EXPECT_TRUE(tracker.IsAlive(1));
+ EXPECT_EQ(tracker.AliveCount(), 1);
+ }
+ EXPECT_FALSE(tracker.IsAlive(1));
+ EXPECT_EQ(tracker.AliveCount(), 0);
+}
+
+TEST(SslSessionCacheTest, LruCache) {
+ SessionTracker tracker;
+ {
+ RefCountedPtr<tsi::SslSessionLRUCache> cache =
+ tsi::SslSessionLRUCache::Create(3);
+ tsi::SslSessionPtr sess2 = tracker.NewSession(2);
+ SSL_SESSION* sess2_ptr = sess2.get();
+ cache->Put("first.dropbox.com", std::move(sess2));
+ EXPECT_EQ(cache->Get("first.dropbox.com").get(), sess2_ptr);
+ EXPECT_TRUE(tracker.IsAlive(2));
+ EXPECT_EQ(tracker.AliveCount(), 1);
+ // Putting element with the same key destroys old session.
+ tsi::SslSessionPtr sess3 = tracker.NewSession(3);
+ SSL_SESSION* sess3_ptr = sess3.get();
+ cache->Put("first.dropbox.com", std::move(sess3));
+ EXPECT_FALSE(tracker.IsAlive(2));
+ EXPECT_EQ(cache->Get("first.dropbox.com").get(), sess3_ptr);
+ EXPECT_TRUE(tracker.IsAlive(3));
+ EXPECT_EQ(tracker.AliveCount(), 1);
+ // Putting three more elements discards current one.
+ for (long id = 4; id < 7; id++) {
+ EXPECT_TRUE(tracker.IsAlive(3));
+ std::string domain = std::to_string(id) + ".random.domain";
+ cache->Put(domain.c_str(), tracker.NewSession(id));
+ }
+ EXPECT_EQ(cache->Size(), 3);
+ EXPECT_FALSE(tracker.IsAlive(3));
+ EXPECT_EQ(tracker.AliveCount(), 3);
+ // Accessing element moves it into front of the queue.
+ EXPECT_TRUE(cache->Get("4.random.domain"));
+ EXPECT_TRUE(tracker.IsAlive(4));
+ EXPECT_TRUE(tracker.IsAlive(5));
+ EXPECT_TRUE(tracker.IsAlive(6));
+ // One element has to be evicted from cache->
+ cache->Put("7.random.domain", tracker.NewSession(7));
+ EXPECT_TRUE(tracker.IsAlive(4));
+ EXPECT_FALSE(tracker.IsAlive(5));
+ EXPECT_TRUE(tracker.IsAlive(6));
+ EXPECT_TRUE(tracker.IsAlive(7));
+ EXPECT_EQ(tracker.AliveCount(), 3);
+ }
+ // Cache destructor destroys all sessions.
+ EXPECT_EQ(tracker.AliveCount(), 0);
+}
+
+} // namespace
+} // namespace grpc_core
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ grpc_test_init(argc, argv);
+ grpc_init();
+ int ret = RUN_ALL_TESTS();
+ grpc_shutdown();
+ return ret;
+}
diff --git a/test/core/tsi/ssl_transport_security_test.cc b/test/core/tsi/ssl_transport_security_test.cc
index d9eb7470d5..b477904d60 100644
--- a/test/core/tsi/ssl_transport_security_test.cc
+++ b/test/core/tsi/ssl_transport_security_test.cc
@@ -24,7 +24,6 @@
#include "src/core/lib/security/security_connector/security_connector.h"
#include "src/core/tsi/ssl_transport_security.h"
#include "src/core/tsi/transport_security.h"
-#include "src/core/tsi/transport_security_adapter.h"
#include "src/core/tsi/transport_security_interface.h"
#include "test/core/tsi/transport_security_test_lib.h"
#include "test/core/util/test_config.h"
@@ -34,6 +33,10 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
+extern "C" {
+#include <openssl/crypto.h>
+}
+
#define SSL_TSI_TEST_ALPN1 "foo"
#define SSL_TSI_TEST_ALPN2 "toto"
#define SSL_TSI_TEST_ALPN3 "baz"
@@ -42,6 +45,14 @@
#define SSL_TSI_TEST_BAD_SERVER_KEY_CERT_PAIRS_NUM 1
#define SSL_TSI_TEST_CREDENTIALS_DIR "src/core/tsi/test_creds/"
+// OpenSSL 1.1 uses AES256 for encryption session ticket by default so specify
+// different STEK size.
+#if OPENSSL_VERSION_NUMBER >= 0x10100000 && !defined(OPENSSL_IS_BORINGSSL)
+const size_t kSessionTicketEncryptionKeySize = 80;
+#else
+const size_t kSessionTicketEncryptionKeySize = 48;
+#endif
+
typedef enum AlpnMode {
NO_ALPN,
ALPN_CLIENT_NO_SERVER,
@@ -52,8 +63,8 @@ typedef enum AlpnMode {
typedef struct ssl_alpn_lib {
AlpnMode alpn_mode;
- char** server_alpn_protocols;
- char** client_alpn_protocols;
+ const char** server_alpn_protocols;
+ const char** client_alpn_protocols;
uint16_t num_server_alpn_protocols;
uint16_t num_client_alpn_protocols;
} ssl_alpn_lib;
@@ -61,7 +72,9 @@ typedef struct ssl_alpn_lib {
typedef struct ssl_key_cert_lib {
bool use_bad_server_cert;
bool use_bad_client_cert;
+ bool use_root_store;
char* root_cert;
+ tsi_ssl_root_certs_store* root_store;
tsi_ssl_pem_key_cert_pair* server_pem_key_cert_pairs;
tsi_ssl_pem_key_cert_pair* bad_server_pem_key_cert_pairs;
tsi_ssl_pem_key_cert_pair client_pem_key_cert_pair;
@@ -76,6 +89,10 @@ typedef struct ssl_tsi_test_fixture {
ssl_alpn_lib* alpn_lib;
bool force_client_auth;
char* server_name_indication;
+ tsi_ssl_session_cache* session_cache;
+ bool session_reused;
+ const char* session_ticket_key;
+ size_t session_ticket_key_size;
tsi_ssl_server_handshaker_factory* server_handshaker_factory;
tsi_ssl_client_handshaker_factory* client_handshaker_factory;
} ssl_tsi_test_fixture;
@@ -89,61 +106,70 @@ static void ssl_test_setup_handshakers(tsi_test_fixture* fixture) {
ssl_key_cert_lib* key_cert_lib = ssl_fixture->key_cert_lib;
ssl_alpn_lib* alpn_lib = ssl_fixture->alpn_lib;
/* Create client handshaker factory. */
- tsi_ssl_pem_key_cert_pair* client_key_cert_pair = nullptr;
+ tsi_ssl_client_handshaker_options client_options;
+ memset(&client_options, 0, sizeof(client_options));
+ client_options.pem_root_certs = key_cert_lib->root_cert;
if (ssl_fixture->force_client_auth) {
- client_key_cert_pair = key_cert_lib->use_bad_client_cert
- ? &key_cert_lib->bad_client_pem_key_cert_pair
- : &key_cert_lib->client_pem_key_cert_pair;
+ client_options.pem_key_cert_pair =
+ key_cert_lib->use_bad_client_cert
+ ? &key_cert_lib->bad_client_pem_key_cert_pair
+ : &key_cert_lib->client_pem_key_cert_pair;
}
- char** client_alpn_protocols = nullptr;
- uint16_t num_client_alpn_protocols = 0;
if (alpn_lib->alpn_mode == ALPN_CLIENT_NO_SERVER ||
alpn_lib->alpn_mode == ALPN_CLIENT_SERVER_OK ||
alpn_lib->alpn_mode == ALPN_CLIENT_SERVER_MISMATCH) {
- client_alpn_protocols = alpn_lib->client_alpn_protocols;
- num_client_alpn_protocols = alpn_lib->num_client_alpn_protocols;
+ client_options.alpn_protocols = alpn_lib->client_alpn_protocols;
+ client_options.num_alpn_protocols = alpn_lib->num_client_alpn_protocols;
+ }
+ client_options.root_store =
+ key_cert_lib->use_root_store ? key_cert_lib->root_store : nullptr;
+ if (ssl_fixture->session_cache != nullptr) {
+ client_options.session_cache = ssl_fixture->session_cache;
}
- GPR_ASSERT(tsi_create_ssl_client_handshaker_factory(
- client_key_cert_pair, key_cert_lib->root_cert, nullptr,
- (const char**)client_alpn_protocols, num_client_alpn_protocols,
- &ssl_fixture->client_handshaker_factory) == TSI_OK);
+ GPR_ASSERT(tsi_create_ssl_client_handshaker_factory_with_options(
+ &client_options, &ssl_fixture->client_handshaker_factory) ==
+ TSI_OK);
/* Create server handshaker factory. */
- char** server_alpn_protocols = nullptr;
- uint16_t num_server_alpn_protocols = 0;
+ tsi_ssl_server_handshaker_options server_options;
+ memset(&server_options, 0, sizeof(server_options));
if (alpn_lib->alpn_mode == ALPN_SERVER_NO_CLIENT ||
alpn_lib->alpn_mode == ALPN_CLIENT_SERVER_OK ||
alpn_lib->alpn_mode == ALPN_CLIENT_SERVER_MISMATCH) {
- server_alpn_protocols = alpn_lib->server_alpn_protocols;
- num_server_alpn_protocols = alpn_lib->num_server_alpn_protocols;
+ server_options.alpn_protocols = alpn_lib->server_alpn_protocols;
+ server_options.num_alpn_protocols = alpn_lib->num_server_alpn_protocols;
if (alpn_lib->alpn_mode == ALPN_CLIENT_SERVER_MISMATCH) {
- num_server_alpn_protocols--;
+ server_options.num_alpn_protocols--;
}
}
- GPR_ASSERT(tsi_create_ssl_server_handshaker_factory(
- key_cert_lib->use_bad_server_cert
- ? key_cert_lib->bad_server_pem_key_cert_pairs
- : key_cert_lib->server_pem_key_cert_pairs,
- key_cert_lib->use_bad_server_cert
- ? key_cert_lib->bad_server_num_key_cert_pairs
- : key_cert_lib->server_num_key_cert_pairs,
- key_cert_lib->root_cert, ssl_fixture->force_client_auth,
- nullptr, (const char**)server_alpn_protocols,
- num_server_alpn_protocols,
- &ssl_fixture->server_handshaker_factory) == TSI_OK);
+ server_options.pem_key_cert_pairs =
+ key_cert_lib->use_bad_server_cert
+ ? key_cert_lib->bad_server_pem_key_cert_pairs
+ : key_cert_lib->server_pem_key_cert_pairs;
+ server_options.num_key_cert_pairs =
+ key_cert_lib->use_bad_server_cert
+ ? key_cert_lib->bad_server_num_key_cert_pairs
+ : key_cert_lib->server_num_key_cert_pairs;
+ server_options.pem_client_root_certs = key_cert_lib->root_cert;
+ if (ssl_fixture->force_client_auth) {
+ server_options.client_certificate_request =
+ TSI_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY;
+ } else {
+ server_options.client_certificate_request =
+ TSI_DONT_REQUEST_CLIENT_CERTIFICATE;
+ }
+ server_options.session_ticket_key = ssl_fixture->session_ticket_key;
+ server_options.session_ticket_key_size = ssl_fixture->session_ticket_key_size;
+ GPR_ASSERT(tsi_create_ssl_server_handshaker_factory_with_options(
+ &server_options, &ssl_fixture->server_handshaker_factory) ==
+ TSI_OK);
/* Create server and client handshakers. */
- tsi_handshaker* client_handshaker = nullptr;
GPR_ASSERT(tsi_ssl_client_handshaker_factory_create_handshaker(
ssl_fixture->client_handshaker_factory,
ssl_fixture->server_name_indication,
- &client_handshaker) == TSI_OK);
- ssl_fixture->base.client_handshaker =
- tsi_create_adapter_handshaker(client_handshaker);
- tsi_handshaker* server_handshaker = nullptr;
+ &ssl_fixture->base.client_handshaker) == TSI_OK);
GPR_ASSERT(tsi_ssl_server_handshaker_factory_create_handshaker(
- ssl_fixture->server_handshaker_factory, &server_handshaker) ==
- TSI_OK);
- ssl_fixture->base.server_handshaker =
- tsi_create_adapter_handshaker(server_handshaker);
+ ssl_fixture->server_handshaker_factory,
+ &ssl_fixture->base.server_handshaker) == TSI_OK);
}
static void check_alpn(ssl_tsi_test_fixture* ssl_fixture,
@@ -176,6 +202,18 @@ check_basic_authenticated_peer_and_get_common_name(const tsi_peer* peer) {
return property;
}
+static void check_session_reusage(ssl_tsi_test_fixture* ssl_fixture,
+ tsi_peer* peer) {
+ const tsi_peer_property* session_reused =
+ tsi_peer_get_property_by_name(peer, TSI_SSL_SESSION_REUSED_PEER_PROPERTY);
+ GPR_ASSERT(session_reused != nullptr);
+ if (ssl_fixture->session_reused) {
+ GPR_ASSERT(strcmp(session_reused->value.data, "true") == 0);
+ } else {
+ GPR_ASSERT(strcmp(session_reused->value.data, "false") == 0);
+ }
+}
+
void check_server0_peer(tsi_peer* peer) {
const tsi_peer_property* property =
check_basic_authenticated_peer_and_get_common_name(peer);
@@ -233,7 +271,7 @@ static void check_client_peer(ssl_tsi_test_fixture* ssl_fixture,
ssl_alpn_lib* alpn_lib = ssl_fixture->alpn_lib;
if (!ssl_fixture->force_client_auth) {
GPR_ASSERT(peer->property_count ==
- (alpn_lib->alpn_mode == ALPN_CLIENT_SERVER_OK ? 1 : 0));
+ (alpn_lib->alpn_mode == ALPN_CLIENT_SERVER_OK ? 2 : 1));
} else {
const tsi_peer_property* property =
check_basic_authenticated_peer_and_get_common_name(peer);
@@ -257,8 +295,8 @@ static void ssl_test_check_handshaker_peers(tsi_test_fixture* fixture) {
if (expect_success) {
GPR_ASSERT(tsi_handshaker_result_extract_peer(
ssl_fixture->base.client_result, &peer) == TSI_OK);
+ check_session_reusage(ssl_fixture, &peer);
check_alpn(ssl_fixture, &peer);
-
if (ssl_fixture->server_name_indication != nullptr) {
check_server1_peer(&peer);
} else {
@@ -270,6 +308,7 @@ static void ssl_test_check_handshaker_peers(tsi_test_fixture* fixture) {
if (expect_success) {
GPR_ASSERT(tsi_handshaker_result_extract_peer(
ssl_fixture->base.server_result, &peer) == TSI_OK);
+ check_session_reusage(ssl_fixture, &peer);
check_alpn(ssl_fixture, &peer);
check_client_peer(ssl_fixture, &peer);
} else {
@@ -291,11 +330,11 @@ static void ssl_test_destruct(tsi_test_fixture* fixture) {
/* Destroy ssl_alpn_lib. */
ssl_alpn_lib* alpn_lib = ssl_fixture->alpn_lib;
for (size_t i = 0; i < alpn_lib->num_server_alpn_protocols; i++) {
- gpr_free(alpn_lib->server_alpn_protocols[i]);
+ gpr_free(const_cast<char*>(alpn_lib->server_alpn_protocols[i]));
}
gpr_free(alpn_lib->server_alpn_protocols);
for (size_t i = 0; i < alpn_lib->num_client_alpn_protocols; i++) {
- gpr_free(alpn_lib->client_alpn_protocols[i]);
+ gpr_free(const_cast<char*>(alpn_lib->client_alpn_protocols[i]));
}
gpr_free(alpn_lib->client_alpn_protocols);
gpr_free(alpn_lib);
@@ -315,7 +354,11 @@ static void ssl_test_destruct(tsi_test_fixture* fixture) {
ssl_test_pem_key_cert_pair_destroy(
key_cert_lib->bad_client_pem_key_cert_pair);
gpr_free(key_cert_lib->root_cert);
+ tsi_ssl_root_certs_store_destroy(key_cert_lib->root_store);
gpr_free(key_cert_lib);
+ if (ssl_fixture->session_cache != nullptr) {
+ tsi_ssl_session_cache_unref(ssl_fixture->session_cache);
+ }
/* Unreference others. */
tsi_ssl_server_handshaker_factory_unref(
ssl_fixture->server_handshaker_factory);
@@ -351,6 +394,7 @@ static tsi_test_fixture* ssl_tsi_test_fixture_create() {
static_cast<ssl_key_cert_lib*>(gpr_zalloc(sizeof(*key_cert_lib)));
key_cert_lib->use_bad_server_cert = false;
key_cert_lib->use_bad_client_cert = false;
+ key_cert_lib->use_root_store = false;
key_cert_lib->server_num_key_cert_pairs =
SSL_TSI_TEST_SERVER_KEY_CERT_PAIRS_NUM;
key_cert_lib->bad_server_num_key_cert_pairs =
@@ -384,14 +428,17 @@ static tsi_test_fixture* ssl_tsi_test_fixture_create() {
key_cert_lib->bad_client_pem_key_cert_pair.cert_chain =
load_file(SSL_TSI_TEST_CREDENTIALS_DIR, "badclient.pem");
key_cert_lib->root_cert = load_file(SSL_TSI_TEST_CREDENTIALS_DIR, "ca.pem");
+ key_cert_lib->root_store =
+ tsi_ssl_root_certs_store_create(key_cert_lib->root_cert);
+ GPR_ASSERT(key_cert_lib->root_store != nullptr);
ssl_fixture->key_cert_lib = key_cert_lib;
/* Create ssl_alpn_lib. */
ssl_alpn_lib* alpn_lib =
static_cast<ssl_alpn_lib*>(gpr_zalloc(sizeof(*alpn_lib)));
- alpn_lib->server_alpn_protocols =
- static_cast<char**>(gpr_zalloc(sizeof(char*) * SSL_TSI_TEST_ALPN_NUM));
- alpn_lib->client_alpn_protocols =
- static_cast<char**>(gpr_zalloc(sizeof(char*) * SSL_TSI_TEST_ALPN_NUM));
+ alpn_lib->server_alpn_protocols = static_cast<const char**>(
+ gpr_zalloc(sizeof(char*) * SSL_TSI_TEST_ALPN_NUM));
+ alpn_lib->client_alpn_protocols = static_cast<const char**>(
+ gpr_zalloc(sizeof(char*) * SSL_TSI_TEST_ALPN_NUM));
alpn_lib->server_alpn_protocols[0] = gpr_strdup(SSL_TSI_TEST_ALPN1);
alpn_lib->server_alpn_protocols[1] = gpr_strdup(SSL_TSI_TEST_ALPN3);
alpn_lib->client_alpn_protocols[0] = gpr_strdup(SSL_TSI_TEST_ALPN2);
@@ -402,6 +449,9 @@ static tsi_test_fixture* ssl_tsi_test_fixture_create() {
ssl_fixture->alpn_lib = alpn_lib;
ssl_fixture->base.vtable = &vtable;
ssl_fixture->server_name_indication = nullptr;
+ ssl_fixture->session_reused = false;
+ ssl_fixture->session_ticket_key = nullptr;
+ ssl_fixture->session_ticket_key_size = 0;
ssl_fixture->force_client_auth = false;
return &ssl_fixture->base;
}
@@ -426,6 +476,15 @@ void ssl_tsi_test_do_handshake() {
tsi_test_fixture_destroy(fixture);
}
+void ssl_tsi_test_do_handshake_with_root_store() {
+ tsi_test_fixture* fixture = ssl_tsi_test_fixture_create();
+ ssl_tsi_test_fixture* ssl_fixture =
+ reinterpret_cast<ssl_tsi_test_fixture*>(fixture);
+ ssl_fixture->key_cert_lib->use_root_store = true;
+ tsi_test_do_handshake(fixture);
+ tsi_test_fixture_destroy(fixture);
+}
+
void ssl_tsi_test_do_handshake_with_client_authentication() {
tsi_test_fixture* fixture = ssl_tsi_test_fixture_create();
ssl_tsi_test_fixture* ssl_fixture =
@@ -435,6 +494,16 @@ void ssl_tsi_test_do_handshake_with_client_authentication() {
tsi_test_fixture_destroy(fixture);
}
+void ssl_tsi_test_do_handshake_with_client_authentication_and_root_store() {
+ tsi_test_fixture* fixture = ssl_tsi_test_fixture_create();
+ ssl_tsi_test_fixture* ssl_fixture =
+ reinterpret_cast<ssl_tsi_test_fixture*>(fixture);
+ ssl_fixture->force_client_auth = true;
+ ssl_fixture->key_cert_lib->use_root_store = true;
+ tsi_test_do_handshake(fixture);
+ tsi_test_fixture_destroy(fixture);
+}
+
void ssl_tsi_test_do_handshake_with_server_name_indication_exact_domain() {
/* server1 cert contains "waterzooi.test.google.be" in SAN. */
tsi_test_fixture* fixture = ssl_tsi_test_fixture_create();
@@ -558,6 +627,38 @@ void ssl_tsi_test_do_round_trip_odd_buffer_size() {
}
}
+void ssl_tsi_test_do_handshake_session_cache() {
+ tsi_ssl_session_cache* session_cache = tsi_ssl_session_cache_create_lru(16);
+ char session_ticket_key[kSessionTicketEncryptionKeySize];
+ auto do_handshake = [&session_ticket_key,
+ &session_cache](bool session_reused) {
+ tsi_test_fixture* fixture = ssl_tsi_test_fixture_create();
+ ssl_tsi_test_fixture* ssl_fixture =
+ reinterpret_cast<ssl_tsi_test_fixture*>(fixture);
+ ssl_fixture->server_name_indication =
+ const_cast<char*>("waterzooi.test.google.be");
+ ssl_fixture->session_ticket_key = session_ticket_key;
+ ssl_fixture->session_ticket_key_size = sizeof(session_ticket_key);
+ tsi_ssl_session_cache_ref(session_cache);
+ ssl_fixture->session_cache = session_cache;
+ ssl_fixture->session_reused = session_reused;
+ tsi_test_do_round_trip(&ssl_fixture->base);
+ tsi_test_fixture_destroy(fixture);
+ };
+ memset(session_ticket_key, 'a', sizeof(session_ticket_key));
+ do_handshake(false);
+ do_handshake(true);
+ do_handshake(true);
+ // Changing session_ticket_key on server invalidates ticket.
+ memset(session_ticket_key, 'b', sizeof(session_ticket_key));
+ do_handshake(false);
+ do_handshake(true);
+ memset(session_ticket_key, 'c', sizeof(session_ticket_key));
+ do_handshake(false);
+ do_handshake(true);
+ tsi_ssl_session_cache_unref(session_cache);
+}
+
static const tsi_ssl_handshaker_factory_vtable* original_vtable;
static bool handshaker_factory_destructor_called;
@@ -575,13 +676,14 @@ static tsi_ssl_handshaker_factory_vtable test_handshaker_factory_vtable = {
void test_tsi_ssl_client_handshaker_factory_refcounting() {
int i;
- const char* cert_chain =
- load_file(SSL_TSI_TEST_CREDENTIALS_DIR, "client.pem");
+ char* cert_chain = load_file(SSL_TSI_TEST_CREDENTIALS_DIR, "client.pem");
+ tsi_ssl_client_handshaker_options options;
+ memset(&options, 0, sizeof(options));
+ options.pem_root_certs = cert_chain;
tsi_ssl_client_handshaker_factory* client_handshaker_factory;
- GPR_ASSERT(tsi_create_ssl_client_handshaker_factory(
- nullptr, cert_chain, nullptr, nullptr, 0,
- &client_handshaker_factory) == TSI_OK);
+ GPR_ASSERT(tsi_create_ssl_client_handshaker_factory_with_options(
+ &options, &client_handshaker_factory) == TSI_OK);
handshaker_factory_destructor_called = false;
original_vtable = tsi_ssl_handshaker_factory_swap_vtable(
@@ -608,7 +710,7 @@ void test_tsi_ssl_client_handshaker_factory_refcounting() {
tsi_handshaker_destroy(handshaker[2]);
GPR_ASSERT(handshaker_factory_destructor_called);
- gpr_free((void*)cert_chain);
+ gpr_free(cert_chain);
}
void test_tsi_ssl_server_handshaker_factory_refcounting() {
@@ -658,9 +760,11 @@ void test_tsi_ssl_client_handshaker_factory_bad_params() {
const char* cert_chain = "This is not a valid PEM file.";
tsi_ssl_client_handshaker_factory* client_handshaker_factory;
- GPR_ASSERT(tsi_create_ssl_client_handshaker_factory(
- nullptr, cert_chain, nullptr, nullptr, 0,
- &client_handshaker_factory) == TSI_INVALID_ARGUMENT);
+ tsi_ssl_client_handshaker_options options;
+ memset(&options, 0, sizeof(options));
+ options.pem_root_certs = cert_chain;
+ GPR_ASSERT(tsi_create_ssl_client_handshaker_factory_with_options(
+ &options, &client_handshaker_factory) == TSI_INVALID_ARGUMENT);
tsi_ssl_client_handshaker_factory_unref(client_handshaker_factory);
}
@@ -673,10 +777,13 @@ void ssl_tsi_test_handshaker_factory_internals() {
int main(int argc, char** argv) {
grpc_test_init(argc, argv);
grpc_init();
+
ssl_tsi_test_do_handshake_tiny_handshake_buffer();
ssl_tsi_test_do_handshake_small_handshake_buffer();
ssl_tsi_test_do_handshake();
+ ssl_tsi_test_do_handshake_with_root_store();
ssl_tsi_test_do_handshake_with_client_authentication();
+ ssl_tsi_test_do_handshake_with_client_authentication_and_root_store();
ssl_tsi_test_do_handshake_with_server_name_indication_exact_domain();
ssl_tsi_test_do_handshake_with_server_name_indication_wild_star_domain();
ssl_tsi_test_do_handshake_with_bad_server_cert();
@@ -688,6 +795,7 @@ int main(int argc, char** argv) {
#endif
ssl_tsi_test_do_handshake_alpn_server_no_client();
ssl_tsi_test_do_handshake_alpn_client_server_ok();
+ ssl_tsi_test_do_handshake_session_cache();
ssl_tsi_test_do_round_trip_for_all_configs();
ssl_tsi_test_do_round_trip_odd_buffer_size();
ssl_tsi_test_handshaker_factory_internals();
diff --git a/test/core/util/BUILD b/test/core/util/BUILD
index 886cfddf86..f52570cde5 100644
--- a/test/core/util/BUILD
+++ b/test/core/util/BUILD
@@ -52,6 +52,7 @@ grpc_cc_library(
name = "grpc_test_util_base",
srcs = [
"cmdline.cc",
+ "fuzzer_util.cc",
"grpc_profiler.cc",
"histogram.cc",
"mock_endpoint.cc",
@@ -70,6 +71,7 @@ grpc_cc_library(
],
hdrs = [
"cmdline.h",
+ "fuzzer_util.h",
"grpc_profiler.h",
"histogram.h",
"mock_endpoint.h",
diff --git a/test/core/util/fuzzer_corpus_test.cc b/test/core/util/fuzzer_corpus_test.cc
index 18bc0ad69e..ebf1913137 100644
--- a/test/core/util/fuzzer_corpus_test.cc
+++ b/test/core/util/fuzzer_corpus_test.cc
@@ -20,6 +20,7 @@
#include <dirent.h>
#include <gflags/gflags.h>
+#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <gtest/gtest.h>
#include <stdio.h>
@@ -91,6 +92,7 @@ class ExampleGenerator
perror("Couldn't open the directory");
abort();
}
+ gpr_free(test_srcdir);
}
}
}
diff --git a/test/core/util/fuzzer_util.cc b/test/core/util/fuzzer_util.cc
new file mode 100644
index 0000000000..29c9b8875f
--- /dev/null
+++ b/test/core/util/fuzzer_util.cc
@@ -0,0 +1,82 @@
+/*
+ *
+ * Copyright 2018 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "test/core/util/fuzzer_util.h"
+
+#include <grpc/support/alloc.h>
+
+#include "src/core/lib/gpr/useful.h"
+
+namespace grpc_core {
+namespace testing {
+
+uint8_t grpc_fuzzer_get_next_byte(input_stream* inp) {
+ if (inp->cur == inp->end) {
+ return 0;
+ }
+ return *inp->cur++;
+}
+
+char* grpc_fuzzer_get_next_string(input_stream* inp, bool* special) {
+ char* str = nullptr;
+ size_t cap = 0;
+ size_t sz = 0;
+ char c;
+ do {
+ if (cap == sz) {
+ cap = GPR_MAX(3 * cap / 2, cap + 8);
+ str = static_cast<char*>(gpr_realloc(str, cap));
+ }
+ c = static_cast<char>(grpc_fuzzer_get_next_byte(inp));
+ str[sz++] = c;
+ } while (c != 0 && c != 1);
+ if (special != nullptr) {
+ *special = (c == 1);
+ }
+ if (c == 1) {
+ str[sz - 1] = 0;
+ }
+ return str;
+}
+
+uint32_t grpc_fuzzer_get_next_uint32(input_stream* inp) {
+ uint8_t b = grpc_fuzzer_get_next_byte(inp);
+ uint32_t x = b & 0x7f;
+ if (b & 0x80) {
+ x <<= 7;
+ b = grpc_fuzzer_get_next_byte(inp);
+ x |= b & 0x7f;
+ if (b & 0x80) {
+ x <<= 7;
+ b = grpc_fuzzer_get_next_byte(inp);
+ x |= b & 0x7f;
+ if (b & 0x80) {
+ x <<= 7;
+ b = grpc_fuzzer_get_next_byte(inp);
+ x |= b & 0x7f;
+ if (b & 0x80) {
+ x = (x << 4) | (grpc_fuzzer_get_next_byte(inp) & 0x0f);
+ }
+ }
+ }
+ }
+ return x;
+}
+
+} // namespace testing
+} // namespace grpc_core
diff --git a/test/core/util/fuzzer_util.h b/test/core/util/fuzzer_util.h
new file mode 100644
index 0000000000..0e938399a1
--- /dev/null
+++ b/test/core/util/fuzzer_util.h
@@ -0,0 +1,49 @@
+/*
+ *
+ * Copyright 2018 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef GRPC_TEST_CORE_UTIL_FUZZER_UTIL_H
+#define GRPC_TEST_CORE_UTIL_FUZZER_UTIL_H
+
+#include <stdint.h>
+
+namespace grpc_core {
+
+namespace testing {
+
+// Main struct for input_stream. It allows easy access to input
+// bytes, and allows reading a little past the end(avoiding
+// needing to check everywhere).
+typedef struct {
+ const uint8_t* cur;
+ const uint8_t* end;
+} input_stream;
+
+// get a byte from an input stream.
+uint8_t grpc_fuzzer_get_next_byte(input_stream* inp);
+
+// get a string and boolean values (if special is not null) from an input
+// stream.
+char* grpc_fuzzer_get_next_string(input_stream* inp, bool* special);
+
+// get a uint32 value from an input stream.
+uint32_t grpc_fuzzer_get_next_uint32(input_stream* inp);
+
+} // namespace testing
+} // namespace grpc_core
+
+#endif /* GRPC_TEST_CORE_UTIL_FUZZER_UTIL_H */
diff --git a/test/core/util/grpc_fuzzer.bzl b/test/core/util/grpc_fuzzer.bzl
index cece023fc0..a6a60b0311 100644
--- a/test/core/util/grpc_fuzzer.bzl
+++ b/test/core/util/grpc_fuzzer.bzl
@@ -14,7 +14,7 @@
load("//bazel:grpc_build_system.bzl", "grpc_cc_test")
-def grpc_fuzzer(name, corpus, srcs = [], deps = [], **kwargs):
+def grpc_fuzzer(name, corpus, srcs = [], deps = [], size = "large", timeout = "long", **kwargs):
grpc_cc_test(
name = name,
srcs = srcs,
@@ -23,6 +23,8 @@ def grpc_fuzzer(name, corpus, srcs = [], deps = [], **kwargs):
external_deps = [
'gtest',
],
+ size = size,
+ timeout = timeout,
args = ["--directory=" + native.package_name() + "/" + corpus,],
**kwargs
)
diff --git a/test/core/util/port_isolated_runtime_environment.cc b/test/core/util/port_isolated_runtime_environment.cc
index 5f0585e9fb..ff8342ff4a 100644
--- a/test/core/util/port_isolated_runtime_environment.cc
+++ b/test/core/util/port_isolated_runtime_environment.cc
@@ -19,19 +19,28 @@
/* When running tests on remote machines, the framework takes a round-robin pick
* of a port within certain range. There is no need to recycle ports.
*/
+#include <grpc/support/time.h>
+#include <stdlib.h>
#include "src/core/lib/iomgr/port.h"
#include "test/core/util/test_config.h"
#if defined(GRPC_PORT_ISOLATED_RUNTIME)
#include "test/core/util/port.h"
-#define LOWER_PORT 49152
-static int s_allocated_port = LOWER_PORT;
+#define MIN_PORT 49152
+#define MAX_PORT 65536
+
+int get_random_starting_port() {
+ srand(gpr_now(GPR_CLOCK_REALTIME).tv_nsec);
+ return rand() % (MAX_PORT - MIN_PORT + 1) + MIN_PORT;
+}
+
+static int s_allocated_port = get_random_starting_port();
int grpc_pick_unused_port_or_die(void) {
int allocated_port = s_allocated_port++;
- if (s_allocated_port == 65536) {
- s_allocated_port = LOWER_PORT;
+ if (s_allocated_port == MAX_PORT) {
+ s_allocated_port = MIN_PORT;
}
return allocated_port;
diff --git a/test/core/util/test_config.cc b/test/core/util/test_config.cc
index 53a6297d6e..6a0d444a73 100644
--- a/test/core/util/test_config.cc
+++ b/test/core/util/test_config.cc
@@ -18,6 +18,7 @@
#include "test/core/util/test_config.h"
+#include <inttypes.h>
#include <signal.h>
#include <stdbool.h>
#include <stdio.h>
diff --git a/test/core/util/test_tcp_server.cc b/test/core/util/test_tcp_server.cc
index cb2bc701fa..610a9918ce 100644
--- a/test/core/util/test_tcp_server.cc
+++ b/test/core/util/test_tcp_server.cc
@@ -17,6 +17,7 @@
*/
#include "src/core/lib/iomgr/sockaddr.h"
+#include "src/core/lib/iomgr/socket_utils.h"
#include "test/core/util/test_tcp_server.h"
@@ -54,13 +55,13 @@ void test_tcp_server_init(test_tcp_server* server,
void test_tcp_server_start(test_tcp_server* server, int port) {
grpc_resolved_address resolved_addr;
- struct sockaddr_in* addr =
- reinterpret_cast<struct sockaddr_in*>(resolved_addr.addr);
+ grpc_sockaddr_in* addr =
+ reinterpret_cast<grpc_sockaddr_in*>(resolved_addr.addr);
int port_added;
grpc_core::ExecCtx exec_ctx;
- addr->sin_family = AF_INET;
- addr->sin_port = htons(static_cast<uint16_t>(port));
+ addr->sin_family = GRPC_AF_INET;
+ addr->sin_port = grpc_htons(static_cast<uint16_t>(port));
memset(&addr->sin_addr, 0, sizeof(addr->sin_addr));
grpc_error* error = grpc_tcp_server_create(&server->shutdown_complete,