aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2018-05-31 19:47:30 -0700
committerGravatar Yash Tibrewal <yashkt@google.com>2018-05-31 19:47:30 -0700
commit905f0ca39e5a64d91c4c5d7a09bc0768dabfc454 (patch)
treed682c826d4b74915c49d09f9917ff58609ce21a8 /test
parentadc733f0249eaaabfed5ae9949af1ac416969cef (diff)
parenta421c1539db7fa94a4b1ea1b8b9a0288439ef1b8 (diff)
merge master
Diffstat (limited to 'test')
-rw-r--r--test/core/channel/BUILD16
-rw-r--r--test/core/channel/channel_args_test.cc84
-rw-r--r--test/core/channel/channel_trace_test.cc5
-rw-r--r--test/core/channel/channelz_registry_test.cc121
-rw-r--r--test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc117
-rw-r--r--test/core/client_channel/resolvers/dns_resolver_test.cc7
-rw-r--r--test/core/debug/stats_test.cc5
-rw-r--r--test/core/end2end/end2end_nosec_tests.cc8
-rw-r--r--test/core/end2end/end2end_tests.cc8
-rw-r--r--test/core/end2end/fuzzers/api_fuzzer.cc139
-rw-r--r--test/core/end2end/fuzzers/server_fuzzer.cc26
-rwxr-xr-xtest/core/end2end/gen_build_yaml.py3
-rwxr-xr-xtest/core/end2end/generate_tests.bzl2
-rw-r--r--test/core/end2end/tests/bad_ping.cc5
-rw-r--r--test/core/end2end/tests/retry_non_retriable_status_before_recv_trailing_metadata_started.cc266
-rw-r--r--test/core/end2end/tests/simple_request.cc2
-rw-r--r--test/core/gprpp/BUILD10
-rw-r--r--test/core/gprpp/fork_test.cc139
-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.cc3
-rw-r--r--test/core/http/httpscli_test.cc3
-rw-r--r--test/core/iomgr/resolve_address_posix_test.cc2
-rw-r--r--test/core/iomgr/resolve_address_test.cc2
-rw-r--r--test/core/iomgr/timer_heap_test.cc2
-rw-r--r--test/core/security/BUILD12
-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.cc72
-rw-r--r--test/core/security/security_connector_test.cc51
-rw-r--r--test/core/transport/timeout_encoding_test.cc2
-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/handshaker/alts_handshaker_client_test.cc3
-rw-r--r--test/core/tsi/alts/handshaker/alts_tsi_handshaker_test.cc88
-rw-r--r--test/core/tsi/ssl_session_cache_test.cc1
-rw-r--r--test/core/tsi/ssl_transport_security_test.cc35
-rw-r--r--test/core/util/BUILD2
-rw-r--r--test/core/util/fuzzer_util.cc82
-rw-r--r--test/core/util/fuzzer_util.h49
-rw-r--r--test/core/util/port_isolated_runtime_environment.cc17
-rw-r--r--test/cpp/end2end/client_lb_end2end_test.cc19
-rw-r--r--test/cpp/interop/client.cc2
-rw-r--r--test/cpp/interop/client_helper.cc5
-rw-r--r--test/cpp/interop/http2_client.cc2
-rw-r--r--test/cpp/interop/interop_server.cc24
-rw-r--r--test/cpp/interop/reconnect_interop_client.cc6
-rw-r--r--test/cpp/interop/server_helper.cc3
-rw-r--r--test/cpp/interop/server_helper.h24
-rw-r--r--test/cpp/interop/stress_test.cc10
-rw-r--r--test/cpp/microbenchmarks/BUILD6
-rw-r--r--test/cpp/microbenchmarks/bm_arena.cc16
-rw-r--r--test/cpp/microbenchmarks/bm_call_create.cc14
-rw-r--r--test/cpp/microbenchmarks/bm_chttp2_hpack.cc14
-rw-r--r--test/cpp/microbenchmarks/bm_chttp2_transport.cc16
-rw-r--r--test/cpp/microbenchmarks/bm_closure.cc16
-rw-r--r--test/cpp/microbenchmarks/bm_cq.cc14
-rw-r--r--test/cpp/microbenchmarks/bm_cq_multiple_threads.cc14
-rw-r--r--test/cpp/microbenchmarks/bm_error.cc14
-rw-r--r--test/cpp/microbenchmarks/bm_fullstack_streaming_ping_pong.cc14
-rw-r--r--test/cpp/microbenchmarks/bm_fullstack_streaming_pump.cc14
-rw-r--r--test/cpp/microbenchmarks/bm_fullstack_trickle.cc8
-rw-r--r--test/cpp/microbenchmarks/bm_fullstack_unary_ping_pong.cc14
-rw-r--r--test/cpp/microbenchmarks/bm_metadata.cc14
-rw-r--r--test/cpp/microbenchmarks/bm_pollset.cc16
-rw-r--r--test/cpp/microbenchmarks/helpers.cc14
-rw-r--r--test/cpp/naming/BUILD7
-rw-r--r--test/cpp/naming/README.md43
-rw-r--r--test/cpp/naming/address_sorting_test.cc33
-rwxr-xr-xtest/cpp/naming/gen_build_yaml.py108
-rwxr-xr-xtest/cpp/naming/generate_resolver_component_tests.bzl2
-rwxr-xr-xtest/cpp/naming/private_dns_zone_init.sh215
-rwxr-xr-xtest/cpp/naming/resolver_component_tests_runner.py275
-rwxr-xr-xtest/cpp/naming/resolver_component_tests_runner.sh187
-rw-r--r--test/cpp/naming/resolver_component_tests_runner_invoker.cc2
-rwxr-xr-xtest/cpp/naming/resolver_gce_integration_tests_runner.sh359
-rwxr-xr-xtest/cpp/naming/utils/dns_resolver.py6
-rwxr-xr-xtest/cpp/naming/utils/dns_server.py21
-rwxr-xr-xtest/cpp/naming/utils/tcp_connect.py6
-rw-r--r--test/cpp/qps/BUILD6
-rw-r--r--test/cpp/qps/client.h2
-rw-r--r--test/cpp/qps/client_async.cc2
-rw-r--r--test/cpp/qps/client_sync.cc2
-rw-r--r--test/cpp/qps/driver.cc1
-rwxr-xr-xtest/cpp/qps/gen_build_yaml.py7
-rw-r--r--test/cpp/qps/qps_worker.cc2
-rw-r--r--test/cpp/qps/report.cc2
-rw-r--r--test/cpp/qps/report.h2
-rw-r--r--test/cpp/qps/server_async.cc2
-rw-r--r--test/cpp/qps/server_sync.cc2
-rw-r--r--test/cpp/server/BUILD13
-rw-r--r--[-rwxr-xr-x]test/cpp/server/load_reporter/BUILD (renamed from test/cpp/naming/create_private_dns_zone.sh)26
-rw-r--r--test/cpp/server/load_reporter/load_data_store_test.cc481
-rw-r--r--test/cpp/server/server_builder_with_socket_mutator_test.cc116
-rw-r--r--test/cpp/util/byte_buffer_test.cc7
-rw-r--r--test/cpp/util/create_test_channel.cc26
-rw-r--r--test/cpp/util/create_test_channel.h16
-rw-r--r--test/cpp/util/test_credentials_provider.cc6
-rw-r--r--test/cpp/util/test_credentials_provider.h2
-rw-r--r--test/distrib/csharp/DistribTest/DistribTest.project.json11
-rw-r--r--test/distrib/csharp/DistribTest/DistribTestDotNet.csproj27
-rw-r--r--test/distrib/csharp/DistribTest/project.json22
-rwxr-xr-xtest/distrib/csharp/run_distrib_test.sh5
-rwxr-xr-xtest/distrib/csharp/run_distrib_test_dotnetcli.sh17
-rwxr-xr-xtest/distrib/csharp/update_version.sh2
-rwxr-xr-xtest/distrib/python/test_packages.sh18
317 files changed, 3280 insertions, 1289 deletions
diff --git a/test/core/channel/BUILD b/test/core/channel/BUILD
index 6bf4fcdbb8..c554b20148 100644
--- a/test/core/channel/BUILD
+++ b/test/core/channel/BUILD
@@ -84,6 +84,22 @@ grpc_cc_test(
)
grpc_cc_test(
+ name = "channelz_registry_test",
+ srcs = ["channelz_registry_test.cc"],
+ language = "C++",
+ deps = [
+ "//:gpr",
+ "//:grpc",
+ "//:grpc++",
+ "//test/core/util:gpr_test_util",
+ "//test/core/util:grpc_test_util",
+ ],
+ external_deps = [
+ "gtest",
+ ],
+)
+
+grpc_cc_test(
name = "status_util_test",
srcs = ["status_util_test.cc"],
language = "C++",
diff --git a/test/core/channel/channel_args_test.cc b/test/core/channel/channel_args_test.cc
index 57ff7370ad..41c62a8f16 100644
--- a/test/core/channel/channel_args_test.cc
+++ b/test/core/channel/channel_args_test.cc
@@ -148,6 +148,88 @@ static void test_set_socket_mutator(void) {
}
}
+struct fake_class {
+ int foo;
+};
+
+static void* fake_pointer_arg_copy(void* arg) {
+ gpr_log(GPR_DEBUG, "fake_pointer_arg_copy");
+ fake_class* fc = static_cast<fake_class*>(arg);
+ fake_class* new_fc = static_cast<fake_class*>(gpr_malloc(sizeof(fake_class)));
+ new_fc->foo = fc->foo;
+ return new_fc;
+}
+
+static void fake_pointer_arg_destroy(void* arg) {
+ gpr_log(GPR_DEBUG, "fake_pointer_arg_destroy");
+ fake_class* fc = static_cast<fake_class*>(arg);
+ gpr_free(fc);
+}
+
+static int fake_pointer_cmp(void* a, void* b) { return GPR_ICMP(a, b); }
+
+static const grpc_arg_pointer_vtable fake_pointer_arg_vtable = {
+ fake_pointer_arg_copy, fake_pointer_arg_destroy, fake_pointer_cmp};
+
+static void test_channel_create_with_args(void) {
+ grpc_arg client_a[3];
+
+ // adds integer arg
+ client_a[0].type = GRPC_ARG_INTEGER;
+ client_a[0].key = const_cast<char*>("arg_int");
+ client_a[0].value.integer = 0;
+
+ // adds const str arg
+ client_a[1].type = GRPC_ARG_STRING;
+ client_a[1].key = const_cast<char*>("arg_str");
+ client_a[1].value.string = const_cast<char*>("arg_str_val");
+
+ // allocated and adds custom pointer arg
+ fake_class* fc = static_cast<fake_class*>(gpr_malloc(sizeof(fake_class)));
+ fc->foo = 42;
+ client_a[2].type = GRPC_ARG_POINTER;
+ client_a[2].key = const_cast<char*>("arg_pointer");
+ client_a[2].value.pointer.vtable = &fake_pointer_arg_vtable;
+ client_a[2].value.pointer.p = fc;
+
+ // creates channel
+ grpc_channel_args client_args = {GPR_ARRAY_SIZE(client_a), client_a};
+ grpc_channel* c =
+ grpc_insecure_channel_create("fake_target", &client_args, nullptr);
+ // user is can free the memory they allocated here
+ gpr_free(fc);
+ grpc_channel_destroy(c);
+}
+
+static void test_server_create_with_args(void) {
+ grpc_arg server_a[3];
+
+ // adds integer arg
+ server_a[0].type = GRPC_ARG_INTEGER;
+ server_a[0].key = const_cast<char*>("arg_int");
+ server_a[0].value.integer = 0;
+
+ // adds const str arg
+ server_a[1].type = GRPC_ARG_STRING;
+ server_a[1].key = const_cast<char*>("arg_str");
+ server_a[1].value.string = const_cast<char*>("arg_str_val");
+
+ // allocated and adds custom pointer arg
+ fake_class* fc = static_cast<fake_class*>(gpr_malloc(sizeof(fake_class)));
+ fc->foo = 42;
+ server_a[2].type = GRPC_ARG_POINTER;
+ server_a[2].key = const_cast<char*>("arg_pointer");
+ server_a[2].value.pointer.vtable = &fake_pointer_arg_vtable;
+ server_a[2].value.pointer.p = fc;
+
+ // creates server
+ grpc_channel_args server_args = {GPR_ARRAY_SIZE(server_a), server_a};
+ grpc_server* s = grpc_server_create(&server_args, nullptr);
+ // user is can free the memory they allocated here
+ gpr_free(fc);
+ grpc_server_destroy(s);
+}
+
int main(int argc, char** argv) {
grpc_test_init(argc, argv);
grpc_init();
@@ -155,6 +237,8 @@ int main(int argc, char** argv) {
test_set_compression_algorithm();
test_compression_algorithm_states();
test_set_socket_mutator();
+ test_channel_create_with_args();
+ test_server_create_with_args();
grpc_shutdown();
return 0;
}
diff --git a/test/core/channel/channel_trace_test.cc b/test/core/channel/channel_trace_test.cc
index 3c73e33612..64de05bc0a 100644
--- a/test/core/channel/channel_trace_test.cc
+++ b/test/core/channel/channel_trace_test.cc
@@ -25,7 +25,7 @@
#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/channel/channelz_registry.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/json/json.h"
@@ -99,8 +99,7 @@ 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);
+ ChannelTrace* uuid_lookup = ChannelzRegistry::Get<ChannelTrace>(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);
diff --git a/test/core/channel/channelz_registry_test.cc b/test/core/channel/channelz_registry_test.cc
new file mode 100644
index 0000000000..37696dc0e8
--- /dev/null
+++ b/test/core/channel/channelz_registry_test.cc
@@ -0,0 +1,121 @@
+/*
+ *
+ * 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/channelz_registry.h"
+#include "src/core/lib/gpr/useful.h"
+#include "src/core/lib/gprpp/memory.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
+#include "src/core/lib/json/json.h"
+
+#include "test/core/util/test_config.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+namespace grpc_core {
+namespace testing {
+
+// Tests basic ChannelTrace functionality like construction, adding trace, and
+// lookups by uuid.
+TEST(ChannelzRegistryTest, UuidStartsAboveZeroTest) {
+ int object_to_register;
+ intptr_t uuid = ChannelzRegistry::Register(&object_to_register);
+ EXPECT_GT(uuid, 0) << "First uuid chose must be greater than zero. Zero if "
+ "reserved according to "
+ "https://github.com/grpc/proposal/blob/master/"
+ "A14-channelz.md";
+ ChannelzRegistry::Unregister(uuid);
+}
+
+TEST(ChannelzRegistryTest, UuidsAreIncreasing) {
+ int object_to_register;
+ std::vector<intptr_t> uuids;
+ for (int i = 0; i < 10; ++i) {
+ // reregister the same object. It's ok since we are just testing uuids
+ uuids.push_back(ChannelzRegistry::Register(&object_to_register));
+ }
+ for (size_t i = 1; i < uuids.size(); ++i) {
+ EXPECT_LT(uuids[i - 1], uuids[i]) << "Uuids must always be increasing";
+ }
+}
+
+TEST(ChannelzRegistryTest, RegisterGetTest) {
+ int object_to_register = 42;
+ intptr_t uuid = ChannelzRegistry::Register(&object_to_register);
+ int* retrieved = ChannelzRegistry::Get<int>(uuid);
+ EXPECT_EQ(&object_to_register, retrieved);
+}
+
+TEST(ChannelzRegistryTest, MultipleTypeTest) {
+ int int_to_register = 42;
+ intptr_t int_uuid = ChannelzRegistry::Register(&int_to_register);
+ std::string str_to_register = "hello world";
+ intptr_t str_uuid = ChannelzRegistry::Register(&str_to_register);
+ int* retrieved_int = ChannelzRegistry::Get<int>(int_uuid);
+ std::string* retrieved_str = ChannelzRegistry::Get<std::string>(str_uuid);
+ EXPECT_EQ(&int_to_register, retrieved_int);
+ EXPECT_EQ(&str_to_register, retrieved_str);
+}
+
+namespace {
+class Foo {
+ public:
+ int bar;
+};
+} // namespace
+
+TEST(ChannelzRegistryTest, CustomObjectTest) {
+ Foo* foo = New<Foo>();
+ foo->bar = 1024;
+ intptr_t uuid = ChannelzRegistry::Register(foo);
+ Foo* retrieved = ChannelzRegistry::Get<Foo>(uuid);
+ EXPECT_EQ(foo, retrieved);
+ Delete(foo);
+}
+
+TEST(ChannelzRegistryTest, NullIfNotPresentTest) {
+ int object_to_register = 42;
+ intptr_t uuid = ChannelzRegistry::Register(&object_to_register);
+ // try to pull out a uuid that does not exist.
+ int* nonexistant = ChannelzRegistry::Get<int>(uuid + 1);
+ EXPECT_EQ(nonexistant, nullptr);
+ int* retrieved = ChannelzRegistry::Get<int>(uuid);
+ EXPECT_EQ(object_to_register, *retrieved);
+ EXPECT_EQ(&object_to_register, retrieved);
+}
+
+} // 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/client_channel/resolvers/dns_resolver_cooldown_test.cc b/test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc
index 01c61a9f18..521fc3107e 100644
--- a/test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc
+++ b/test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc
@@ -128,7 +128,7 @@ static void poll_pollset_until_request_done(iomgr_args* args) {
break;
}
grpc_millis time_left = deadline - grpc_core::ExecCtx::Get()->Now();
- gpr_log(GPR_DEBUG, "done=%d, time_left=%" PRIdPTR, done, time_left);
+ gpr_log(GPR_DEBUG, "done=%d, time_left=%" PRId64, done, time_left);
GPR_ASSERT(time_left >= 0);
grpc_pollset_worker* worker = nullptr;
gpr_mu_lock(args->mu);
@@ -145,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
@@ -155,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) {
@@ -269,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) {
@@ -293,16 +308,12 @@ int main(int argc, char** argv) {
g_combiner = grpc_combiner_create();
- bool using_cares = false;
-#if GRPC_ARES == 1
- using_cares = true;
-#endif
g_default_dns_lookup_ares = grpc_dns_lookup_ares;
grpc_dns_lookup_ares = test_dns_lookup_ares;
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/debug/stats_test.cc b/test/core/debug/stats_test.cc
index 949a88f8f0..aeb13655bf 100644
--- a/test/core/debug/stats_test.cc
+++ b/test/core/debug/stats_test.cc
@@ -142,9 +142,14 @@ INSTANTIATE_TEST_CASE_P(HistogramTestCases, HistogramTest,
} // namespace grpc
int main(int argc, char** argv) {
+/* Only run this test if GRPC_COLLECT_STATS is defined or if it is a debug
+ * build.
+ */
+#if defined(GRPC_COLLECT_STATS) || !defined(NDEBUG)
::testing::InitGoogleTest(&argc, argv);
grpc_init();
int ret = RUN_ALL_TESTS();
grpc_shutdown();
return ret;
+#endif
}
diff --git a/test/core/end2end/end2end_nosec_tests.cc b/test/core/end2end/end2end_nosec_tests.cc
index 297408cd92..59eb643a93 100644
--- a/test/core/end2end/end2end_nosec_tests.cc
+++ b/test/core/end2end/end2end_nosec_tests.cc
@@ -132,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);
@@ -236,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();
@@ -320,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);
@@ -552,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 9b3f655254..9f164b4ead 100644
--- a/test/core/end2end/end2end_tests.cc
+++ b/test/core/end2end/end2end_tests.cc
@@ -134,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);
@@ -239,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();
@@ -324,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);
@@ -560,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/fuzzers/api_fuzzer.cc b/test/core/end2end/fuzzers/api_fuzzer.cc
index 9ace7d04aa..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;
@@ -673,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)));
@@ -681,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);
}
@@ -811,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);
@@ -838,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);
@@ -927,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 {
@@ -946,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,
@@ -971,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;
@@ -979,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);
@@ -1005,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;
@@ -1019,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;
@@ -1060,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));
@@ -1097,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);
@@ -1160,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;
@@ -1209,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/server_fuzzer.cc b/test/core/end2end/fuzzers/server_fuzzer.cc
index 5eb83ede7a..248c34cbc1 100644
--- a/test/core/end2end/fuzzers/server_fuzzer.cc
+++ b/test/core/end2end/fuzzers/server_fuzzer.cc
@@ -103,15 +103,33 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_metadata_array_destroy(&request_metadata1);
grpc_server_shutdown_and_notify(server, cq, tag(0xdead));
grpc_server_cancel_all_calls(server);
+ grpc_millis deadline = grpc_core::ExecCtx::Get()->Now() + 5000;
for (int i = 0; i <= requested_calls; i++) {
- ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME),
- nullptr);
+ // A single grpc_completion_queue_next might not be sufficient for getting
+ // the tag from shutdown, because we might potentially get blocked by
+ // an operation happening on the timer thread.
+ // For example, the deadline timer might expire, leading to the timer
+ // thread trying to cancel the RPC and thereby acquiring a few references
+ // to the call. This will prevent the shutdown to complete till the timer
+ // thread releases those references.
+ // As a solution, we are going to keep performing a cq_next for a
+ // liberal period of 5 seconds for the timer thread to complete its work.
+ do {
+ ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME),
+ nullptr);
+ grpc_core::ExecCtx::Get()->InvalidateNow();
+ } while (ev.type != GRPC_OP_COMPLETE &&
+ grpc_core::ExecCtx::Get()->Now() < deadline);
GPR_ASSERT(ev.type == GRPC_OP_COMPLETE);
}
grpc_completion_queue_shutdown(cq);
for (int i = 0; i <= requested_calls; i++) {
- ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME),
- nullptr);
+ do {
+ ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME),
+ nullptr);
+ grpc_core::ExecCtx::Get()->InvalidateNow();
+ } while (ev.type != GRPC_QUEUE_SHUTDOWN &&
+ grpc_core::ExecCtx::Get()->Now() < deadline);
GPR_ASSERT(ev.type == GRPC_QUEUE_SHUTDOWN);
}
grpc_server_destroy(server);
diff --git a/test/core/end2end/gen_build_yaml.py b/test/core/end2end/gen_build_yaml.py
index c7b0362574..c355fc24b5 100755
--- a/test/core/end2end/gen_build_yaml.py
+++ b/test/core/end2end/gen_build_yaml.py
@@ -170,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 37fd1837f4..11fc576165 100755
--- a/test/core/end2end/generate_tests.bzl
+++ b/test/core/end2end/generate_tests.bzl
@@ -158,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/tests/bad_ping.cc b/test/core/end2end/tests/bad_ping.cc
index 22481d1be7..98d893f64d 100644
--- a/test/core/end2end/tests/bad_ping.cc
+++ b/test/core/end2end/tests/bad_ping.cc
@@ -355,6 +355,11 @@ static void test_pings_without_data(grpc_end2end_test_config config) {
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);
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/simple_request.cc b/test/core/end2end/tests/simple_request.cc
index 2d6ccad0ec..941d9ae319 100644
--- a/test/core/end2end/tests/simple_request.cc
+++ b/test/core/end2end/tests/simple_request.cc
@@ -235,12 +235,14 @@ static void simple_request_body(grpc_end2end_test_config config,
if (config.feature_mask & FEATURE_MASK_SUPPORTS_REQUEST_PROXYING) {
expected_calls *= 2;
}
+#if defined(GRPC_COLLECT_STATS) || !defined(NDEBUG)
GPR_ASSERT(after->counters[GRPC_STATS_COUNTER_CLIENT_CALLS_CREATED] -
before->counters[GRPC_STATS_COUNTER_CLIENT_CALLS_CREATED] ==
expected_calls);
GPR_ASSERT(after->counters[GRPC_STATS_COUNTER_SERVER_CALLS_CREATED] -
before->counters[GRPC_STATS_COUNTER_SERVER_CALLS_CREATED] ==
expected_calls);
+#endif /* defined(GRPC_COLLECT_STATS) || !defined(NDEBUG) */
gpr_free(before);
gpr_free(after);
}
diff --git a/test/core/gprpp/BUILD b/test/core/gprpp/BUILD
index a8a5739552..e7232d9df8 100644
--- a/test/core/gprpp/BUILD
+++ b/test/core/gprpp/BUILD
@@ -19,6 +19,16 @@ licenses(["notice"]) # Apache v2
grpc_package(name = "test/core/gprpp")
grpc_cc_test(
+ name = "fork_test",
+ srcs = ["fork_test.cc"],
+ language = "C++",
+ deps = [
+ "//:gpr",
+ "//test/core/util:gpr_test_util",
+ ],
+)
+
+grpc_cc_test(
name = "manual_constructor_test",
srcs = ["manual_constructor_test.cc"],
language = "C++",
diff --git a/test/core/gprpp/fork_test.cc b/test/core/gprpp/fork_test.cc
new file mode 100644
index 0000000000..642f910489
--- /dev/null
+++ b/test/core/gprpp/fork_test.cc
@@ -0,0 +1,139 @@
+/*
+ *
+ * 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 "src/core/lib/gprpp/fork.h"
+
+#include "src/core/lib/gprpp/thd.h"
+#include "test/core/util/test_config.h"
+
+static void test_init() {
+ GPR_ASSERT(!grpc_core::Fork::Enabled());
+
+ // Default fork support (disabled)
+ grpc_core::Fork::GlobalInit();
+ GPR_ASSERT(!grpc_core::Fork::Enabled());
+ grpc_core::Fork::GlobalShutdown();
+
+ // Explicitly disabled fork support
+ grpc_core::Fork::Enable(false);
+ grpc_core::Fork::GlobalInit();
+ GPR_ASSERT(!grpc_core::Fork::Enabled());
+ grpc_core::Fork::GlobalShutdown();
+
+ // Explicitly enabled fork support
+ grpc_core::Fork::Enable(true);
+ grpc_core::Fork::GlobalInit();
+ GPR_ASSERT(grpc_core::Fork::Enabled());
+ grpc_core::Fork::GlobalShutdown();
+}
+
+// This spawns CONCURRENT_TEST_THREADS that last up to
+// THREAD_DELAY_MS, and checks that the Fork::AwaitThreads()
+// returns roughly after THREAD_DELAY_MS. The epsilon is high
+// because tsan threads can take a while to spawn/join.
+#define THREAD_DELAY_MS 6000
+#define THREAD_DELAY_EPSILON 1500
+#define CONCURRENT_TEST_THREADS 100
+
+static void sleeping_thd(void* arg) {
+ int64_t sleep_ms = (int64_t)arg;
+ gpr_sleep_until(gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
+ gpr_time_from_millis(sleep_ms, GPR_TIMESPAN)));
+}
+
+static void test_thd_count() {
+ // Test no active threads
+ grpc_core::Fork::Enable(true);
+ grpc_core::Fork::GlobalInit();
+ grpc_core::Fork::AwaitThreads();
+ grpc_core::Fork::GlobalShutdown();
+
+ grpc_core::Fork::Enable(true);
+ grpc_core::Fork::GlobalInit();
+ grpc_core::Thread thds[CONCURRENT_TEST_THREADS];
+ gpr_timespec est_end_time =
+ gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
+ gpr_time_from_millis(THREAD_DELAY_MS, GPR_TIMESPAN));
+ gpr_timespec tolerance =
+ gpr_time_from_millis(THREAD_DELAY_EPSILON, GPR_TIMESPAN);
+ for (int i = 0; i < CONCURRENT_TEST_THREADS; i++) {
+ intptr_t sleep_time_ms =
+ (i * THREAD_DELAY_MS) / (CONCURRENT_TEST_THREADS - 1);
+ thds[i] =
+ grpc_core::Thread("grpc_fork_test", sleeping_thd, (void*)sleep_time_ms);
+ thds[i].Start();
+ }
+ grpc_core::Fork::AwaitThreads();
+ gpr_timespec end_time = gpr_now(GPR_CLOCK_REALTIME);
+ for (auto& thd : thds) {
+ thd.Join();
+ }
+ GPR_ASSERT(gpr_time_similar(end_time, est_end_time, tolerance));
+ grpc_core::Fork::GlobalShutdown();
+}
+
+static void exec_ctx_thread(void* arg) {
+ bool* exec_ctx_created = (bool*)arg;
+ grpc_core::Fork::IncExecCtxCount();
+ *exec_ctx_created = true;
+}
+
+static void test_exec_count() {
+ grpc_core::Fork::Enable(true);
+ grpc_core::Fork::GlobalInit();
+
+ grpc_core::Fork::IncExecCtxCount();
+ GPR_ASSERT(grpc_core::Fork::BlockExecCtx());
+ grpc_core::Fork::DecExecCtxCount();
+ grpc_core::Fork::AllowExecCtx();
+
+ grpc_core::Fork::IncExecCtxCount();
+ grpc_core::Fork::IncExecCtxCount();
+ GPR_ASSERT(!grpc_core::Fork::BlockExecCtx());
+ grpc_core::Fork::DecExecCtxCount();
+ grpc_core::Fork::DecExecCtxCount();
+
+ grpc_core::Fork::IncExecCtxCount();
+ GPR_ASSERT(grpc_core::Fork::BlockExecCtx());
+ grpc_core::Fork::DecExecCtxCount();
+ grpc_core::Fork::AllowExecCtx();
+
+ // Test that block_exec_ctx() blocks grpc_core::Fork::IncExecCtxCount
+ bool exec_ctx_created = false;
+ grpc_core::Thread thd =
+ grpc_core::Thread("grpc_fork_test", exec_ctx_thread, &exec_ctx_created);
+ grpc_core::Fork::IncExecCtxCount();
+ GPR_ASSERT(grpc_core::Fork::BlockExecCtx());
+ grpc_core::Fork::DecExecCtxCount();
+ thd.Start();
+ gpr_sleep_until(gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
+ gpr_time_from_seconds(1, GPR_TIMESPAN)));
+ GPR_ASSERT(!exec_ctx_created);
+ grpc_core::Fork::AllowExecCtx();
+ thd.Join(); // This ensure that the call got un-blocked
+ grpc_core::Fork::GlobalShutdown();
+}
+
+int main(int argc, char* argv[]) {
+ grpc_test_init(argc, argv);
+ test_init();
+ test_thd_count();
+ test_exec_count();
+
+ return 0;
+}
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 16448d9e14..a51a0a5f6d 100644
--- a/test/core/http/httpcli_test.cc
+++ b/test/core/http/httpcli_test.cc
@@ -47,7 +47,8 @@ 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_log(GPR_INFO, "response status=%d error=%s", response->status,
+ grpc_error_string(error));
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 b8f2e438a4..3fecf2b08b 100644
--- a/test/core/http/httpscli_test.cc
+++ b/test/core/http/httpscli_test.cc
@@ -49,7 +49,8 @@ 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_log(GPR_INFO, "response status=%d error=%s", response->status,
+ grpc_error_string(error));
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/resolve_address_posix_test.cc b/test/core/iomgr/resolve_address_posix_test.cc
index 79b2b50e70..e495e4c877 100644
--- a/test/core/iomgr/resolve_address_posix_test.cc
+++ b/test/core/iomgr/resolve_address_posix_test.cc
@@ -91,7 +91,7 @@ static void actually_poll(void* argsp) {
break;
}
grpc_millis time_left = deadline - grpc_core::ExecCtx::Get()->Now();
- gpr_log(GPR_DEBUG, "done=%d, time_left=%" PRIdPTR, done, time_left);
+ gpr_log(GPR_DEBUG, "done=%d, time_left=%" PRId64, done, time_left);
GPR_ASSERT(time_left >= 0);
grpc_pollset_worker* worker = nullptr;
gpr_mu_lock(args->mu);
diff --git a/test/core/iomgr/resolve_address_test.cc b/test/core/iomgr/resolve_address_test.cc
index a0dc484f3e..2fb831a6a4 100644
--- a/test/core/iomgr/resolve_address_test.cc
+++ b/test/core/iomgr/resolve_address_test.cc
@@ -82,7 +82,7 @@ static void poll_pollset_until_request_done(args_struct* args) {
break;
}
grpc_millis time_left = deadline - grpc_core::ExecCtx::Get()->Now();
- gpr_log(GPR_DEBUG, "done=%d, time_left=%" PRIdPTR, done, time_left);
+ gpr_log(GPR_DEBUG, "done=%d, time_left=%" PRId64, done, time_left);
GPR_ASSERT(time_left >= 0);
grpc_pollset_worker* worker = nullptr;
gpr_mu_lock(args->mu);
diff --git a/test/core/iomgr/timer_heap_test.cc b/test/core/iomgr/timer_heap_test.cc
index ebe5e32f3a..ebe5e6610d 100644
--- a/test/core/iomgr/timer_heap_test.cc
+++ b/test/core/iomgr/timer_heap_test.cc
@@ -204,7 +204,7 @@ static void test2(void) {
}
if (num_inserted) {
- gpr_atm* min_deadline = nullptr;
+ grpc_millis* min_deadline = nullptr;
for (size_t i = 0; i < elems_size; i++) {
if (elems[i].inserted) {
if (min_deadline == nullptr) {
diff --git a/test/core/security/BUILD b/test/core/security/BUILD
index 9db73b9123..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++",
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 @@
+=ļyyyyyyyyyz \ 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..8a793e4bb2 100644
--- a/test/core/security/credentials_test.cc
+++ b/test/core/security/credentials_test.cc
@@ -43,6 +43,8 @@
#include "src/core/lib/security/transport/auth_filters.h"
#include "test/core/util/test_config.h"
+using grpc_core::internal::set_gce_tenancy_checker_for_testing;
+
/* -- Mock channel credentials. -- */
static grpc_channel_credentials* grpc_mock_channel_credentials_create(
@@ -120,6 +122,12 @@ static const char other_test_service_url[] = "https://bar.com/bar.v1";
static const char test_method[] = "ThisIsNotAMethod";
+/* -- Global state flags. -- */
+
+static bool g_test_is_on_gce = false;
+
+static bool g_test_gce_tenancy_checker_called = false;
+
/* -- Utils. -- */
static char* test_json_key_str(void) {
@@ -867,6 +875,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 +884,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 +900,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,
@@ -904,24 +918,13 @@ static void test_google_default_creds_refresh_token(void) {
gpr_setenv(GRPC_GOOGLE_CREDENTIALS_ENV_VAR, ""); /* Reset. */
}
-static int default_creds_gce_detection_httpcli_get_success_override(
- const grpc_httpcli_request* request, grpc_millis deadline,
- grpc_closure* on_done, grpc_httpcli_response* response) {
- *response = http_response(200, "");
- grpc_http_header* headers =
- static_cast<grpc_http_header*>(gpr_malloc(sizeof(*headers) * 1));
- headers[0].key = gpr_strdup("Metadata-Flavor");
- headers[0].value = gpr_strdup("Google");
- response->hdr_count = 1;
- response->hdrs = headers;
- GPR_ASSERT(strcmp(request->http.path, "/") == 0);
- GPR_ASSERT(strcmp(request->host, "metadata.google.internal") == 0);
- GRPC_CLOSURE_SCHED(on_done, GRPC_ERROR_NONE);
- return 1;
-}
-
static char* null_well_known_creds_path_getter(void) { return nullptr; }
+static bool test_gce_tenancy_checker(void) {
+ g_test_gce_tenancy_checker_called = true;
+ return g_test_is_on_gce;
+}
+
static void test_google_default_creds_gce(void) {
grpc_core::ExecCtx exec_ctx;
expected_md emd[] = {
@@ -934,11 +937,11 @@ static void test_google_default_creds_gce(void) {
gpr_setenv(GRPC_GOOGLE_CREDENTIALS_ENV_VAR, ""); /* Reset. */
grpc_override_well_known_credentials_path_getter(
null_well_known_creds_path_getter);
+ set_gce_tenancy_checker_for_testing(test_gce_tenancy_checker);
+ g_test_gce_tenancy_checker_called = false;
+ g_test_is_on_gce = true;
/* Simulate a successful detection of GCE. */
- grpc_httpcli_set_override(
- default_creds_gce_detection_httpcli_get_success_override,
- httpcli_post_should_not_be_called);
grpc_composite_channel_credentials* creds =
reinterpret_cast<grpc_composite_channel_credentials*>(
grpc_google_default_credentials_create());
@@ -954,11 +957,11 @@ static void test_google_default_creds_gce(void) {
/* Check that we get a cached creds if we call
grpc_google_default_credentials_create again.
GCE detection should not occur anymore either. */
- grpc_httpcli_set_override(httpcli_get_should_not_be_called,
- httpcli_post_should_not_be_called);
+ g_test_gce_tenancy_checker_called = false;
grpc_channel_credentials* cached_creds =
grpc_google_default_credentials_create();
GPR_ASSERT(cached_creds == &creds->base);
+ GPR_ASSERT(g_test_gce_tenancy_checker_called == false);
/* Cleanup. */
grpc_channel_credentials_unref(cached_creds);
@@ -967,36 +970,25 @@ static void test_google_default_creds_gce(void) {
grpc_override_well_known_credentials_path_getter(nullptr);
}
-static int default_creds_gce_detection_httpcli_get_failure_override(
- const grpc_httpcli_request* request, grpc_millis deadline,
- grpc_closure* on_done, grpc_httpcli_response* response) {
- /* No magic header. */
- GPR_ASSERT(strcmp(request->http.path, "/") == 0);
- GPR_ASSERT(strcmp(request->host, "metadata.google.internal") == 0);
- *response = http_response(200, "");
- GRPC_CLOSURE_SCHED(on_done, GRPC_ERROR_NONE);
- return 1;
-}
-
static void test_no_google_default_creds(void) {
grpc_flush_cached_google_default_credentials();
gpr_setenv(GRPC_GOOGLE_CREDENTIALS_ENV_VAR, ""); /* Reset. */
grpc_override_well_known_credentials_path_getter(
null_well_known_creds_path_getter);
+ set_gce_tenancy_checker_for_testing(test_gce_tenancy_checker);
+ g_test_gce_tenancy_checker_called = false;
+ g_test_is_on_gce = false;
+
/* Simulate a successful detection of GCE. */
- grpc_httpcli_set_override(
- default_creds_gce_detection_httpcli_get_failure_override,
- httpcli_post_should_not_be_called);
GPR_ASSERT(grpc_google_default_credentials_create() == nullptr);
/* Try a cached one. GCE detection should not occur anymore. */
- grpc_httpcli_set_override(httpcli_get_should_not_be_called,
- httpcli_post_should_not_be_called);
+ g_test_gce_tenancy_checker_called = false;
GPR_ASSERT(grpc_google_default_credentials_create() == nullptr);
+ GPR_ASSERT(g_test_gce_tenancy_checker_called == false);
/* Cleanup. */
- grpc_httpcli_set_override(nullptr, nullptr);
grpc_override_well_known_credentials_path_getter(nullptr);
}
diff --git a/test/core/security/security_connector_test.cc b/test/core/security/security_connector_test.cc
index f03f4ccdbd..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,26 @@ 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 {
@@ -416,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/transport/timeout_encoding_test.cc b/test/core/transport/timeout_encoding_test.cc
index 2367accc2e..b7044b5b41 100644
--- a/test/core/transport/timeout_encoding_test.cc
+++ b/test/core/transport/timeout_encoding_test.cc
@@ -71,7 +71,7 @@ static void assert_decodes_as(const char* buffer, grpc_millis expected) {
GPR_ASSERT(1 == grpc_http2_decode_timeout(
grpc_slice_from_static_string(buffer), &got));
if (got != expected) {
- gpr_log(GPR_ERROR, "got:'%" PRIdPTR "' != expected:'%" PRIdPTR "'", got,
+ gpr_log(GPR_ERROR, "got:'%" PRId64 "' != expected:'%" PRId64 "'", got,
expected);
abort();
}
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/handshaker/alts_handshaker_client_test.cc b/test/core/tsi/alts/handshaker/alts_handshaker_client_test.cc
index b9dd52a64a..c8d88aa72c 100644
--- a/test/core/tsi/alts/handshaker/alts_handshaker_client_test.cc
+++ b/test/core/tsi/alts/handshaker/alts_handshaker_client_test.cc
@@ -326,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/ssl_session_cache_test.cc b/test/core/tsi/ssl_session_cache_test.cc
index 72df0e545c..c86cefb3ff 100644
--- a/test/core/tsi/ssl_session_cache_test.cc
+++ b/test/core/tsi/ssl_session_cache_test.cc
@@ -88,7 +88,6 @@ TEST(SslSessionCacheTest, InitialState) {
// Verify session initial state.
{
tsi::SslSessionPtr tmp_sess = tracker.NewSession(1);
- EXPECT_EQ(tmp_sess->references, 1);
EXPECT_TRUE(tracker.IsAlive(1));
EXPECT_EQ(tracker.AliveCount(), 1);
}
diff --git a/test/core/tsi/ssl_transport_security_test.cc b/test/core/tsi/ssl_transport_security_test.cc
index 88f1abc18c..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,
@@ -152,19 +163,13 @@ static void ssl_test_setup_handshakers(tsi_test_fixture* fixture) {
&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,
@@ -624,7 +629,7 @@ 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[48];
+ 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();
@@ -633,22 +638,22 @@ void ssl_tsi_test_do_handshake_session_cache() {
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 = 48;
+ 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', 48);
+ 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', 48);
+ memset(session_ticket_key, 'b', sizeof(session_ticket_key));
do_handshake(false);
do_handshake(true);
- memset(session_ticket_key, 'c', 48);
+ memset(session_ticket_key, 'c', sizeof(session_ticket_key));
do_handshake(false);
do_handshake(true);
tsi_ssl_session_cache_unref(session_cache);
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_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/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/cpp/end2end/client_lb_end2end_test.cc b/test/cpp/end2end/client_lb_end2end_test.cc
index a39e443cf0..eeec8e90bd 100644
--- a/test/cpp/end2end/client_lb_end2end_test.cc
+++ b/test/cpp/end2end/client_lb_end2end_test.cc
@@ -198,7 +198,8 @@ class ClientLbEnd2endTest : public ::testing::Test {
bool SendRpc(
const std::unique_ptr<grpc::testing::EchoTestService::Stub>& stub,
- EchoResponse* response = nullptr, int timeout_ms = 1000) {
+ EchoResponse* response = nullptr, int timeout_ms = 1000,
+ Status* result = nullptr) {
const bool local_response = (response == nullptr);
if (local_response) response = new EchoResponse;
EchoRequest request;
@@ -206,6 +207,7 @@ class ClientLbEnd2endTest : public ::testing::Test {
ClientContext context;
context.set_deadline(grpc_timeout_milliseconds_to_deadline(timeout_ms));
Status status = stub->Echo(&context, request, response);
+ if (result != nullptr) *result = status;
if (local_response) delete response;
return status.ok();
}
@@ -214,12 +216,15 @@ class ClientLbEnd2endTest : public ::testing::Test {
const std::unique_ptr<grpc::testing::EchoTestService::Stub>& stub,
const grpc_core::DebugLocation& location) {
EchoResponse response;
- const bool success = SendRpc(stub, &response);
- if (!success) abort();
- ASSERT_TRUE(success) << "From " << location.file() << ":"
- << location.line();
+ Status status;
+ const bool success = SendRpc(stub, &response, 2000, &status);
+ ASSERT_TRUE(success) << "From " << location.file() << ":" << location.line()
+ << "\n"
+ << "Error: " << status.error_message() << " "
+ << status.error_details();
ASSERT_EQ(response.message(), kRequestMessage_)
<< "From " << location.file() << ":" << location.line();
+ if (!success) abort();
}
void CheckRpcSendFailure(
@@ -362,7 +367,7 @@ TEST_F(ClientLbEnd2endTest, PickFirstBackOffInitialReconnect) {
grpc_timeout_milliseconds_to_deadline(kInitialBackOffMs * 2)));
const gpr_timespec t1 = gpr_now(GPR_CLOCK_MONOTONIC);
const grpc_millis waited_ms = gpr_time_to_millis(gpr_time_sub(t1, t0));
- gpr_log(GPR_DEBUG, "Waited %ld milliseconds", waited_ms);
+ gpr_log(GPR_DEBUG, "Waited %" PRId64 " milliseconds", waited_ms);
// We should have waited at least kInitialBackOffMs. We substract one to
// account for test and precision accuracy drift.
EXPECT_GE(waited_ms, kInitialBackOffMs - 1);
@@ -391,7 +396,7 @@ TEST_F(ClientLbEnd2endTest, PickFirstBackOffMinReconnect) {
grpc_timeout_milliseconds_to_deadline(kMinReconnectBackOffMs * 2));
const gpr_timespec t1 = gpr_now(GPR_CLOCK_MONOTONIC);
const grpc_millis waited_ms = gpr_time_to_millis(gpr_time_sub(t1, t0));
- gpr_log(GPR_DEBUG, "Waited %ld ms", waited_ms);
+ gpr_log(GPR_DEBUG, "Waited %" PRId64 " ms", waited_ms);
// We should have waited at least kMinReconnectBackOffMs. We substract one to
// account for test and precision accuracy drift.
EXPECT_GE(waited_ms, kMinReconnectBackOffMs - 1);
diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc
index ca8ee3de06..3eb155ef95 100644
--- a/test/cpp/interop/client.cc
+++ b/test/cpp/interop/client.cc
@@ -31,6 +31,8 @@
#include "test/cpp/interop/interop_client.h"
#include "test/cpp/util/test_config.h"
+DEFINE_bool(use_alts, false,
+ "Whether to use alts. Enable alts will disable tls.");
DEFINE_bool(use_tls, false, "Whether to use tls.");
DEFINE_string(custom_credentials_type, "", "User provided credentials type.");
DEFINE_bool(use_test_ca, false, "False to use SSL roots for google");
diff --git a/test/cpp/interop/client_helper.cc b/test/cpp/interop/client_helper.cc
index 4041f95abc..29b5a1ed6c 100644
--- a/test/cpp/interop/client_helper.cc
+++ b/test/cpp/interop/client_helper.cc
@@ -35,6 +35,7 @@
#include "test/cpp/util/create_test_channel.h"
#include "test/cpp/util/test_credentials_provider.h"
+DECLARE_bool(use_alts);
DECLARE_bool(use_tls);
DECLARE_string(custom_credentials_type);
DECLARE_bool(use_test_ca);
@@ -103,8 +104,10 @@ std::shared_ptr<Channel> CreateChannelForTestCase(
GPR_ASSERT(creds);
}
if (FLAGS_custom_credentials_type.empty()) {
+ transport_security security_type =
+ FLAGS_use_alts ? ALTS : (FLAGS_use_tls ? TLS : INSECURE);
return CreateTestChannel(host_port, FLAGS_server_host_override,
- FLAGS_use_tls, !FLAGS_use_test_ca, creds);
+ security_type, !FLAGS_use_test_ca, creds);
} else {
return CreateTestChannel(host_port, FLAGS_custom_credentials_type, creds);
}
diff --git a/test/cpp/interop/http2_client.cc b/test/cpp/interop/http2_client.cc
index 821815c6e8..543f159265 100644
--- a/test/cpp/interop/http2_client.cc
+++ b/test/cpp/interop/http2_client.cc
@@ -194,7 +194,7 @@ int main(int argc, char** argv) {
snprintf(host_port, host_port_buf_size, "%s:%d", FLAGS_server_host.c_str(),
FLAGS_server_port);
std::shared_ptr<grpc::Channel> channel =
- grpc::CreateTestChannel(host_port, false);
+ grpc::CreateTestChannel(host_port, grpc::testing::INSECURE);
GPR_ASSERT(channel->WaitForConnected(gpr_time_add(
gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_seconds(300, GPR_TIMESPAN))));
grpc::testing::Http2Client client(channel);
diff --git a/test/cpp/interop/interop_server.cc b/test/cpp/interop/interop_server.cc
index 5fa1a336da..f55d624b21 100644
--- a/test/cpp/interop/interop_server.cc
+++ b/test/cpp/interop/interop_server.cc
@@ -38,6 +38,8 @@
#include "test/cpp/interop/server_helper.h"
#include "test/cpp/util/test_config.h"
+DEFINE_bool(use_alts, false,
+ "Whether to use alts. Enable alts will disable tls.");
DEFINE_bool(use_tls, false, "Whether to use tls.");
DEFINE_string(custom_credentials_type, "", "User provided credentials type.");
DEFINE_int32(port, 0, "Server port.");
@@ -316,12 +318,27 @@ class TestServiceImpl : public TestService::Service {
void grpc::testing::interop::RunServer(
std::shared_ptr<ServerCredentials> creds) {
- RunServer(creds, FLAGS_port, nullptr);
+ RunServer(creds, FLAGS_port, nullptr, nullptr);
+}
+
+void grpc::testing::interop::RunServer(
+ std::shared_ptr<ServerCredentials> creds,
+ std::unique_ptr<std::vector<std::unique_ptr<ServerBuilderOption>>>
+ server_options) {
+ RunServer(creds, FLAGS_port, nullptr, std::move(server_options));
}
void grpc::testing::interop::RunServer(
std::shared_ptr<ServerCredentials> creds, const int port,
ServerStartedCondition* server_started_condition) {
+ RunServer(creds, port, server_started_condition, nullptr);
+}
+
+void grpc::testing::interop::RunServer(
+ std::shared_ptr<ServerCredentials> creds, const int port,
+ ServerStartedCondition* server_started_condition,
+ std::unique_ptr<std::vector<std::unique_ptr<ServerBuilderOption>>>
+ server_options) {
GPR_ASSERT(port != 0);
std::ostringstream server_address;
server_address << "0.0.0.0:" << port;
@@ -333,6 +350,11 @@ void grpc::testing::interop::RunServer(
ServerBuilder builder;
builder.RegisterService(&service);
builder.AddListeningPort(server_address.str(), creds);
+ if (server_options != nullptr) {
+ for (size_t i = 0; i < server_options->size(); i++) {
+ builder.SetOption(std::move((*server_options)[i]));
+ }
+ }
if (FLAGS_max_send_message_size >= 0) {
builder.SetMaxSendMessageSize(FLAGS_max_send_message_size);
}
diff --git a/test/cpp/interop/reconnect_interop_client.cc b/test/cpp/interop/reconnect_interop_client.cc
index 9a451fa3f2..8a071d417e 100644
--- a/test/cpp/interop/reconnect_interop_client.cc
+++ b/test/cpp/interop/reconnect_interop_client.cc
@@ -44,9 +44,11 @@ using grpc::ClientContext;
using grpc::CreateTestChannel;
using grpc::Status;
using grpc::testing::Empty;
+using grpc::testing::INSECURE;
using grpc::testing::ReconnectInfo;
using grpc::testing::ReconnectParams;
using grpc::testing::ReconnectService;
+using grpc::testing::TLS;
int main(int argc, char** argv) {
grpc::testing::InitTest(&argc, &argv, true);
@@ -57,7 +59,7 @@ int main(int argc, char** argv) {
server_address << FLAGS_server_host << ':' << FLAGS_server_control_port;
std::unique_ptr<ReconnectService::Stub> control_stub(
ReconnectService::NewStub(
- CreateTestChannel(server_address.str(), false)));
+ CreateTestChannel(server_address.str(), INSECURE)));
ClientContext start_context;
ReconnectParams reconnect_params;
reconnect_params.set_max_reconnect_backoff_ms(FLAGS_max_reconnect_backoff_ms);
@@ -75,7 +77,7 @@ int main(int argc, char** argv) {
FLAGS_max_reconnect_backoff_ms);
}
std::shared_ptr<Channel> retry_channel =
- CreateTestChannel(server_address.str(), "foo.test.google.fr", true, false,
+ CreateTestChannel(server_address.str(), "foo.test.google.fr", TLS, false,
std::shared_ptr<CallCredentials>(), channel_args);
// About 13 retries.
diff --git a/test/cpp/interop/server_helper.cc b/test/cpp/interop/server_helper.cc
index 93ffd52560..2194521998 100644
--- a/test/cpp/interop/server_helper.cc
+++ b/test/cpp/interop/server_helper.cc
@@ -26,6 +26,7 @@
#include "src/core/lib/surface/call_test_only.h"
#include "test/cpp/util/test_credentials_provider.h"
+DECLARE_bool(use_alts);
DECLARE_bool(use_tls);
DECLARE_string(custom_credentials_type);
@@ -36,6 +37,8 @@ std::shared_ptr<ServerCredentials> CreateInteropServerCredentials() {
if (!FLAGS_custom_credentials_type.empty()) {
return GetCredentialsProvider()->GetServerCredentials(
FLAGS_custom_credentials_type);
+ } else if (FLAGS_use_alts) {
+ return GetCredentialsProvider()->GetServerCredentials(kAltsCredentialsType);
} else if (FLAGS_use_tls) {
return GetCredentialsProvider()->GetServerCredentials(kTlsCredentialsType);
} else {
diff --git a/test/cpp/interop/server_helper.h b/test/cpp/interop/server_helper.h
index 3004e7ff81..265874df70 100644
--- a/test/cpp/interop/server_helper.h
+++ b/test/cpp/interop/server_helper.h
@@ -26,6 +26,8 @@
#include <grpc/impl/codegen/atm.h>
#include <grpcpp/security/server_credentials.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
#include <grpcpp/server_context.h>
namespace grpc {
@@ -72,6 +74,28 @@ void RunServer(std::shared_ptr<ServerCredentials> creds);
void RunServer(std::shared_ptr<ServerCredentials> creds, int port,
ServerStartedCondition* server_started_condition);
+/// Run gRPC interop server.
+///
+/// \param creds The credentials associated with the server.
+/// \param server_options List of options to set when building the server.
+void RunServer(
+ std::shared_ptr<ServerCredentials> creds,
+ std::unique_ptr<std::vector<std::unique_ptr<ServerBuilderOption>>>
+ server_options);
+
+/// Run gRPC interop server.
+///
+/// \param creds The credentials associated with the server.
+/// \param port Port to use for the server.
+/// \param server_options List of options to set when building the server.
+/// \param server_started_condition (optional) Struct holding mutex, condition
+// variable, and condition used to notify when the server has started.
+void RunServer(
+ std::shared_ptr<ServerCredentials> creds, const int port,
+ ServerStartedCondition* server_started_condition,
+ std::unique_ptr<std::vector<std::unique_ptr<grpc::ServerBuilderOption>>>
+ server_options);
+
} // namespace interop
} // namespace testing
} // namespace grpc
diff --git a/test/cpp/interop/stress_test.cc b/test/cpp/interop/stress_test.cc
index 6e8134a83b..023e0c8f0b 100644
--- a/test/cpp/interop/stress_test.cc
+++ b/test/cpp/interop/stress_test.cc
@@ -99,18 +99,24 @@ DEFINE_bool(do_not_abort_on_transient_failures, true,
// Options from client.cc (for compatibility with interop test).
// TODO(sreek): Consolidate overlapping options
+DEFINE_bool(use_alts, false,
+ "Whether to use alts. Enable alts will disable tls.");
DEFINE_bool(use_tls, false, "Whether to use tls.");
DEFINE_bool(use_test_ca, false, "False to use SSL roots for google");
DEFINE_string(server_host_override, "foo.test.google.fr",
"Override the server host which is sent in HTTP header");
+using grpc::testing::ALTS;
+using grpc::testing::INSECURE;
using grpc::testing::MetricsService;
using grpc::testing::MetricsServiceImpl;
using grpc::testing::StressTestInteropClient;
+using grpc::testing::TLS;
using grpc::testing::TestCaseType;
using grpc::testing::UNKNOWN_TEST;
using grpc::testing::WeightedRandomTestSelector;
using grpc::testing::kTestCaseList;
+using grpc::testing::transport_security;
static int log_level = GPR_LOG_SEVERITY_DEBUG;
@@ -268,6 +274,8 @@ int main(int argc, char** argv) {
int thread_idx = 0;
int server_idx = -1;
char buffer[256];
+ transport_security security_type =
+ FLAGS_use_alts ? ALTS : (FLAGS_use_tls ? TLS : INSECURE);
for (auto it = server_addresses.begin(); it != server_addresses.end(); it++) {
++server_idx;
// Create channel(s) for each server
@@ -276,7 +284,7 @@ int main(int argc, char** argv) {
gpr_log(GPR_INFO, "Starting test with %s channel_idx=%d..", it->c_str(),
channel_idx);
std::shared_ptr<grpc::Channel> channel = grpc::CreateTestChannel(
- *it, FLAGS_server_host_override, FLAGS_use_tls, !FLAGS_use_test_ca);
+ *it, FLAGS_server_host_override, security_type, !FLAGS_use_test_ca);
// Create stub(s) for each channel
for (int stub_idx = 0; stub_idx < FLAGS_num_stubs_per_channel;
diff --git a/test/cpp/microbenchmarks/BUILD b/test/cpp/microbenchmarks/BUILD
index 67f7e440b0..5dcfd94ed3 100644
--- a/test/cpp/microbenchmarks/BUILD
+++ b/test/cpp/microbenchmarks/BUILD
@@ -42,6 +42,7 @@ grpc_cc_library(
"//:grpc++_unsecure",
"//src/proto/grpc/testing:echo_proto",
"//test/core/util:grpc_test_util_unsecure",
+ "//test/cpp/util:test_config",
],
)
@@ -113,10 +114,7 @@ grpc_cc_binary(
name = "bm_fullstack_trickle",
testonly = 1,
srcs = ["bm_fullstack_trickle.cc"],
- deps = [
- ":helpers",
- "//test/cpp/util:test_config",
- ],
+ deps = [":helpers"],
)
grpc_cc_library(
diff --git a/test/cpp/microbenchmarks/bm_arena.cc b/test/cpp/microbenchmarks/bm_arena.cc
index 69c8c1c029..b97c954fae 100644
--- a/test/cpp/microbenchmarks/bm_arena.cc
+++ b/test/cpp/microbenchmarks/bm_arena.cc
@@ -18,9 +18,10 @@
/* Benchmark arenas */
+#include <benchmark/benchmark.h>
#include "src/core/lib/gpr/arena.h"
#include "test/cpp/microbenchmarks/helpers.h"
-#include "third_party/benchmark/include/benchmark/benchmark.h"
+#include "test/cpp/util/test_config.h"
static void BM_Arena_NoOp(benchmark::State& state) {
while (state.KeepRunning()) {
@@ -56,4 +57,15 @@ static void BM_Arena_Batch(benchmark::State& state) {
}
BENCHMARK(BM_Arena_Batch)->Ranges({{1, 64 * 1024}, {1, 64}, {1, 1024}});
-BENCHMARK_MAIN();
+// Some distros have RunSpecifiedBenchmarks under the benchmark namespace,
+// and others do not. This allows us to support both modes.
+namespace benchmark {
+void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
+} // namespace benchmark
+
+int main(int argc, char** argv) {
+ ::benchmark::Initialize(&argc, argv);
+ ::grpc::testing::InitTest(&argc, &argv, false);
+ benchmark::RunTheBenchmarksNamespaced();
+ return 0;
+}
diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc
index 85a9f5e137..831b29c506 100644
--- a/test/cpp/microbenchmarks/bm_call_create.cc
+++ b/test/cpp/microbenchmarks/bm_call_create.cc
@@ -46,6 +46,7 @@
#include "src/cpp/client/create_channel_internal.h"
#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/cpp/microbenchmarks/helpers.h"
+#include "test/cpp/util/test_config.h"
auto& force_library_initialization = Library::get();
@@ -813,4 +814,15 @@ static void BM_IsolatedCall_StreamingSend(benchmark::State& state) {
}
BENCHMARK(BM_IsolatedCall_StreamingSend);
-BENCHMARK_MAIN();
+// Some distros have RunSpecifiedBenchmarks under the benchmark namespace,
+// and others do not. This allows us to support both modes.
+namespace benchmark {
+void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
+} // namespace benchmark
+
+int main(int argc, char** argv) {
+ ::benchmark::Initialize(&argc, argv);
+ ::grpc::testing::InitTest(&argc, &argv, false);
+ benchmark::RunTheBenchmarksNamespaced();
+ return 0;
+}
diff --git a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc
index d0f3ec8e8b..823c76f755 100644
--- a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc
+++ b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc
@@ -33,6 +33,7 @@
#include "src/core/lib/transport/timeout_encoding.h"
#include "test/cpp/microbenchmarks/helpers.h"
+#include "test/cpp/util/test_config.h"
auto& force_library_initialization = Library::get();
@@ -855,4 +856,15 @@ BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, SameDeadline, OnHeaderNew);
} // namespace hpack_parser_fixtures
-BENCHMARK_MAIN();
+// Some distros have RunSpecifiedBenchmarks under the benchmark namespace,
+// and others do not. This allows us to support both modes.
+namespace benchmark {
+void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
+} // namespace benchmark
+
+int main(int argc, char** argv) {
+ ::benchmark::Initialize(&argc, argv);
+ ::grpc::testing::InitTest(&argc, &argv, false);
+ benchmark::RunTheBenchmarksNamespaced();
+ return 0;
+}
diff --git a/test/cpp/microbenchmarks/bm_chttp2_transport.cc b/test/cpp/microbenchmarks/bm_chttp2_transport.cc
index d00c79b610..1e9bd273aa 100644
--- a/test/cpp/microbenchmarks/bm_chttp2_transport.cc
+++ b/test/cpp/microbenchmarks/bm_chttp2_transport.cc
@@ -18,6 +18,7 @@
/* Microbenchmarks around CHTTP2 transport operations */
+#include <benchmark/benchmark.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
@@ -33,7 +34,7 @@
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/transport/static_metadata.h"
#include "test/cpp/microbenchmarks/helpers.h"
-#include "third_party/benchmark/include/benchmark/benchmark.h"
+#include "test/cpp/util/test_config.h"
auto& force_library_initialization = Library::get();
@@ -638,4 +639,15 @@ static void BM_TransportStreamRecv(benchmark::State& state) {
}
BENCHMARK(BM_TransportStreamRecv)->Range(0, 128 * 1024 * 1024);
-BENCHMARK_MAIN();
+// Some distros have RunSpecifiedBenchmarks under the benchmark namespace,
+// and others do not. This allows us to support both modes.
+namespace benchmark {
+void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
+} // namespace benchmark
+
+int main(int argc, char** argv) {
+ ::benchmark::Initialize(&argc, argv);
+ ::grpc::testing::InitTest(&argc, &argv, false);
+ benchmark::RunTheBenchmarksNamespaced();
+ return 0;
+}
diff --git a/test/cpp/microbenchmarks/bm_closure.cc b/test/cpp/microbenchmarks/bm_closure.cc
index 6d88faecc0..74ca1ce3a4 100644
--- a/test/cpp/microbenchmarks/bm_closure.cc
+++ b/test/cpp/microbenchmarks/bm_closure.cc
@@ -28,6 +28,7 @@
#include "src/core/lib/iomgr/exec_ctx.h"
#include "test/cpp/microbenchmarks/helpers.h"
+#include "test/cpp/util/test_config.h"
auto& force_library_initialization = Library::get();
@@ -384,7 +385,7 @@ static void BM_ClosureReschedOnExecCtx(benchmark::State& state) {
grpc_core::ExecCtx exec_ctx;
Rescheduler r(state, grpc_schedule_on_exec_ctx);
r.ScheduleFirst();
-
+ grpc_core::ExecCtx::Get()->Flush();
track_counters.Finish(state);
}
BENCHMARK(BM_ClosureReschedOnExecCtx);
@@ -415,4 +416,15 @@ static void BM_ClosureReschedOnCombinerFinally(benchmark::State& state) {
}
BENCHMARK(BM_ClosureReschedOnCombinerFinally);
-BENCHMARK_MAIN();
+// Some distros have RunSpecifiedBenchmarks under the benchmark namespace,
+// and others do not. This allows us to support both modes.
+namespace benchmark {
+void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
+} // namespace benchmark
+
+int main(int argc, char** argv) {
+ ::benchmark::Initialize(&argc, argv);
+ ::grpc::testing::InitTest(&argc, &argv, false);
+ benchmark::RunTheBenchmarksNamespaced();
+ return 0;
+}
diff --git a/test/cpp/microbenchmarks/bm_cq.cc b/test/cpp/microbenchmarks/bm_cq.cc
index 342a95ed10..a7cb939265 100644
--- a/test/cpp/microbenchmarks/bm_cq.cc
+++ b/test/cpp/microbenchmarks/bm_cq.cc
@@ -25,6 +25,7 @@
#include <grpcpp/completion_queue.h>
#include <grpcpp/impl/grpc_library.h>
#include "test/cpp/microbenchmarks/helpers.h"
+#include "test/cpp/util/test_config.h"
#include "src/core/lib/surface/completion_queue.h"
@@ -148,4 +149,15 @@ BENCHMARK(BM_EmptyCore);
} // namespace testing
} // namespace grpc
-BENCHMARK_MAIN();
+// Some distros have RunSpecifiedBenchmarks under the benchmark namespace,
+// and others do not. This allows us to support both modes.
+namespace benchmark {
+void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
+} // namespace benchmark
+
+int main(int argc, char** argv) {
+ ::benchmark::Initialize(&argc, argv);
+ ::grpc::testing::InitTest(&argc, &argv, false);
+ benchmark::RunTheBenchmarksNamespaced();
+ return 0;
+}
diff --git a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc
index ec79b95cd8..da095c3e68 100644
--- a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc
+++ b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc
@@ -24,6 +24,7 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include "test/cpp/microbenchmarks/helpers.h"
+#include "test/cpp/util/test_config.h"
#include "src/core/lib/iomgr/ev_posix.h"
#include "src/core/lib/iomgr/port.h"
@@ -164,4 +165,15 @@ BENCHMARK(BM_Cq_Throughput)->ThreadRange(1, 16)->UseRealTime();
} // namespace testing
} // namespace grpc
-BENCHMARK_MAIN();
+// Some distros have RunSpecifiedBenchmarks under the benchmark namespace,
+// and others do not. This allows us to support both modes.
+namespace benchmark {
+void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
+} // namespace benchmark
+
+int main(int argc, char** argv) {
+ ::benchmark::Initialize(&argc, argv);
+ ::grpc::testing::InitTest(&argc, &argv, false);
+ benchmark::RunTheBenchmarksNamespaced();
+ return 0;
+}
diff --git a/test/cpp/microbenchmarks/bm_error.cc b/test/cpp/microbenchmarks/bm_error.cc
index d12f475a49..ae557a580a 100644
--- a/test/cpp/microbenchmarks/bm_error.cc
+++ b/test/cpp/microbenchmarks/bm_error.cc
@@ -25,6 +25,7 @@
#include "src/core/lib/transport/error_utils.h"
#include "test/cpp/microbenchmarks/helpers.h"
+#include "test/cpp/util/test_config.h"
auto& force_library_initialization = Library::get();
@@ -310,4 +311,15 @@ BENCHMARK_SUITE(ErrorWithGrpcStatus);
BENCHMARK_SUITE(ErrorWithHttpError);
BENCHMARK_SUITE(ErrorWithNestedGrpcStatus);
-BENCHMARK_MAIN();
+// Some distros have RunSpecifiedBenchmarks under the benchmark namespace,
+// and others do not. This allows us to support both modes.
+namespace benchmark {
+void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
+} // namespace benchmark
+
+int main(int argc, char** argv) {
+ ::benchmark::Initialize(&argc, argv);
+ ::grpc::testing::InitTest(&argc, &argv, false);
+ benchmark::RunTheBenchmarksNamespaced();
+ return 0;
+}
diff --git a/test/cpp/microbenchmarks/bm_fullstack_streaming_ping_pong.cc b/test/cpp/microbenchmarks/bm_fullstack_streaming_ping_pong.cc
index 655e032faf..34df77aca3 100644
--- a/test/cpp/microbenchmarks/bm_fullstack_streaming_ping_pong.cc
+++ b/test/cpp/microbenchmarks/bm_fullstack_streaming_ping_pong.cc
@@ -19,6 +19,7 @@
/* Benchmark gRPC end2end in various configurations */
#include "test/cpp/microbenchmarks/fullstack_streaming_ping_pong.h"
+#include "test/cpp/util/test_config.h"
namespace grpc {
namespace testing {
@@ -114,4 +115,15 @@ BENCHMARK_TEMPLATE(BM_StreamingPingPongWithCoalescingApi, MinInProcess,
} // namespace testing
} // namespace grpc
-BENCHMARK_MAIN();
+// Some distros have RunSpecifiedBenchmarks under the benchmark namespace,
+// and others do not. This allows us to support both modes.
+namespace benchmark {
+void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
+} // namespace benchmark
+
+int main(int argc, char** argv) {
+ ::benchmark::Initialize(&argc, argv);
+ ::grpc::testing::InitTest(&argc, &argv, false);
+ benchmark::RunTheBenchmarksNamespaced();
+ return 0;
+}
diff --git a/test/cpp/microbenchmarks/bm_fullstack_streaming_pump.cc b/test/cpp/microbenchmarks/bm_fullstack_streaming_pump.cc
index c7ceacd320..da98f3cbcd 100644
--- a/test/cpp/microbenchmarks/bm_fullstack_streaming_pump.cc
+++ b/test/cpp/microbenchmarks/bm_fullstack_streaming_pump.cc
@@ -19,6 +19,7 @@
/* Benchmark gRPC end2end in various configurations */
#include "test/cpp/microbenchmarks/fullstack_streaming_pump.h"
+#include "test/cpp/util/test_config.h"
namespace grpc {
namespace testing {
@@ -64,4 +65,15 @@ BENCHMARK_TEMPLATE(BM_PumpStreamServerToClient, MinInProcessCHTTP2)->Arg(0);
} // namespace testing
} // namespace grpc
-BENCHMARK_MAIN();
+// Some distros have RunSpecifiedBenchmarks under the benchmark namespace,
+// and others do not. This allows us to support both modes.
+namespace benchmark {
+void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
+} // namespace benchmark
+
+int main(int argc, char** argv) {
+ ::benchmark::Initialize(&argc, argv);
+ ::grpc::testing::InitTest(&argc, &argv, false);
+ benchmark::RunTheBenchmarksNamespaced();
+ return 0;
+}
diff --git a/test/cpp/microbenchmarks/bm_fullstack_trickle.cc b/test/cpp/microbenchmarks/bm_fullstack_trickle.cc
index 3b21c4c278..1af92d2c80 100644
--- a/test/cpp/microbenchmarks/bm_fullstack_trickle.cc
+++ b/test/cpp/microbenchmarks/bm_fullstack_trickle.cc
@@ -458,10 +458,16 @@ BENCHMARK(BM_PumpUnbalancedUnary_Trickle)->Apply(UnaryTrickleArgs);
extern gpr_timespec (*gpr_now_impl)(gpr_clock_type clock_type);
+// Some distros have RunSpecifiedBenchmarks under the benchmark namespace,
+// and others do not. This allows us to support both modes.
+namespace benchmark {
+void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
+} // namespace benchmark
+
int main(int argc, char** argv) {
::benchmark::Initialize(&argc, argv);
::grpc::testing::InitTest(&argc, &argv, false);
grpc_timer_manager_set_threading(false);
gpr_now_impl = ::grpc::testing::fake_now;
- ::benchmark::RunSpecifiedBenchmarks();
+ benchmark::RunTheBenchmarksNamespaced();
}
diff --git a/test/cpp/microbenchmarks/bm_fullstack_unary_ping_pong.cc b/test/cpp/microbenchmarks/bm_fullstack_unary_ping_pong.cc
index fa41d114c0..5a7a8d5baf 100644
--- a/test/cpp/microbenchmarks/bm_fullstack_unary_ping_pong.cc
+++ b/test/cpp/microbenchmarks/bm_fullstack_unary_ping_pong.cc
@@ -19,6 +19,7 @@
/* Benchmark gRPC end2end in various configurations */
#include "test/cpp/microbenchmarks/fullstack_unary_ping_pong.h"
+#include "test/cpp/util/test_config.h"
namespace grpc {
namespace testing {
@@ -164,4 +165,15 @@ BENCHMARK_TEMPLATE(BM_UnaryPingPong, InProcess, NoOpMutator,
} // namespace testing
} // namespace grpc
-BENCHMARK_MAIN();
+// Some distros have RunSpecifiedBenchmarks under the benchmark namespace,
+// and others do not. This allows us to support both modes.
+namespace benchmark {
+void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
+} // namespace benchmark
+
+int main(int argc, char** argv) {
+ ::benchmark::Initialize(&argc, argv);
+ ::grpc::testing::InitTest(&argc, &argv, false);
+ benchmark::RunTheBenchmarksNamespaced();
+ return 0;
+}
diff --git a/test/cpp/microbenchmarks/bm_metadata.cc b/test/cpp/microbenchmarks/bm_metadata.cc
index f1e7890fc0..553b33c402 100644
--- a/test/cpp/microbenchmarks/bm_metadata.cc
+++ b/test/cpp/microbenchmarks/bm_metadata.cc
@@ -25,6 +25,7 @@
#include "src/core/lib/transport/static_metadata.h"
#include "test/cpp/microbenchmarks/helpers.h"
+#include "test/cpp/util/test_config.h"
auto& force_library_initialization = Library::get();
@@ -290,4 +291,15 @@ static void BM_MetadataRefUnrefStatic(benchmark::State& state) {
}
BENCHMARK(BM_MetadataRefUnrefStatic);
-BENCHMARK_MAIN();
+// Some distros have RunSpecifiedBenchmarks under the benchmark namespace,
+// and others do not. This allows us to support both modes.
+namespace benchmark {
+void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
+} // namespace benchmark
+
+int main(int argc, char** argv) {
+ ::benchmark::Initialize(&argc, argv);
+ ::grpc::testing::InitTest(&argc, &argv, false);
+ benchmark::RunTheBenchmarksNamespaced();
+ return 0;
+}
diff --git a/test/cpp/microbenchmarks/bm_pollset.cc b/test/cpp/microbenchmarks/bm_pollset.cc
index 849f096657..a4383b83cb 100644
--- a/test/cpp/microbenchmarks/bm_pollset.cc
+++ b/test/cpp/microbenchmarks/bm_pollset.cc
@@ -18,6 +18,7 @@
/* Test out pollset latencies */
+#include <benchmark/benchmark.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@@ -29,7 +30,7 @@
#include "src/core/lib/iomgr/wakeup_fd_posix.h"
#include "test/cpp/microbenchmarks/helpers.h"
-#include "third_party/benchmark/include/benchmark/benchmark.h"
+#include "test/cpp/util/test_config.h"
#include <string.h>
@@ -256,4 +257,15 @@ static void BM_SingleThreadPollOneFd(benchmark::State& state) {
}
BENCHMARK(BM_SingleThreadPollOneFd);
-BENCHMARK_MAIN();
+// Some distros have RunSpecifiedBenchmarks under the benchmark namespace,
+// and others do not. This allows us to support both modes.
+namespace benchmark {
+void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
+} // namespace benchmark
+
+int main(int argc, char** argv) {
+ ::benchmark::Initialize(&argc, argv);
+ ::grpc::testing::InitTest(&argc, &argv, false);
+ benchmark::RunTheBenchmarksNamespaced();
+ return 0;
+}
diff --git a/test/cpp/microbenchmarks/helpers.cc b/test/cpp/microbenchmarks/helpers.cc
index e4a31f50a9..e4ba37e2d6 100644
--- a/test/cpp/microbenchmarks/helpers.cc
+++ b/test/cpp/microbenchmarks/helpers.cc
@@ -48,16 +48,10 @@ void TrackCounters::AddToLabel(std::ostream& out, benchmark::State& state) {
static_cast<double>(state.iterations()));
}
for (int i = 0; i < GRPC_STATS_HISTOGRAM_COUNT; i++) {
- std::ostringstream median_ss;
- median_ss << grpc_stats_histogram_name[i] << "-median";
- state.counters[median_ss.str()] =
- benchmark::Counter(grpc_stats_histo_percentile(
- &stats, static_cast<grpc_stats_histograms>(i), 50.0));
- std::ostringstream tail_ss;
- tail_ss << grpc_stats_histogram_name[i] << "-99p";
- state.counters[tail_ss.str()] =
- benchmark::Counter(grpc_stats_histo_percentile(
- &stats, static_cast<grpc_stats_histograms>(i), 99.0));
+ out << " " << grpc_stats_histogram_name[i] << "-median:"
+ << grpc_stats_histo_percentile(&stats, (grpc_stats_histograms)i, 50.0)
+ << " " << grpc_stats_histogram_name[i] << "-99p:"
+ << grpc_stats_histo_percentile(&stats, (grpc_stats_histograms)i, 99.0);
}
#ifdef GPR_LOW_LEVEL_COUNTERS
grpc_memory_counters counters_at_end = grpc_memory_counters_snapshot();
diff --git a/test/cpp/naming/BUILD b/test/cpp/naming/BUILD
index 54b53d2792..fa0b216f8f 100644
--- a/test/cpp/naming/BUILD
+++ b/test/cpp/naming/BUILD
@@ -22,16 +22,17 @@ package(
licenses(["notice"]) # Apache v2
-load("//bazel:grpc_build_system.bzl", "grpc_sh_binary", "grpc_py_binary")
+load("//bazel:grpc_build_system.bzl", "grpc_py_binary")
load(":generate_resolver_component_tests.bzl", "generate_resolver_component_tests")
# Meant to be invoked only through the top-level shell script driver.
-grpc_sh_binary(
+grpc_py_binary(
name = "resolver_component_tests_runner",
srcs = [
- "resolver_component_tests_runner.sh",
+ "resolver_component_tests_runner.py",
],
+ testonly = True,
)
generate_resolver_component_tests()
diff --git a/test/cpp/naming/README.md b/test/cpp/naming/README.md
deleted file mode 100644
index e0dd208465..0000000000
--- a/test/cpp/naming/README.md
+++ /dev/null
@@ -1,43 +0,0 @@
-# Resolver Tests
-
-This directory has tests and infrastructure for unit tests and GCE
-integration tests of gRPC resolver functionality.
-
-There are two different tests here:
-
-## Resolver unit tests (resolver "component" tests)
-
-These tests run per-change, along with the rest of the grpc unit tests.
-They query a local testing DNS server.
-
-## GCE integration tests
-
-These tests use the same test binary and the same test records
-as the unit tests, but they run against GCE DNS (this is done by
-running the test on a GCE instance and not specifying an authority
-in uris). These tests run in a background job, which needs to be
-actively monitored.
-
-## Making changes to test records
-
-After making a change to `resolver_test_record_groups.yaml`:
-
-1. Increment the "version number" in the `resolver_tests_common_zone_name`
- DNS zone (this is a yaml field at the top
- of `resolver_test_record_groups.yaml`).
-
-2. Regenerate projects.
-
-3. From the repo root, run:
-
-```
-$ test/cpp/naming/create_private_dns_zone.sh
-$ test/cpp/naming/private_dns_zone_init.sh
-```
-
-Note that these commands must be ran in environment that
-has access to the grpc-testing GCE project.
-
-If everything runs smoothly, then once the change is merged,
-the GCE DNS integration testing job will transition to the
-new records and continue passing.
diff --git a/test/cpp/naming/address_sorting_test.cc b/test/cpp/naming/address_sorting_test.cc
index df93ff6f8d..a92e9e3b3e 100644
--- a/test/cpp/naming/address_sorting_test.cc
+++ b/test/cpp/naming/address_sorting_test.cc
@@ -298,6 +298,29 @@ TEST(AddressSortingTest, TestUsesLabelFromDefaultTable) {
});
}
+/* Flip the input on the test above to reorder the sort function's
+ * comparator's inputs. */
+TEST(AddressSortingTest, TestUsesLabelFromDefaultTableInputFlipped) {
+ bool ipv4_supported = true;
+ bool ipv6_supported = true;
+ OverrideAddressSortingSourceAddrFactory(
+ ipv4_supported, ipv6_supported,
+ {
+ {"[2002::5001]:443", {"[2001::5002]:0", AF_INET6}},
+ {"[2001::5001]:443",
+ {"[2001::5002]:0", AF_INET6}}, // matching labels
+ });
+ grpc_lb_addresses* lb_addrs = BuildLbAddrInputs({
+ {"[2001::5001]:443", AF_INET6},
+ {"[2002::5001]:443", AF_INET6},
+ });
+ grpc_cares_wrapper_test_only_address_sorting_sort(lb_addrs);
+ VerifyLbAddrOutputs(lb_addrs, {
+ "[2001::5001]:443",
+ "[2002::5001]:443",
+ });
+}
+
/* Tests for rule 6 */
TEST(AddressSortingTest,
@@ -722,16 +745,24 @@ TEST(AddressSortingTest, TestStableSortV4CompatAndSiteLocalAddresses) {
}
int main(int argc, char** argv) {
- const char* resolver = gpr_getenv("GRPC_DNS_RESOLVER");
+ char* resolver = gpr_getenv("GRPC_DNS_RESOLVER");
if (resolver == nullptr || strlen(resolver) == 0) {
gpr_setenv("GRPC_DNS_RESOLVER", "ares");
} else if (strcmp("ares", resolver)) {
gpr_log(GPR_INFO, "GRPC_DNS_RESOLVER != ares: %s.", resolver);
}
+ gpr_free(resolver);
grpc_test_init(argc, argv);
::testing::InitGoogleTest(&argc, argv);
grpc_init();
auto result = RUN_ALL_TESTS();
grpc_shutdown();
+ // Test sequential and nested inits and shutdowns.
+ grpc_init();
+ grpc_init();
+ grpc_shutdown();
+ grpc_shutdown();
+ grpc_init();
+ grpc_shutdown();
return result;
}
diff --git a/test/cpp/naming/gen_build_yaml.py b/test/cpp/naming/gen_build_yaml.py
index adebc62084..a0767b21cf 100755
--- a/test/cpp/naming/gen_build_yaml.py
+++ b/test/cpp/naming/gen_build_yaml.py
@@ -24,12 +24,6 @@ import json
_LOCAL_DNS_SERVER_ADDRESS = '127.0.0.1:15353'
-_TARGET_RECORDS_TO_SKIP_AGAINST_GCE = [
- # TODO: enable this once able to upload the very large TXT record
- # in this group to GCE DNS.
- 'ipv4-config-causing-fallback-to-tcp',
-]
-
def _append_zone_name(name, zone_name):
return '%s.%s' % (name, zone_name)
@@ -39,92 +33,22 @@ def _build_expected_addrs_cmd_arg(expected_addrs):
out.append('%s,%s' % (addr['address'], str(addr['is_balancer'])))
return ';'.join(out)
-def _data_for_type(r_type, r_data, common_zone_name):
- if r_type in ['A', 'AAAA']:
- return ' '.join(map(lambda x: '\"%s\"' % x, r_data))
- if r_type == 'SRV':
- assert len(r_data) == 1
- target = r_data[0].split(' ')[3]
- uploadable_target = '%s.%s' % (target, common_zone_name)
- uploadable = r_data[0].split(' ')
- uploadable[3] = uploadable_target
- return '\"%s\"' % ' '.join(uploadable)
- if r_type == 'TXT':
- assert len(r_data) == 1
- chunks = []
- all_data = r_data[0]
- cur = 0
- # Split TXT records that span more than 255 characters (the single
- # string length-limit in DNS) into multiple strings. Each string
- # needs to be wrapped with double-quotes, and all inner double-quotes
- # are escaped. The wrapping double-quotes and inner backslashes can be
- # counted towards the 255 character length limit (as observed with gcloud),
- # so make sure all strings fit within that limit.
- while len(all_data[cur:]) > 0:
- next_chunk = '\"'
- while len(next_chunk) < 254 and len(all_data[cur:]) > 0:
- if all_data[cur] == '\"':
- if len(next_chunk) < 253:
- next_chunk += '\\\"'
- else:
- break
- else:
- next_chunk += all_data[cur]
- cur += 1
- next_chunk += '\"'
- if len(next_chunk) > 255:
- raise Exception('Bug: next chunk is too long.')
- chunks.append(next_chunk)
- # Wrap the whole record in single quotes to make sure all strings
- # are associated with the same TXT record (to make it one bash token for
- # gcloud)
- return '\'%s\'' % ' '.join(chunks)
-
-# Convert DNS records from their "within a test group" format
-# of the yaml file to an easier form for the templates to use.
-def _gcloud_uploadable_form(test_cases, common_zone_name):
- out = []
- for group in test_cases:
- if group['record_to_resolve'] in _TARGET_RECORDS_TO_SKIP_AGAINST_GCE:
- continue
- for record_name in group['records'].keys():
- r_ttl = None
- all_r_data = {}
- for r_data in group['records'][record_name]:
- # enforce records have the same TTL only for simplicity
- if r_ttl is None:
- r_ttl = r_data['TTL']
- assert r_ttl == r_data['TTL'], '%s and %s differ' % (r_ttl, r_data['TTL'])
- r_type = r_data['type']
- if all_r_data.get(r_type) is None:
- all_r_data[r_type] = []
- all_r_data[r_type].append(r_data['data'])
- for r_type in all_r_data.keys():
- for r in out:
- assert r['name'] != record_name or r['type'] != r_type, 'attempt to add a duplicate record'
- out.append({
- 'name': record_name,
- 'ttl': r_ttl,
- 'type': r_type,
- 'data': _data_for_type(r_type, all_r_data[r_type], common_zone_name)
- })
- return out
-
-def _gce_dns_zone_id(resolver_component_data):
- dns_name = resolver_component_data['resolver_tests_common_zone_name']
- return dns_name.replace('.', '-') + 'zone-id'
-
-def _resolver_test_cases(resolver_component_data, records_to_skip):
+def _resolver_test_cases(resolver_component_data):
out = []
for test_case in resolver_component_data['resolver_component_tests']:
- if test_case['record_to_resolve'] in records_to_skip:
- continue
+ target_name = _append_zone_name(
+ test_case['record_to_resolve'],
+ resolver_component_data['resolver_tests_common_zone_name'])
out.append({
- 'target_name': _append_zone_name(test_case['record_to_resolve'],
- resolver_component_data['resolver_tests_common_zone_name']),
- 'expected_addrs': _build_expected_addrs_cmd_arg(test_case['expected_addrs']),
- 'expected_chosen_service_config': (test_case['expected_chosen_service_config'] or ''),
- 'expected_lb_policy': (test_case['expected_lb_policy'] or ''),
+ 'test_title': target_name,
+ 'arg_names_and_values': [
+ ('target_name', target_name),
+ ('expected_addrs',
+ _build_expected_addrs_cmd_arg(test_case['expected_addrs'])),
+ ('expected_chosen_service_config',
+ (test_case['expected_chosen_service_config'] or '')),
+ ('expected_lb_policy', (test_case['expected_lb_policy'] or '')),
+ ],
})
return out
@@ -135,11 +59,7 @@ def main():
json = {
'resolver_tests_common_zone_name': resolver_component_data['resolver_tests_common_zone_name'],
- 'resolver_gce_integration_tests_zone_id': _gce_dns_zone_id(resolver_component_data),
- 'all_integration_test_records': _gcloud_uploadable_form(resolver_component_data['resolver_component_tests'],
- resolver_component_data['resolver_tests_common_zone_name']),
- 'resolver_gce_integration_test_cases': _resolver_test_cases(resolver_component_data, _TARGET_RECORDS_TO_SKIP_AGAINST_GCE),
- 'resolver_component_test_cases': _resolver_test_cases(resolver_component_data, []),
+ 'resolver_component_test_cases': _resolver_test_cases(resolver_component_data),
'targets': [
{
'name': 'resolver_component_test' + unsecure_build_config_suffix,
diff --git a/test/cpp/naming/generate_resolver_component_tests.bzl b/test/cpp/naming/generate_resolver_component_tests.bzl
index ebc167931d..5e9aa63abe 100755
--- a/test/cpp/naming/generate_resolver_component_tests.bzl
+++ b/test/cpp/naming/generate_resolver_component_tests.bzl
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-load("//bazel:grpc_build_system.bzl", "grpc_sh_binary", "grpc_cc_test", "grpc_cc_binary")
+load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_cc_binary")
def generate_resolver_component_tests():
for unsecure_build_config_suffix in ['_unsecure', '']:
diff --git a/test/cpp/naming/private_dns_zone_init.sh b/test/cpp/naming/private_dns_zone_init.sh
deleted file mode 100755
index fba8a005cc..0000000000
--- a/test/cpp/naming/private_dns_zone_init.sh
+++ /dev/null
@@ -1,215 +0,0 @@
-#!/bin/bash
-# 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.
-
-# This file is auto-generated
-
-set -ex
-
-cd "$(dirname "$0")/../../.."
-
-gcloud dns record-sets transaction start -z=resolver-tests-version-4-grpctestingexp-zone-id
-
-gcloud dns record-sets transaction add \
- -z=resolver-tests-version-4-grpctestingexp-zone-id \
- --name=_grpclb._tcp.srv-ipv4-single-target.resolver-tests-version-4.grpctestingexp. \
- --type=SRV \
- --ttl=2100 \
- "0 0 1234 ipv4-single-target.resolver-tests-version-4.grpctestingexp."
-
-gcloud dns record-sets transaction add \
- -z=resolver-tests-version-4-grpctestingexp-zone-id \
- --name=ipv4-single-target.resolver-tests-version-4.grpctestingexp. \
- --type=A \
- --ttl=2100 \
- "1.2.3.4"
-
-gcloud dns record-sets transaction add \
- -z=resolver-tests-version-4-grpctestingexp-zone-id \
- --name=_grpclb._tcp.srv-ipv4-multi-target.resolver-tests-version-4.grpctestingexp. \
- --type=SRV \
- --ttl=2100 \
- "0 0 1234 ipv4-multi-target.resolver-tests-version-4.grpctestingexp."
-
-gcloud dns record-sets transaction add \
- -z=resolver-tests-version-4-grpctestingexp-zone-id \
- --name=ipv4-multi-target.resolver-tests-version-4.grpctestingexp. \
- --type=A \
- --ttl=2100 \
- "1.2.3.5" "1.2.3.6" "1.2.3.7"
-
-gcloud dns record-sets transaction add \
- -z=resolver-tests-version-4-grpctestingexp-zone-id \
- --name=_grpclb._tcp.srv-ipv6-single-target.resolver-tests-version-4.grpctestingexp. \
- --type=SRV \
- --ttl=2100 \
- "0 0 1234 ipv6-single-target.resolver-tests-version-4.grpctestingexp."
-
-gcloud dns record-sets transaction add \
- -z=resolver-tests-version-4-grpctestingexp-zone-id \
- --name=ipv6-single-target.resolver-tests-version-4.grpctestingexp. \
- --type=AAAA \
- --ttl=2100 \
- "2607:f8b0:400a:801::1001"
-
-gcloud dns record-sets transaction add \
- -z=resolver-tests-version-4-grpctestingexp-zone-id \
- --name=_grpclb._tcp.srv-ipv6-multi-target.resolver-tests-version-4.grpctestingexp. \
- --type=SRV \
- --ttl=2100 \
- "0 0 1234 ipv6-multi-target.resolver-tests-version-4.grpctestingexp."
-
-gcloud dns record-sets transaction add \
- -z=resolver-tests-version-4-grpctestingexp-zone-id \
- --name=ipv6-multi-target.resolver-tests-version-4.grpctestingexp. \
- --type=AAAA \
- --ttl=2100 \
- "2607:f8b0:400a:801::1002" "2607:f8b0:400a:801::1003" "2607:f8b0:400a:801::1004"
-
-gcloud dns record-sets transaction add \
- -z=resolver-tests-version-4-grpctestingexp-zone-id \
- --name=_grpc_config.srv-ipv4-simple-service-config.resolver-tests-version-4.grpctestingexp. \
- --type=TXT \
- --ttl=2100 \
- '"grpc_config=[{\"serviceConfig\":{\"loadBalancingPolicy\":\"round_robin\",\"methodConfig\":[{\"name\":[{\"method\":\"Foo\",\"service\":\"SimpleService\",\"waitForReady\":true}]}]}}]"'
-
-gcloud dns record-sets transaction add \
- -z=resolver-tests-version-4-grpctestingexp-zone-id \
- --name=_grpclb._tcp.srv-ipv4-simple-service-config.resolver-tests-version-4.grpctestingexp. \
- --type=SRV \
- --ttl=2100 \
- "0 0 1234 ipv4-simple-service-config.resolver-tests-version-4.grpctestingexp."
-
-gcloud dns record-sets transaction add \
- -z=resolver-tests-version-4-grpctestingexp-zone-id \
- --name=ipv4-simple-service-config.resolver-tests-version-4.grpctestingexp. \
- --type=A \
- --ttl=2100 \
- "1.2.3.4"
-
-gcloud dns record-sets transaction add \
- -z=resolver-tests-version-4-grpctestingexp-zone-id \
- --name=ipv4-no-srv-simple-service-config.resolver-tests-version-4.grpctestingexp. \
- --type=A \
- --ttl=2100 \
- "1.2.3.4"
-
-gcloud dns record-sets transaction add \
- -z=resolver-tests-version-4-grpctestingexp-zone-id \
- --name=_grpc_config.ipv4-no-srv-simple-service-config.resolver-tests-version-4.grpctestingexp. \
- --type=TXT \
- --ttl=2100 \
- '"grpc_config=[{\"serviceConfig\":{\"loadBalancingPolicy\":\"round_robin\",\"methodConfig\":[{\"name\":[{\"method\":\"Foo\",\"service\":\"NoSrvSimpleService\",\"waitForReady\":true}]}]}}]"'
-
-gcloud dns record-sets transaction add \
- -z=resolver-tests-version-4-grpctestingexp-zone-id \
- --name=_grpc_config.ipv4-no-config-for-cpp.resolver-tests-version-4.grpctestingexp. \
- --type=TXT \
- --ttl=2100 \
- '"grpc_config=[{\"clientLanguage\":[\"python\"],\"serviceConfig\":{\"loadBalancingPolicy\":\"round_robin\",\"methodConfig\":[{\"name\":[{\"method\":\"Foo\",\"service\":\"PythonService\",\"waitForReady\":true}]}]}}]"'
-
-gcloud dns record-sets transaction add \
- -z=resolver-tests-version-4-grpctestingexp-zone-id \
- --name=ipv4-no-config-for-cpp.resolver-tests-version-4.grpctestingexp. \
- --type=A \
- --ttl=2100 \
- "1.2.3.4"
-
-gcloud dns record-sets transaction add \
- -z=resolver-tests-version-4-grpctestingexp-zone-id \
- --name=ipv4-cpp-config-has-zero-percentage.resolver-tests-version-4.grpctestingexp. \
- --type=A \
- --ttl=2100 \
- "1.2.3.4"
-
-gcloud dns record-sets transaction add \
- -z=resolver-tests-version-4-grpctestingexp-zone-id \
- --name=_grpc_config.ipv4-cpp-config-has-zero-percentage.resolver-tests-version-4.grpctestingexp. \
- --type=TXT \
- --ttl=2100 \
- '"grpc_config=[{\"percentage\":0,\"serviceConfig\":{\"loadBalancingPolicy\":\"round_robin\",\"methodConfig\":[{\"name\":[{\"method\":\"Foo\",\"service\":\"CppService\",\"waitForReady\":true}]}]}}]"'
-
-gcloud dns record-sets transaction add \
- -z=resolver-tests-version-4-grpctestingexp-zone-id \
- --name=_grpc_config.ipv4-second-language-is-cpp.resolver-tests-version-4.grpctestingexp. \
- --type=TXT \
- --ttl=2100 \
- '"grpc_config=[{\"clientLanguage\":[\"go\"],\"serviceConfig\":{\"loadBalancingPolicy\":\"round_robin\",\"methodConfig\":[{\"name\":[{\"method\":\"Foo\",\"service\":\"GoService\",\"waitForReady\":true}]}]}},{\"clientLanguage\":[\"c++\"],\"serviceConfig\":{" "\"loadBalancingPolicy\":\"round_robin\",\"methodConfig\":[{\"name\":[{\"method\":\"Foo\",\"service\":\"CppService\",\"waitForReady\":true}]}]}}]"'
-
-gcloud dns record-sets transaction add \
- -z=resolver-tests-version-4-grpctestingexp-zone-id \
- --name=ipv4-second-language-is-cpp.resolver-tests-version-4.grpctestingexp. \
- --type=A \
- --ttl=2100 \
- "1.2.3.4"
-
-gcloud dns record-sets transaction add \
- -z=resolver-tests-version-4-grpctestingexp-zone-id \
- --name=ipv4-config-with-percentages.resolver-tests-version-4.grpctestingexp. \
- --type=A \
- --ttl=2100 \
- "1.2.3.4"
-
-gcloud dns record-sets transaction add \
- -z=resolver-tests-version-4-grpctestingexp-zone-id \
- --name=_grpc_config.ipv4-config-with-percentages.resolver-tests-version-4.grpctestingexp. \
- --type=TXT \
- --ttl=2100 \
- '"grpc_config=[{\"percentage\":0,\"serviceConfig\":{\"loadBalancingPolicy\":\"round_robin\",\"methodConfig\":[{\"name\":[{\"method\":\"Foo\",\"service\":\"NeverPickedService\",\"waitForReady\":true}]}]}},{\"percentage\":100,\"serviceConfig\":{\"loadBalanc" "ingPolicy\":\"round_robin\",\"methodConfig\":[{\"name\":[{\"method\":\"Foo\",\"service\":\"AlwaysPickedService\",\"waitForReady\":true}]}]}}]"'
-
-gcloud dns record-sets transaction add \
- -z=resolver-tests-version-4-grpctestingexp-zone-id \
- --name=_grpclb._tcp.srv-ipv4-target-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp. \
- --type=SRV \
- --ttl=2100 \
- "0 0 1234 balancer-for-ipv4-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp."
-
-gcloud dns record-sets transaction add \
- -z=resolver-tests-version-4-grpctestingexp-zone-id \
- --name=balancer-for-ipv4-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp. \
- --type=A \
- --ttl=2100 \
- "1.2.3.4"
-
-gcloud dns record-sets transaction add \
- -z=resolver-tests-version-4-grpctestingexp-zone-id \
- --name=srv-ipv4-target-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp. \
- --type=A \
- --ttl=2100 \
- "1.2.3.4"
-
-gcloud dns record-sets transaction add \
- -z=resolver-tests-version-4-grpctestingexp-zone-id \
- --name=_grpclb._tcp.srv-ipv6-target-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp. \
- --type=SRV \
- --ttl=2100 \
- "0 0 1234 balancer-for-ipv6-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp."
-
-gcloud dns record-sets transaction add \
- -z=resolver-tests-version-4-grpctestingexp-zone-id \
- --name=balancer-for-ipv6-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp. \
- --type=AAAA \
- --ttl=2100 \
- "2607:f8b0:400a:801::1002"
-
-gcloud dns record-sets transaction add \
- -z=resolver-tests-version-4-grpctestingexp-zone-id \
- --name=srv-ipv6-target-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp. \
- --type=AAAA \
- --ttl=2100 \
- "2607:f8b0:400a:801::1002"
-
-gcloud dns record-sets transaction describe -z=resolver-tests-version-4-grpctestingexp-zone-id
-gcloud dns record-sets transaction execute -z=resolver-tests-version-4-grpctestingexp-zone-id
-gcloud dns record-sets list -z=resolver-tests-version-4-grpctestingexp-zone-id
diff --git a/test/cpp/naming/resolver_component_tests_runner.py b/test/cpp/naming/resolver_component_tests_runner.py
new file mode 100755
index 0000000000..69386ebeb0
--- /dev/null
+++ b/test/cpp/naming/resolver_component_tests_runner.py
@@ -0,0 +1,275 @@
+#!/usr/bin/env python
+# 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.
+
+# This file is auto-generated
+
+import argparse
+import sys
+import subprocess
+import tempfile
+import os
+import time
+import signal
+
+
+argp = argparse.ArgumentParser(description='Run c-ares resolver tests')
+argp.add_argument('--test_bin_path', default=None, type=str,
+ help='Path to gtest test binary to invoke.')
+argp.add_argument('--dns_server_bin_path', default=None, type=str,
+ help='Path to local DNS server python script.')
+argp.add_argument('--records_config_path', default=None, type=str,
+ help=('Path to DNS records yaml file that '
+ 'specifies records for the DNS sever. '))
+argp.add_argument('--dns_server_port', default=None, type=int,
+ help=('Port that local DNS server is listening on.'))
+argp.add_argument('--dns_resolver_bin_path', default=None, type=str,
+ help=('Path to the DNS health check utility.'))
+argp.add_argument('--tcp_connect_bin_path', default=None, type=str,
+ help=('Path to the TCP health check utility.'))
+args = argp.parse_args()
+
+def test_runner_log(msg):
+ sys.stderr.write('\n%s: %s\n' % (__file__, msg))
+
+cur_resolver = os.environ.get('GRPC_DNS_RESOLVER')
+if cur_resolver and cur_resolver != 'ares':
+ test_runner_log(('WARNING: cur resolver set to %s. This set of tests '
+ 'needs to use GRPC_DNS_RESOLVER=ares.'))
+ test_runner_log('Exit 1 without running tests.')
+ sys.exit(1)
+os.environ.update({'GRPC_DNS_RESOLVER': 'ares'})
+
+def wait_until_dns_server_is_up(args,
+ dns_server_subprocess,
+ dns_server_subprocess_output):
+ for i in range(0, 30):
+ test_runner_log('Health check: attempt to connect to DNS server over TCP.')
+ tcp_connect_subprocess = subprocess.Popen([
+ args.tcp_connect_bin_path,
+ '--server_host', '127.0.0.1',
+ '--server_port', str(args.dns_server_port),
+ '--timeout', str(1)])
+ tcp_connect_subprocess.communicate()
+ if tcp_connect_subprocess.returncode == 0:
+ test_runner_log(('Health check: attempt to make an A-record '
+ 'query to DNS server.'))
+ dns_resolver_subprocess = subprocess.Popen([
+ args.dns_resolver_bin_path,
+ '--qname', 'health-check-local-dns-server-is-alive.resolver-tests.grpctestingexp',
+ '--server_host', '127.0.0.1',
+ '--server_port', str(args.dns_server_port)],
+ stdout=subprocess.PIPE)
+ dns_resolver_stdout, _ = dns_resolver_subprocess.communicate()
+ if dns_resolver_subprocess.returncode == 0:
+ if '123.123.123.123' in dns_resolver_stdout:
+ test_runner_log(('DNS server is up! '
+ 'Successfully reached it over UDP and TCP.'))
+ return
+ time.sleep(0.1)
+ dns_server_subprocess.kill()
+ dns_server_subprocess.wait()
+ test_runner_log(('Failed to reach DNS server over TCP and/or UDP. '
+ 'Exitting without running tests.'))
+ test_runner_log('======= DNS server stdout '
+ '(merged stdout and stderr) =============')
+ with open(dns_server_subprocess_output, 'r') as l:
+ test_runner_log(l.read())
+ test_runner_log('======= end DNS server output=========')
+ sys.exit(1)
+
+dns_server_subprocess_output = tempfile.mktemp()
+with open(dns_server_subprocess_output, 'w') as l:
+ dns_server_subprocess = subprocess.Popen([
+ args.dns_server_bin_path,
+ '--port', str(args.dns_server_port),
+ '--records_config_path', args.records_config_path],
+ stdin=subprocess.PIPE,
+ stdout=l,
+ stderr=l)
+
+def _quit_on_signal(signum, _frame):
+ test_runner_log('Received signal: %d' % signum)
+ dns_server_subprocess.kill()
+ dns_server_subprocess.wait()
+ sys.exit(1)
+
+signal.signal(signal.SIGINT, _quit_on_signal)
+signal.signal(signal.SIGTERM, _quit_on_signal)
+wait_until_dns_server_is_up(args,
+ dns_server_subprocess,
+ dns_server_subprocess_output)
+num_test_failures = 0
+
+test_runner_log('Run test with target: %s' % 'srv-ipv4-single-target.resolver-tests-version-4.grpctestingexp.')
+current_test_subprocess = subprocess.Popen([
+ args.test_bin_path,
+ '--target_name', 'srv-ipv4-single-target.resolver-tests-version-4.grpctestingexp.',
+ '--expected_addrs', '1.2.3.4:1234,True',
+ '--expected_chosen_service_config', '',
+ '--expected_lb_policy', '',
+ '--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
+current_test_subprocess.communicate()
+if current_test_subprocess.returncode != 0:
+ num_test_failures += 1
+
+test_runner_log('Run test with target: %s' % 'srv-ipv4-multi-target.resolver-tests-version-4.grpctestingexp.')
+current_test_subprocess = subprocess.Popen([
+ args.test_bin_path,
+ '--target_name', 'srv-ipv4-multi-target.resolver-tests-version-4.grpctestingexp.',
+ '--expected_addrs', '1.2.3.5:1234,True;1.2.3.6:1234,True;1.2.3.7:1234,True',
+ '--expected_chosen_service_config', '',
+ '--expected_lb_policy', '',
+ '--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
+current_test_subprocess.communicate()
+if current_test_subprocess.returncode != 0:
+ num_test_failures += 1
+
+test_runner_log('Run test with target: %s' % 'srv-ipv6-single-target.resolver-tests-version-4.grpctestingexp.')
+current_test_subprocess = subprocess.Popen([
+ args.test_bin_path,
+ '--target_name', 'srv-ipv6-single-target.resolver-tests-version-4.grpctestingexp.',
+ '--expected_addrs', '[2607:f8b0:400a:801::1001]:1234,True',
+ '--expected_chosen_service_config', '',
+ '--expected_lb_policy', '',
+ '--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
+current_test_subprocess.communicate()
+if current_test_subprocess.returncode != 0:
+ num_test_failures += 1
+
+test_runner_log('Run test with target: %s' % 'srv-ipv6-multi-target.resolver-tests-version-4.grpctestingexp.')
+current_test_subprocess = subprocess.Popen([
+ args.test_bin_path,
+ '--target_name', 'srv-ipv6-multi-target.resolver-tests-version-4.grpctestingexp.',
+ '--expected_addrs', '[2607:f8b0:400a:801::1002]:1234,True;[2607:f8b0:400a:801::1003]:1234,True;[2607:f8b0:400a:801::1004]:1234,True',
+ '--expected_chosen_service_config', '',
+ '--expected_lb_policy', '',
+ '--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
+current_test_subprocess.communicate()
+if current_test_subprocess.returncode != 0:
+ num_test_failures += 1
+
+test_runner_log('Run test with target: %s' % 'srv-ipv4-simple-service-config.resolver-tests-version-4.grpctestingexp.')
+current_test_subprocess = subprocess.Popen([
+ args.test_bin_path,
+ '--target_name', 'srv-ipv4-simple-service-config.resolver-tests-version-4.grpctestingexp.',
+ '--expected_addrs', '1.2.3.4:1234,True',
+ '--expected_chosen_service_config', '{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"SimpleService","waitForReady":true}]}]}',
+ '--expected_lb_policy', 'round_robin',
+ '--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
+current_test_subprocess.communicate()
+if current_test_subprocess.returncode != 0:
+ num_test_failures += 1
+
+test_runner_log('Run test with target: %s' % 'ipv4-no-srv-simple-service-config.resolver-tests-version-4.grpctestingexp.')
+current_test_subprocess = subprocess.Popen([
+ args.test_bin_path,
+ '--target_name', 'ipv4-no-srv-simple-service-config.resolver-tests-version-4.grpctestingexp.',
+ '--expected_addrs', '1.2.3.4:443,False',
+ '--expected_chosen_service_config', '{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"NoSrvSimpleService","waitForReady":true}]}]}',
+ '--expected_lb_policy', 'round_robin',
+ '--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
+current_test_subprocess.communicate()
+if current_test_subprocess.returncode != 0:
+ num_test_failures += 1
+
+test_runner_log('Run test with target: %s' % 'ipv4-no-config-for-cpp.resolver-tests-version-4.grpctestingexp.')
+current_test_subprocess = subprocess.Popen([
+ args.test_bin_path,
+ '--target_name', 'ipv4-no-config-for-cpp.resolver-tests-version-4.grpctestingexp.',
+ '--expected_addrs', '1.2.3.4:443,False',
+ '--expected_chosen_service_config', '',
+ '--expected_lb_policy', '',
+ '--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
+current_test_subprocess.communicate()
+if current_test_subprocess.returncode != 0:
+ num_test_failures += 1
+
+test_runner_log('Run test with target: %s' % 'ipv4-cpp-config-has-zero-percentage.resolver-tests-version-4.grpctestingexp.')
+current_test_subprocess = subprocess.Popen([
+ args.test_bin_path,
+ '--target_name', 'ipv4-cpp-config-has-zero-percentage.resolver-tests-version-4.grpctestingexp.',
+ '--expected_addrs', '1.2.3.4:443,False',
+ '--expected_chosen_service_config', '',
+ '--expected_lb_policy', '',
+ '--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
+current_test_subprocess.communicate()
+if current_test_subprocess.returncode != 0:
+ num_test_failures += 1
+
+test_runner_log('Run test with target: %s' % 'ipv4-second-language-is-cpp.resolver-tests-version-4.grpctestingexp.')
+current_test_subprocess = subprocess.Popen([
+ args.test_bin_path,
+ '--target_name', 'ipv4-second-language-is-cpp.resolver-tests-version-4.grpctestingexp.',
+ '--expected_addrs', '1.2.3.4:443,False',
+ '--expected_chosen_service_config', '{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"CppService","waitForReady":true}]}]}',
+ '--expected_lb_policy', 'round_robin',
+ '--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
+current_test_subprocess.communicate()
+if current_test_subprocess.returncode != 0:
+ num_test_failures += 1
+
+test_runner_log('Run test with target: %s' % 'ipv4-config-with-percentages.resolver-tests-version-4.grpctestingexp.')
+current_test_subprocess = subprocess.Popen([
+ args.test_bin_path,
+ '--target_name', 'ipv4-config-with-percentages.resolver-tests-version-4.grpctestingexp.',
+ '--expected_addrs', '1.2.3.4:443,False',
+ '--expected_chosen_service_config', '{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"AlwaysPickedService","waitForReady":true}]}]}',
+ '--expected_lb_policy', 'round_robin',
+ '--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
+current_test_subprocess.communicate()
+if current_test_subprocess.returncode != 0:
+ num_test_failures += 1
+
+test_runner_log('Run test with target: %s' % 'srv-ipv4-target-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp.')
+current_test_subprocess = subprocess.Popen([
+ args.test_bin_path,
+ '--target_name', 'srv-ipv4-target-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp.',
+ '--expected_addrs', '1.2.3.4:1234,True;1.2.3.4:443,False',
+ '--expected_chosen_service_config', '',
+ '--expected_lb_policy', '',
+ '--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
+current_test_subprocess.communicate()
+if current_test_subprocess.returncode != 0:
+ num_test_failures += 1
+
+test_runner_log('Run test with target: %s' % 'srv-ipv6-target-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp.')
+current_test_subprocess = subprocess.Popen([
+ args.test_bin_path,
+ '--target_name', 'srv-ipv6-target-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp.',
+ '--expected_addrs', '[2607:f8b0:400a:801::1002]:1234,True;[2607:f8b0:400a:801::1002]:443,False',
+ '--expected_chosen_service_config', '',
+ '--expected_lb_policy', '',
+ '--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
+current_test_subprocess.communicate()
+if current_test_subprocess.returncode != 0:
+ num_test_failures += 1
+
+test_runner_log('Run test with target: %s' % 'ipv4-config-causing-fallback-to-tcp.resolver-tests-version-4.grpctestingexp.')
+current_test_subprocess = subprocess.Popen([
+ args.test_bin_path,
+ '--target_name', 'ipv4-config-causing-fallback-to-tcp.resolver-tests-version-4.grpctestingexp.',
+ '--expected_addrs', '1.2.3.4:443,False',
+ '--expected_chosen_service_config', '{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwo","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooThree","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooFour","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooFive","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooSix","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooSeven","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooEight","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooNine","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTen","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooEleven","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwelve","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwelve","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwelve","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwelve","service":"SimpleService","waitForReady":true}]}]}',
+ '--expected_lb_policy', '',
+ '--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
+current_test_subprocess.communicate()
+if current_test_subprocess.returncode != 0:
+ num_test_failures += 1
+
+test_runner_log('now kill DNS server')
+dns_server_subprocess.kill()
+dns_server_subprocess.wait()
+test_runner_log('%d tests failed.' % num_test_failures)
+sys.exit(num_test_failures)
diff --git a/test/cpp/naming/resolver_component_tests_runner.sh b/test/cpp/naming/resolver_component_tests_runner.sh
deleted file mode 100755
index 3f8765fa94..0000000000
--- a/test/cpp/naming/resolver_component_tests_runner.sh
+++ /dev/null
@@ -1,187 +0,0 @@
-#!/bin/bash
-# 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.
-
-# This file is auto-generated
-
-set -ex
-
-# all command args required in this set order
-FLAGS_test_bin_path=$(echo "$1" | grep '\--test_bin_path=' | sed 's/^--test_bin_path=//')
-FLAGS_dns_server_bin_path=$(echo "$2" | grep '\--dns_server_bin_path=' | sed 's/^--dns_server_bin_path=//')
-FLAGS_records_config_path=$(echo "$3" | grep '\--records_config_path=' | sed 's/^--records_config_path=//')
-FLAGS_dns_server_port=$(echo "$4" | grep '\--dns_server_port=' | sed 's/^--dns_server_port=//')
-FLAGS_dns_resolver_bin_path=$(echo "$5" | grep '\--dns_resolver_bin_path=' | sed 's/^--dns_resolver_bin_path=//')
-FLAGS_tcp_connect_bin_path=$(echo "$6" | grep '\--tcp_connect_bin_path=' | sed 's/^--tcp_connect_bin_path=//')
-
-for cmd_arg in "$FLAGS_test_bin_path" "$FLAGS_dns_server_bin_path" "$FLAGS_records_config_path" "$FLAGS_dns_server_port" "$FLAGS_dns_resolver_bin_path" "$FLAGS_tcp_connect_bin_path"; do
- if [[ "$cmd_arg" == "" ]]; then
- echo "Missing a CMD arg" && exit 1
- fi
-done
-
-if [[ "$GRPC_DNS_RESOLVER" != "" && "$GRPC_DNS_RESOLVER" != ares ]]; then
- echo "This test only works under GRPC_DNS_RESOLVER=ares. Have GRPC_DNS_RESOLVER=$GRPC_DNS_RESOLVER" && exit 1
-fi
-export GRPC_DNS_RESOLVER=ares
-
-DNS_SERVER_LOG="$(mktemp)"
-"$FLAGS_dns_server_bin_path" --records_config_path="$FLAGS_records_config_path" --port="$FLAGS_dns_server_port" > "$DNS_SERVER_LOG" 2>&1 &
-DNS_SERVER_PID=$!
-echo "Local DNS server started. PID: $DNS_SERVER_PID"
-
-# Health check local DNS server TCP and UDP ports
-for ((i=0;i<30;i++));
-do
- echo "Retry health-check local DNS server by attempting a DNS query and TCP handshake"
- RETRY=0
- $FLAGS_dns_resolver_bin_path -s 127.0.0.1 -p "$FLAGS_dns_server_port" -n health-check-local-dns-server-is-alive.resolver-tests.grpctestingexp. -t 1 | grep '123.123.123.123' || RETRY=1
- $FLAGS_tcp_connect_bin_path -s 127.0.0.1 -p "$FLAGS_dns_server_port" -t 1 || RETRY=1
- if [[ "$RETRY" == 0 ]]; then
- break
- fi;
- sleep 0.1
-done
-
-if [[ $RETRY == 1 ]]; then
- echo "FAILED TO START LOCAL DNS SERVER"
- kill -SIGTERM "$DNS_SERVER_PID" || true
- wait
- echo "========== DNS server log (merged stdout and stderr) ========="
- cat "$DNS_SERVER_LOG"
- echo "========== end DNS server log ================================"
- exit 1
-fi
-
-function terminate_all {
- echo "Received signal. Terminating $! and $DNS_SERVER_PID"
- kill -SIGTERM "$!" || true
- kill -SIGTERM "$DNS_SERVER_PID" || true
- wait
- exit 1
-}
-
-trap terminate_all SIGTERM SIGINT
-
-EXIT_CODE=0
-# TODO: this test should check for GCE residency and skip tests using _grpclb._tcp.* SRV records once GCE residency checks are made
-# in the resolver.
-
-$FLAGS_test_bin_path \
- --target_name='srv-ipv4-single-target.resolver-tests-version-4.grpctestingexp.' \
- --expected_addrs='1.2.3.4:1234,True' \
- --expected_chosen_service_config='' \
- --expected_lb_policy='' \
- --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" &
-wait "$!" || EXIT_CODE=1
-
-$FLAGS_test_bin_path \
- --target_name='srv-ipv4-multi-target.resolver-tests-version-4.grpctestingexp.' \
- --expected_addrs='1.2.3.5:1234,True;1.2.3.6:1234,True;1.2.3.7:1234,True' \
- --expected_chosen_service_config='' \
- --expected_lb_policy='' \
- --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" &
-wait "$!" || EXIT_CODE=1
-
-$FLAGS_test_bin_path \
- --target_name='srv-ipv6-single-target.resolver-tests-version-4.grpctestingexp.' \
- --expected_addrs='[2607:f8b0:400a:801::1001]:1234,True' \
- --expected_chosen_service_config='' \
- --expected_lb_policy='' \
- --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" &
-wait "$!" || EXIT_CODE=1
-
-$FLAGS_test_bin_path \
- --target_name='srv-ipv6-multi-target.resolver-tests-version-4.grpctestingexp.' \
- --expected_addrs='[2607:f8b0:400a:801::1002]:1234,True;[2607:f8b0:400a:801::1003]:1234,True;[2607:f8b0:400a:801::1004]:1234,True' \
- --expected_chosen_service_config='' \
- --expected_lb_policy='' \
- --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" &
-wait "$!" || EXIT_CODE=1
-
-$FLAGS_test_bin_path \
- --target_name='srv-ipv4-simple-service-config.resolver-tests-version-4.grpctestingexp.' \
- --expected_addrs='1.2.3.4:1234,True' \
- --expected_chosen_service_config='{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"SimpleService","waitForReady":true}]}]}' \
- --expected_lb_policy='round_robin' \
- --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" &
-wait "$!" || EXIT_CODE=1
-
-$FLAGS_test_bin_path \
- --target_name='ipv4-no-srv-simple-service-config.resolver-tests-version-4.grpctestingexp.' \
- --expected_addrs='1.2.3.4:443,False' \
- --expected_chosen_service_config='{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"NoSrvSimpleService","waitForReady":true}]}]}' \
- --expected_lb_policy='round_robin' \
- --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" &
-wait "$!" || EXIT_CODE=1
-
-$FLAGS_test_bin_path \
- --target_name='ipv4-no-config-for-cpp.resolver-tests-version-4.grpctestingexp.' \
- --expected_addrs='1.2.3.4:443,False' \
- --expected_chosen_service_config='' \
- --expected_lb_policy='' \
- --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" &
-wait "$!" || EXIT_CODE=1
-
-$FLAGS_test_bin_path \
- --target_name='ipv4-cpp-config-has-zero-percentage.resolver-tests-version-4.grpctestingexp.' \
- --expected_addrs='1.2.3.4:443,False' \
- --expected_chosen_service_config='' \
- --expected_lb_policy='' \
- --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" &
-wait "$!" || EXIT_CODE=1
-
-$FLAGS_test_bin_path \
- --target_name='ipv4-second-language-is-cpp.resolver-tests-version-4.grpctestingexp.' \
- --expected_addrs='1.2.3.4:443,False' \
- --expected_chosen_service_config='{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"CppService","waitForReady":true}]}]}' \
- --expected_lb_policy='round_robin' \
- --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" &
-wait "$!" || EXIT_CODE=1
-
-$FLAGS_test_bin_path \
- --target_name='ipv4-config-with-percentages.resolver-tests-version-4.grpctestingexp.' \
- --expected_addrs='1.2.3.4:443,False' \
- --expected_chosen_service_config='{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"AlwaysPickedService","waitForReady":true}]}]}' \
- --expected_lb_policy='round_robin' \
- --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" &
-wait "$!" || EXIT_CODE=1
-
-$FLAGS_test_bin_path \
- --target_name='srv-ipv4-target-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp.' \
- --expected_addrs='1.2.3.4:1234,True;1.2.3.4:443,False' \
- --expected_chosen_service_config='' \
- --expected_lb_policy='' \
- --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" &
-wait "$!" || EXIT_CODE=1
-
-$FLAGS_test_bin_path \
- --target_name='srv-ipv6-target-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp.' \
- --expected_addrs='[2607:f8b0:400a:801::1002]:1234,True;[2607:f8b0:400a:801::1002]:443,False' \
- --expected_chosen_service_config='' \
- --expected_lb_policy='' \
- --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" &
-wait "$!" || EXIT_CODE=1
-
-$FLAGS_test_bin_path \
- --target_name='ipv4-config-causing-fallback-to-tcp.resolver-tests-version-4.grpctestingexp.' \
- --expected_addrs='1.2.3.4:443,False' \
- --expected_chosen_service_config='{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwo","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooThree","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooFour","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooFive","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooSix","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooSeven","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooEight","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooNine","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTen","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooEleven","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwelve","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwelve","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwelve","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwelve","service":"SimpleService","waitForReady":true}]}]}' \
- --expected_lb_policy='' \
- --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" &
-wait "$!" || EXIT_CODE=1
-
-kill -SIGTERM "$DNS_SERVER_PID" || true
-wait
-exit $EXIT_CODE
diff --git a/test/cpp/naming/resolver_component_tests_runner_invoker.cc b/test/cpp/naming/resolver_component_tests_runner_invoker.cc
index 6d0708e2f2..45c1029caa 100644
--- a/test/cpp/naming/resolver_component_tests_runner_invoker.cc
+++ b/test/cpp/naming/resolver_component_tests_runner_invoker.cc
@@ -184,7 +184,7 @@ int main(int argc, char** argv) {
std::string const bin_dir = my_bin.substr(0, my_bin.rfind('/'));
// Invoke the .sh and .py scripts directly where they are in source code.
grpc::testing::InvokeResolverComponentTestsRunner(
- "test/cpp/naming/resolver_component_tests_runner.sh",
+ "test/cpp/naming/resolver_component_tests_runner.py",
bin_dir + "/" + FLAGS_test_bin_name,
"test/cpp/naming/utils/dns_server.py",
"test/cpp/naming/resolver_test_record_groups.yaml",
diff --git a/test/cpp/naming/resolver_gce_integration_tests_runner.sh b/test/cpp/naming/resolver_gce_integration_tests_runner.sh
deleted file mode 100755
index 2f673a59fd..0000000000
--- a/test/cpp/naming/resolver_gce_integration_tests_runner.sh
+++ /dev/null
@@ -1,359 +0,0 @@
-#!/bin/bash
-# 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.
-
-# This file is auto-generated
-
-set -ex
-
-if [[ "$GRPC_DNS_RESOLVER" == "" ]]; then
- export GRPC_DNS_RESOLVER=ares
-elif [[ "$GRPC_DNS_RESOLVER" != ares ]]; then
- echo "Unexpected: GRPC_DNS_RESOLVER=$GRPC_DNS_RESOLVER. This test only works with c-ares resolver"
- exit 1
-fi
-
-cd "$(dirname "$0")/../../.."
-
-if [[ "$CONFIG" == "" ]]; then
- export CONFIG=opt
-fi
-make resolver_component_test
-echo "Sanity check DNS records are resolveable with dig:"
-EXIT_CODE=0
-
-ONE_FAILED=0
-dig SRV _grpclb._tcp.srv-ipv4-single-target.resolver-tests-version-4.grpctestingexp. | grep 'ANSWER SECTION' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Sanity check: dig SRV _grpclb._tcp.srv-ipv4-single-target.resolver-tests-version-4.grpctestingexp. FAILED"
- exit 1
-fi
-
-ONE_FAILED=0
-dig A ipv4-single-target.resolver-tests-version-4.grpctestingexp. | grep 'ANSWER SECTION' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Sanity check: dig A ipv4-single-target.resolver-tests-version-4.grpctestingexp. FAILED"
- exit 1
-fi
-
-ONE_FAILED=0
-dig SRV _grpclb._tcp.srv-ipv4-multi-target.resolver-tests-version-4.grpctestingexp. | grep 'ANSWER SECTION' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Sanity check: dig SRV _grpclb._tcp.srv-ipv4-multi-target.resolver-tests-version-4.grpctestingexp. FAILED"
- exit 1
-fi
-
-ONE_FAILED=0
-dig A ipv4-multi-target.resolver-tests-version-4.grpctestingexp. | grep 'ANSWER SECTION' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Sanity check: dig A ipv4-multi-target.resolver-tests-version-4.grpctestingexp. FAILED"
- exit 1
-fi
-
-ONE_FAILED=0
-dig SRV _grpclb._tcp.srv-ipv6-single-target.resolver-tests-version-4.grpctestingexp. | grep 'ANSWER SECTION' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Sanity check: dig SRV _grpclb._tcp.srv-ipv6-single-target.resolver-tests-version-4.grpctestingexp. FAILED"
- exit 1
-fi
-
-ONE_FAILED=0
-dig AAAA ipv6-single-target.resolver-tests-version-4.grpctestingexp. | grep 'ANSWER SECTION' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Sanity check: dig AAAA ipv6-single-target.resolver-tests-version-4.grpctestingexp. FAILED"
- exit 1
-fi
-
-ONE_FAILED=0
-dig SRV _grpclb._tcp.srv-ipv6-multi-target.resolver-tests-version-4.grpctestingexp. | grep 'ANSWER SECTION' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Sanity check: dig SRV _grpclb._tcp.srv-ipv6-multi-target.resolver-tests-version-4.grpctestingexp. FAILED"
- exit 1
-fi
-
-ONE_FAILED=0
-dig AAAA ipv6-multi-target.resolver-tests-version-4.grpctestingexp. | grep 'ANSWER SECTION' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Sanity check: dig AAAA ipv6-multi-target.resolver-tests-version-4.grpctestingexp. FAILED"
- exit 1
-fi
-
-ONE_FAILED=0
-dig TXT _grpc_config.srv-ipv4-simple-service-config.resolver-tests-version-4.grpctestingexp. | grep 'ANSWER SECTION' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Sanity check: dig TXT _grpc_config.srv-ipv4-simple-service-config.resolver-tests-version-4.grpctestingexp. FAILED"
- exit 1
-fi
-
-ONE_FAILED=0
-dig SRV _grpclb._tcp.srv-ipv4-simple-service-config.resolver-tests-version-4.grpctestingexp. | grep 'ANSWER SECTION' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Sanity check: dig SRV _grpclb._tcp.srv-ipv4-simple-service-config.resolver-tests-version-4.grpctestingexp. FAILED"
- exit 1
-fi
-
-ONE_FAILED=0
-dig A ipv4-simple-service-config.resolver-tests-version-4.grpctestingexp. | grep 'ANSWER SECTION' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Sanity check: dig A ipv4-simple-service-config.resolver-tests-version-4.grpctestingexp. FAILED"
- exit 1
-fi
-
-ONE_FAILED=0
-dig A ipv4-no-srv-simple-service-config.resolver-tests-version-4.grpctestingexp. | grep 'ANSWER SECTION' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Sanity check: dig A ipv4-no-srv-simple-service-config.resolver-tests-version-4.grpctestingexp. FAILED"
- exit 1
-fi
-
-ONE_FAILED=0
-dig TXT _grpc_config.ipv4-no-srv-simple-service-config.resolver-tests-version-4.grpctestingexp. | grep 'ANSWER SECTION' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Sanity check: dig TXT _grpc_config.ipv4-no-srv-simple-service-config.resolver-tests-version-4.grpctestingexp. FAILED"
- exit 1
-fi
-
-ONE_FAILED=0
-dig TXT _grpc_config.ipv4-no-config-for-cpp.resolver-tests-version-4.grpctestingexp. | grep 'ANSWER SECTION' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Sanity check: dig TXT _grpc_config.ipv4-no-config-for-cpp.resolver-tests-version-4.grpctestingexp. FAILED"
- exit 1
-fi
-
-ONE_FAILED=0
-dig A ipv4-no-config-for-cpp.resolver-tests-version-4.grpctestingexp. | grep 'ANSWER SECTION' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Sanity check: dig A ipv4-no-config-for-cpp.resolver-tests-version-4.grpctestingexp. FAILED"
- exit 1
-fi
-
-ONE_FAILED=0
-dig A ipv4-cpp-config-has-zero-percentage.resolver-tests-version-4.grpctestingexp. | grep 'ANSWER SECTION' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Sanity check: dig A ipv4-cpp-config-has-zero-percentage.resolver-tests-version-4.grpctestingexp. FAILED"
- exit 1
-fi
-
-ONE_FAILED=0
-dig TXT _grpc_config.ipv4-cpp-config-has-zero-percentage.resolver-tests-version-4.grpctestingexp. | grep 'ANSWER SECTION' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Sanity check: dig TXT _grpc_config.ipv4-cpp-config-has-zero-percentage.resolver-tests-version-4.grpctestingexp. FAILED"
- exit 1
-fi
-
-ONE_FAILED=0
-dig TXT _grpc_config.ipv4-second-language-is-cpp.resolver-tests-version-4.grpctestingexp. | grep 'ANSWER SECTION' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Sanity check: dig TXT _grpc_config.ipv4-second-language-is-cpp.resolver-tests-version-4.grpctestingexp. FAILED"
- exit 1
-fi
-
-ONE_FAILED=0
-dig A ipv4-second-language-is-cpp.resolver-tests-version-4.grpctestingexp. | grep 'ANSWER SECTION' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Sanity check: dig A ipv4-second-language-is-cpp.resolver-tests-version-4.grpctestingexp. FAILED"
- exit 1
-fi
-
-ONE_FAILED=0
-dig A ipv4-config-with-percentages.resolver-tests-version-4.grpctestingexp. | grep 'ANSWER SECTION' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Sanity check: dig A ipv4-config-with-percentages.resolver-tests-version-4.grpctestingexp. FAILED"
- exit 1
-fi
-
-ONE_FAILED=0
-dig TXT _grpc_config.ipv4-config-with-percentages.resolver-tests-version-4.grpctestingexp. | grep 'ANSWER SECTION' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Sanity check: dig TXT _grpc_config.ipv4-config-with-percentages.resolver-tests-version-4.grpctestingexp. FAILED"
- exit 1
-fi
-
-ONE_FAILED=0
-dig SRV _grpclb._tcp.srv-ipv4-target-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp. | grep 'ANSWER SECTION' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Sanity check: dig SRV _grpclb._tcp.srv-ipv4-target-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp. FAILED"
- exit 1
-fi
-
-ONE_FAILED=0
-dig A balancer-for-ipv4-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp. | grep 'ANSWER SECTION' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Sanity check: dig A balancer-for-ipv4-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp. FAILED"
- exit 1
-fi
-
-ONE_FAILED=0
-dig A srv-ipv4-target-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp. | grep 'ANSWER SECTION' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Sanity check: dig A srv-ipv4-target-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp. FAILED"
- exit 1
-fi
-
-ONE_FAILED=0
-dig SRV _grpclb._tcp.srv-ipv6-target-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp. | grep 'ANSWER SECTION' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Sanity check: dig SRV _grpclb._tcp.srv-ipv6-target-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp. FAILED"
- exit 1
-fi
-
-ONE_FAILED=0
-dig AAAA balancer-for-ipv6-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp. | grep 'ANSWER SECTION' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Sanity check: dig AAAA balancer-for-ipv6-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp. FAILED"
- exit 1
-fi
-
-ONE_FAILED=0
-dig AAAA srv-ipv6-target-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp. | grep 'ANSWER SECTION' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Sanity check: dig AAAA srv-ipv6-target-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp. FAILED"
- exit 1
-fi
-
-echo "Sanity check PASSED. Run resolver tests:"
-
-ONE_FAILED=0
-bins/$CONFIG/resolver_component_test \
- --target_name='srv-ipv4-single-target.resolver-tests-version-4.grpctestingexp.' \
- --expected_addrs='1.2.3.4:1234,True' \
- --expected_chosen_service_config='' \
- --expected_lb_policy='' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Test based on target record: srv-ipv4-single-target.resolver-tests-version-4.grpctestingexp. FAILED"
- EXIT_CODE=1
-fi
-
-ONE_FAILED=0
-bins/$CONFIG/resolver_component_test \
- --target_name='srv-ipv4-multi-target.resolver-tests-version-4.grpctestingexp.' \
- --expected_addrs='1.2.3.5:1234,True;1.2.3.6:1234,True;1.2.3.7:1234,True' \
- --expected_chosen_service_config='' \
- --expected_lb_policy='' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Test based on target record: srv-ipv4-multi-target.resolver-tests-version-4.grpctestingexp. FAILED"
- EXIT_CODE=1
-fi
-
-ONE_FAILED=0
-bins/$CONFIG/resolver_component_test \
- --target_name='srv-ipv6-single-target.resolver-tests-version-4.grpctestingexp.' \
- --expected_addrs='[2607:f8b0:400a:801::1001]:1234,True' \
- --expected_chosen_service_config='' \
- --expected_lb_policy='' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Test based on target record: srv-ipv6-single-target.resolver-tests-version-4.grpctestingexp. FAILED"
- EXIT_CODE=1
-fi
-
-ONE_FAILED=0
-bins/$CONFIG/resolver_component_test \
- --target_name='srv-ipv6-multi-target.resolver-tests-version-4.grpctestingexp.' \
- --expected_addrs='[2607:f8b0:400a:801::1002]:1234,True;[2607:f8b0:400a:801::1003]:1234,True;[2607:f8b0:400a:801::1004]:1234,True' \
- --expected_chosen_service_config='' \
- --expected_lb_policy='' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Test based on target record: srv-ipv6-multi-target.resolver-tests-version-4.grpctestingexp. FAILED"
- EXIT_CODE=1
-fi
-
-ONE_FAILED=0
-bins/$CONFIG/resolver_component_test \
- --target_name='srv-ipv4-simple-service-config.resolver-tests-version-4.grpctestingexp.' \
- --expected_addrs='1.2.3.4:1234,True' \
- --expected_chosen_service_config='{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"SimpleService","waitForReady":true}]}]}' \
- --expected_lb_policy='round_robin' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Test based on target record: srv-ipv4-simple-service-config.resolver-tests-version-4.grpctestingexp. FAILED"
- EXIT_CODE=1
-fi
-
-ONE_FAILED=0
-bins/$CONFIG/resolver_component_test \
- --target_name='ipv4-no-srv-simple-service-config.resolver-tests-version-4.grpctestingexp.' \
- --expected_addrs='1.2.3.4:443,False' \
- --expected_chosen_service_config='{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"NoSrvSimpleService","waitForReady":true}]}]}' \
- --expected_lb_policy='round_robin' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Test based on target record: ipv4-no-srv-simple-service-config.resolver-tests-version-4.grpctestingexp. FAILED"
- EXIT_CODE=1
-fi
-
-ONE_FAILED=0
-bins/$CONFIG/resolver_component_test \
- --target_name='ipv4-no-config-for-cpp.resolver-tests-version-4.grpctestingexp.' \
- --expected_addrs='1.2.3.4:443,False' \
- --expected_chosen_service_config='' \
- --expected_lb_policy='' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Test based on target record: ipv4-no-config-for-cpp.resolver-tests-version-4.grpctestingexp. FAILED"
- EXIT_CODE=1
-fi
-
-ONE_FAILED=0
-bins/$CONFIG/resolver_component_test \
- --target_name='ipv4-cpp-config-has-zero-percentage.resolver-tests-version-4.grpctestingexp.' \
- --expected_addrs='1.2.3.4:443,False' \
- --expected_chosen_service_config='' \
- --expected_lb_policy='' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Test based on target record: ipv4-cpp-config-has-zero-percentage.resolver-tests-version-4.grpctestingexp. FAILED"
- EXIT_CODE=1
-fi
-
-ONE_FAILED=0
-bins/$CONFIG/resolver_component_test \
- --target_name='ipv4-second-language-is-cpp.resolver-tests-version-4.grpctestingexp.' \
- --expected_addrs='1.2.3.4:443,False' \
- --expected_chosen_service_config='{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"CppService","waitForReady":true}]}]}' \
- --expected_lb_policy='round_robin' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Test based on target record: ipv4-second-language-is-cpp.resolver-tests-version-4.grpctestingexp. FAILED"
- EXIT_CODE=1
-fi
-
-ONE_FAILED=0
-bins/$CONFIG/resolver_component_test \
- --target_name='ipv4-config-with-percentages.resolver-tests-version-4.grpctestingexp.' \
- --expected_addrs='1.2.3.4:443,False' \
- --expected_chosen_service_config='{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"AlwaysPickedService","waitForReady":true}]}]}' \
- --expected_lb_policy='round_robin' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Test based on target record: ipv4-config-with-percentages.resolver-tests-version-4.grpctestingexp. FAILED"
- EXIT_CODE=1
-fi
-
-ONE_FAILED=0
-bins/$CONFIG/resolver_component_test \
- --target_name='srv-ipv4-target-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp.' \
- --expected_addrs='1.2.3.4:1234,True;1.2.3.4:443,False' \
- --expected_chosen_service_config='' \
- --expected_lb_policy='' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Test based on target record: srv-ipv4-target-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp. FAILED"
- EXIT_CODE=1
-fi
-
-ONE_FAILED=0
-bins/$CONFIG/resolver_component_test \
- --target_name='srv-ipv6-target-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp.' \
- --expected_addrs='[2607:f8b0:400a:801::1002]:1234,True;[2607:f8b0:400a:801::1002]:443,False' \
- --expected_chosen_service_config='' \
- --expected_lb_policy='' || ONE_FAILED=1
-if [[ "$ONE_FAILED" != 0 ]]; then
- echo "Test based on target record: srv-ipv6-target-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp. FAILED"
- EXIT_CODE=1
-fi
-
-exit $EXIT_CODE
diff --git a/test/cpp/naming/utils/dns_resolver.py b/test/cpp/naming/utils/dns_resolver.py
index 6b272444e7..74f4ca2351 100755
--- a/test/cpp/naming/utils/dns_resolver.py
+++ b/test/cpp/naming/utils/dns_resolver.py
@@ -16,9 +16,12 @@
"""Makes DNS queries for A records to specified servers"""
import argparse
-import signal
+import threading
+import time
import twisted.internet.task as task
import twisted.names.client as client
+import twisted.internet.reactor as reactor
+
def main():
argp = argparse.ArgumentParser(description='Make DNS queries for A records')
@@ -31,7 +34,6 @@ def main():
argp.add_argument('-t', '--timeout', default=1, type=int,
help=('Force process exit after this number of seconds.'))
args = argp.parse_args()
- signal.alarm(args.timeout)
def OnResolverResultAvailable(result):
answers, authority, additional = result
for a in answers:
diff --git a/test/cpp/naming/utils/dns_server.py b/test/cpp/naming/utils/dns_server.py
index 9f42f65ee6..1e8e2e3287 100755
--- a/test/cpp/naming/utils/dns_server.py
+++ b/test/cpp/naming/utils/dns_server.py
@@ -20,6 +20,8 @@ import sys
import yaml
import signal
import os
+import threading
+import time
import twisted
import twisted.internet
@@ -33,6 +35,7 @@ import twisted.names.dns
import twisted.names.server
from twisted.names import client, server, common, authority, dns
import argparse
+import platform
_SERVER_HEALTH_CHECK_RECORD_NAME = 'health-check-local-dns-server-is-alive.resolver-tests.grpctestingexp' # missing end '.' for twisted syntax
_SERVER_HEALTH_CHECK_RECORD_DATA = '123.123.123.123'
@@ -115,6 +118,18 @@ def _quit_on_signal(signum, _frame):
sys.stdout.flush()
sys.exit(0)
+def flush_stdout_loop():
+ num_timeouts_so_far = 0
+ sleep_time = 1
+ # Prevent zombies. Tests that use this server are short-lived.
+ max_timeouts = 60 * 2
+ while num_timeouts_so_far < max_timeouts:
+ sys.stdout.flush()
+ time.sleep(sleep_time)
+ num_timeouts_so_far += 1
+ print('Process timeout reached, or cancelled. Exitting 0.')
+ os.kill(os.getpid(), signal.SIGTERM)
+
def main():
argp = argparse.ArgumentParser(description='Local DNS Server for resolver tests')
argp.add_argument('-p', '--port', default=None, type=int,
@@ -123,11 +138,11 @@ def main():
help=('Directory of resolver_test_record_groups.yaml file. '
'Defauls to path needed when the test is invoked as part of run_tests.py.'))
args = argp.parse_args()
- signal.signal(signal.SIGALRM, _quit_on_signal)
signal.signal(signal.SIGTERM, _quit_on_signal)
signal.signal(signal.SIGINT, _quit_on_signal)
- # Prevent zombies. Tests that use this server are short-lived.
- signal.alarm(2 * 60)
+ output_flush_thread = threading.Thread(target=flush_stdout_loop)
+ output_flush_thread.setDaemon(True)
+ output_flush_thread.start()
start_local_dns_server(args)
if __name__ == '__main__':
diff --git a/test/cpp/naming/utils/tcp_connect.py b/test/cpp/naming/utils/tcp_connect.py
index bf7455e3c2..5773c7cae8 100755
--- a/test/cpp/naming/utils/tcp_connect.py
+++ b/test/cpp/naming/utils/tcp_connect.py
@@ -16,8 +16,11 @@
"""Opens a TCP connection to a specified server and then exits."""
import argparse
-import signal
import socket
+import threading
+import time
+import sys
+
def main():
argp = argparse.ArgumentParser(description='Open a TCP handshake to a server')
@@ -28,7 +31,6 @@ def main():
argp.add_argument('-t', '--timeout', default=1, type=int,
help='Force process exit after this number of seconds.')
args = argp.parse_args()
- signal.alarm(args.timeout)
socket.create_connection([args.server_host, args.server_port])
if __name__ == '__main__':
diff --git a/test/cpp/qps/BUILD b/test/cpp/qps/BUILD
index f1abb19e64..a348b88079 100644
--- a/test/cpp/qps/BUILD
+++ b/test/cpp/qps/BUILD
@@ -47,9 +47,10 @@ grpc_cc_library(
"//:grpc",
"//:grpc++",
"//:grpc++_core_stats",
+ "//src/proto/grpc/testing:benchmark_service_proto",
"//src/proto/grpc/testing:control_proto",
"//src/proto/grpc/testing:payloads_proto",
- "//src/proto/grpc/testing:services_proto",
+ "//src/proto/grpc/testing:worker_service_proto",
"//test/core/end2end:ssl_test_data",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
@@ -74,7 +75,8 @@ grpc_cc_library(
"//:grpc++",
"//src/proto/grpc/testing:control_proto",
"//src/proto/grpc/testing:messages_proto",
- "//src/proto/grpc/testing:services_proto",
+ "//src/proto/grpc/testing:report_qps_scenario_service_proto",
+ "//src/proto/grpc/testing:worker_service_proto",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
"//test/cpp/util:test_util",
diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h
index 77743a1dee..31ae6ca1fb 100644
--- a/test/cpp/qps/client.h
+++ b/test/cpp/qps/client.h
@@ -31,8 +31,8 @@
#include <grpcpp/support/channel_arguments.h>
#include <grpcpp/support/slice.h>
+#include "src/proto/grpc/testing/benchmark_service.grpc.pb.h"
#include "src/proto/grpc/testing/payloads.pb.h"
-#include "src/proto/grpc/testing/services.grpc.pb.h"
#include "src/cpp/util/core_stats.h"
#include "test/cpp/qps/histogram.h"
diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc
index f9bef91da0..c79a10d1b4 100644
--- a/test/cpp/qps/client_async.cc
+++ b/test/cpp/qps/client_async.cc
@@ -35,7 +35,7 @@
#include <grpcpp/generic/generic_stub.h>
#include "src/core/lib/surface/completion_queue.h"
-#include "src/proto/grpc/testing/services.grpc.pb.h"
+#include "src/proto/grpc/testing/benchmark_service.grpc.pb.h"
#include "test/cpp/qps/client.h"
#include "test/cpp/qps/usage_timer.h"
#include "test/cpp/util/create_test_channel.h"
diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc
index 5185eef710..e65e3b43f3 100644
--- a/test/cpp/qps/client_sync.cc
+++ b/test/cpp/qps/client_sync.cc
@@ -35,7 +35,7 @@
#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/profiling/timers.h"
-#include "src/proto/grpc/testing/services.grpc.pb.h"
+#include "src/proto/grpc/testing/benchmark_service.grpc.pb.h"
#include "test/cpp/qps/client.h"
#include "test/cpp/qps/interarrival.h"
#include "test/cpp/qps/usage_timer.h"
diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc
index 361ee4346f..34f1291576 100644
--- a/test/cpp/qps/driver.cc
+++ b/test/cpp/qps/driver.cc
@@ -33,6 +33,7 @@
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/profiling/timers.h"
+#include "src/proto/grpc/testing/worker_service.grpc.pb.h"
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
#include "test/cpp/qps/client.h"
diff --git a/test/cpp/qps/gen_build_yaml.py b/test/cpp/qps/gen_build_yaml.py
index 1ef8f65b0b..776283c25a 100755
--- a/test/cpp/qps/gen_build_yaml.py
+++ b/test/cpp/qps/gen_build_yaml.py
@@ -63,6 +63,11 @@ def guess_cpu(scenario_json, is_tsan):
return (scenario_json['num_clients'] * client +
scenario_json['num_servers'] * server)
+def maybe_exclude_gcov(scenario_json):
+ if scenario_json['client_config']['client_channels'] > 100:
+ return ['gcov']
+ return []
+
print yaml.dump({
'tests': [
{
@@ -76,7 +81,7 @@ print yaml.dump({
'boringssl': True,
'defaults': 'boringssl',
'cpu_cost': guess_cpu(scenario_json, False),
- 'exclude_configs': ['tsan', 'asan'],
+ 'exclude_configs': ['tsan', 'asan'] + maybe_exclude_gcov(scenario_json),
'timeout_seconds': 2*60,
'excluded_poll_engines': scenario_json.get('EXCLUDED_POLL_ENGINES', []),
'auto_timeout_scaling': False
diff --git a/test/cpp/qps/qps_worker.cc b/test/cpp/qps/qps_worker.cc
index aaffb1d93e..d3f0380474 100644
--- a/test/cpp/qps/qps_worker.cc
+++ b/test/cpp/qps/qps_worker.cc
@@ -35,7 +35,7 @@
#include <grpcpp/server_builder.h>
#include "src/core/lib/gpr/host_port.h"
-#include "src/proto/grpc/testing/services.pb.h"
+#include "src/proto/grpc/testing/worker_service.grpc.pb.h"
#include "test/core/util/grpc_profiler.h"
#include "test/core/util/histogram.h"
#include "test/cpp/qps/client.h"
diff --git a/test/cpp/qps/report.cc b/test/cpp/qps/report.cc
index 0a2565d463..607f4e579b 100644
--- a/test/cpp/qps/report.cc
+++ b/test/cpp/qps/report.cc
@@ -27,7 +27,7 @@
#include <grpcpp/client_context.h>
#include "src/cpp/util/core_stats.h"
-#include "src/proto/grpc/testing/services.grpc.pb.h"
+#include "src/proto/grpc/testing/report_qps_scenario_service.grpc.pb.h"
namespace grpc {
namespace testing {
diff --git a/test/cpp/qps/report.h b/test/cpp/qps/report.h
index c5dd138353..8e62f4f449 100644
--- a/test/cpp/qps/report.h
+++ b/test/cpp/qps/report.h
@@ -28,7 +28,7 @@
#include "test/cpp/qps/driver.h"
#include <grpcpp/channel.h>
-#include "src/proto/grpc/testing/services.grpc.pb.h"
+#include "src/proto/grpc/testing/report_qps_scenario_service.grpc.pb.h"
namespace grpc {
namespace testing {
diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc
index 9cb05cd1d1..1dfef6cfc1 100644
--- a/test/cpp/qps/server_async.cc
+++ b/test/cpp/qps/server_async.cc
@@ -36,7 +36,7 @@
#include "src/core/lib/gpr/host_port.h"
#include "src/core/lib/surface/completion_queue.h"
-#include "src/proto/grpc/testing/services.grpc.pb.h"
+#include "src/proto/grpc/testing/benchmark_service.grpc.pb.h"
#include "test/core/util/test_config.h"
#include "test/cpp/qps/server.h"
diff --git a/test/cpp/qps/server_sync.cc b/test/cpp/qps/server_sync.cc
index 9dfd362055..82a9186989 100644
--- a/test/cpp/qps/server_sync.cc
+++ b/test/cpp/qps/server_sync.cc
@@ -26,7 +26,7 @@
#include <grpcpp/server_context.h>
#include "src/core/lib/gpr/host_port.h"
-#include "src/proto/grpc/testing/services.grpc.pb.h"
+#include "src/proto/grpc/testing/benchmark_service.grpc.pb.h"
#include "test/cpp/qps/server.h"
#include "test/cpp/qps/usage_timer.h"
diff --git a/test/cpp/server/BUILD b/test/cpp/server/BUILD
index 7538845803..3f89d6e26e 100644
--- a/test/cpp/server/BUILD
+++ b/test/cpp/server/BUILD
@@ -32,6 +32,19 @@ grpc_cc_test(
)
grpc_cc_test(
+ name = "server_builder_with_socket_mutator_test",
+ srcs = ["server_builder_with_socket_mutator_test.cc"],
+ deps = [
+ "//:grpc++_unsecure",
+ "//src/proto/grpc/testing:echo_proto",
+ "//test/core/util:grpc_test_util_unsecure",
+ ],
+ external_deps = [
+ "gtest",
+ ],
+)
+
+grpc_cc_test(
name = "server_request_call_test",
srcs = ["server_request_call_test.cc"],
deps = [
diff --git a/test/cpp/naming/create_private_dns_zone.sh b/test/cpp/server/load_reporter/BUILD
index 5c9364ca1a..5cb3a00f82 100755..100644
--- a/test/cpp/naming/create_private_dns_zone.sh
+++ b/test/cpp/server/load_reporter/BUILD
@@ -1,5 +1,4 @@
-#!/bin/bash
-# Copyright 2015 gRPC authors.
+# 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.
@@ -13,15 +12,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# This file is auto-generated
+licenses(["notice"]) # Apache v2
-set -ex
+load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_cc_library", "grpc_cc_binary", "grpc_package")
-cd "$(dirname "$0")/../../.."
+grpc_package(name = "test/cpp/server/load_reporter")
-gcloud alpha dns managed-zones create \
- resolver-tests-version-4-grpctestingexp-zone-id \
- --dns-name=resolver-tests-version-4.grpctestingexp. \
- --description="GCE-DNS-private-zone-for-GRPC-testing" \
- --visibility=private \
- --networks=default
+grpc_cc_test(
+ name = "lb_load_data_store_test",
+ srcs = ["load_data_store_test.cc"],
+ external_deps = [
+ "gtest",
+ ],
+ deps = [
+ "//:lb_load_data_store",
+ "//test/core/util:grpc_test_util",
+ ],
+)
diff --git a/test/cpp/server/load_reporter/load_data_store_test.cc b/test/cpp/server/load_reporter/load_data_store_test.cc
new file mode 100644
index 0000000000..8280dee6a4
--- /dev/null
+++ b/test/cpp/server/load_reporter/load_data_store_test.cc
@@ -0,0 +1,481 @@
+/*
+ *
+ * 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 <grpc/impl/codegen/port_platform.h>
+
+#include <set>
+#include <vector>
+
+#include <grpc/grpc.h>
+#include <gtest/gtest.h>
+
+#include "src/cpp/server/load_reporter/load_data_store.h"
+#include "test/core/util/port.h"
+#include "test/core/util/test_config.h"
+
+namespace grpc {
+namespace testing {
+namespace {
+
+using ::grpc::load_reporter::CallMetricValue;
+using ::grpc::load_reporter::LoadDataStore;
+using ::grpc::load_reporter::LoadRecordKey;
+using ::grpc::load_reporter::LoadRecordValue;
+using ::grpc::load_reporter::PerBalancerStore;
+using ::grpc::load_reporter::kInvalidLbId;
+
+class LoadDataStoreTest : public ::testing::Test {
+ public:
+ LoadDataStoreTest()
+ : kKey1(kLbId1, kLbTag1, kUser1, kClientIp1),
+ kKey2(kLbId2, kLbTag2, kUser2, kClientIp2) {}
+
+ // Check whether per_balancer_stores contains a store which was originally
+ // created for <hostname, lb_id, and load_key>.
+ bool PerBalancerStoresContains(
+ const LoadDataStore& load_data_store,
+ const std::set<PerBalancerStore*>* per_balancer_stores,
+ const grpc::string hostname, const grpc::string lb_id,
+ const grpc::string load_key) {
+ auto original_per_balancer_store =
+ load_data_store.FindPerBalancerStore(hostname, lb_id);
+ EXPECT_NE(original_per_balancer_store, nullptr);
+ EXPECT_EQ(original_per_balancer_store->lb_id(), lb_id);
+ EXPECT_EQ(original_per_balancer_store->load_key(), load_key);
+ for (auto per_balancer_store : *per_balancer_stores) {
+ if (per_balancer_store == original_per_balancer_store) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ grpc::string FormatLbId(size_t index) {
+ return "kLbId" + std::to_string(index);
+ }
+
+ const grpc::string kHostname1 = "kHostname1";
+ const grpc::string kHostname2 = "kHostname2";
+ const grpc::string kLbId1 = "kLbId1";
+ const grpc::string kLbId2 = "kLbId2";
+ const grpc::string kLbId3 = "kLbId3";
+ const grpc::string kLbId4 = "kLbId4";
+ const grpc::string kLoadKey1 = "kLoadKey1";
+ const grpc::string kLoadKey2 = "kLoadKey2";
+ const grpc::string kLbTag1 = "kLbTag1";
+ const grpc::string kLbTag2 = "kLbTag2";
+ const grpc::string kUser1 = "kUser1";
+ const grpc::string kUser2 = "kUser2";
+ const grpc::string kClientIp1 = "00";
+ const grpc::string kClientIp2 = "02";
+ const grpc::string kMetric1 = "kMetric1";
+ const grpc::string kMetric2 = "kMetric2";
+ const LoadRecordKey kKey1;
+ const LoadRecordKey kKey2;
+};
+
+using PerBalancerStoreTest = LoadDataStoreTest;
+
+TEST_F(LoadDataStoreTest, AssignToSelf) {
+ LoadDataStore load_data_store;
+ load_data_store.ReportStreamCreated(kHostname1, kLbId1, kLoadKey1);
+ auto assigned_stores = load_data_store.GetAssignedStores(kHostname1, kLbId1);
+ EXPECT_TRUE(PerBalancerStoresContains(load_data_store, assigned_stores,
+ kHostname1, kLbId1, kLoadKey1));
+}
+
+TEST_F(LoadDataStoreTest, ReassignOrphanStores) {
+ LoadDataStore load_data_store;
+ load_data_store.ReportStreamCreated(kHostname1, kLbId1, kLoadKey1);
+ load_data_store.ReportStreamCreated(kHostname1, kLbId2, kLoadKey1);
+ load_data_store.ReportStreamCreated(kHostname1, kLbId3, kLoadKey2);
+ load_data_store.ReportStreamCreated(kHostname2, kLbId4, kLoadKey1);
+ // 1. Close the second stream.
+ load_data_store.ReportStreamClosed(kHostname1, kLbId2);
+ auto assigned_to_lb_id_1 =
+ load_data_store.GetAssignedStores(kHostname1, kLbId1);
+ // The orphaned store is re-assigned to kLbId1 with the same load key.
+ EXPECT_TRUE(PerBalancerStoresContains(load_data_store, assigned_to_lb_id_1,
+ kHostname1, kLbId1, kLoadKey1));
+ EXPECT_TRUE(PerBalancerStoresContains(load_data_store, assigned_to_lb_id_1,
+ kHostname1, kLbId2, kLoadKey1));
+ // 2. Close the first stream.
+ load_data_store.ReportStreamClosed(kHostname1, kLbId1);
+ auto assigned_to_lb_id_3 =
+ load_data_store.GetAssignedStores(kHostname1, kLbId3);
+ // The orphaned stores are re-assigned to kLbId3 with the same host,
+ // because there isn't any LB with the same load key.
+ EXPECT_TRUE(PerBalancerStoresContains(load_data_store, assigned_to_lb_id_3,
+ kHostname1, kLbId1, kLoadKey1));
+ EXPECT_TRUE(PerBalancerStoresContains(load_data_store, assigned_to_lb_id_3,
+ kHostname1, kLbId2, kLoadKey1));
+ EXPECT_TRUE(PerBalancerStoresContains(load_data_store, assigned_to_lb_id_3,
+ kHostname1, kLbId3, kLoadKey2));
+ // 3. Close the third stream.
+ load_data_store.ReportStreamClosed(kHostname1, kLbId3);
+ auto assigned_to_lb_id_4 =
+ load_data_store.GetAssignedStores(kHostname2, kLbId4);
+ // There is no active LB for the first host now. kLbId4 is active but
+ // it's for the second host, so it wll NOT adopt the orphaned stores.
+ EXPECT_FALSE(PerBalancerStoresContains(load_data_store, assigned_to_lb_id_4,
+ kHostname1, kLbId1, kLoadKey1));
+ EXPECT_FALSE(PerBalancerStoresContains(load_data_store, assigned_to_lb_id_4,
+ kHostname1, kLbId2, kLoadKey1));
+ EXPECT_FALSE(PerBalancerStoresContains(load_data_store, assigned_to_lb_id_4,
+ kHostname1, kLbId3, kLoadKey2));
+ EXPECT_TRUE(PerBalancerStoresContains(load_data_store, assigned_to_lb_id_4,
+ kHostname2, kLbId4, kLoadKey1));
+}
+
+TEST_F(LoadDataStoreTest, OrphanAssignmentIsSticky) {
+ LoadDataStore load_data_store;
+ std::set<grpc::string> active_lb_ids;
+ size_t num_lb_ids = 1000;
+ for (size_t i = 0; i < num_lb_ids; ++i) {
+ load_data_store.ReportStreamCreated(kHostname1, FormatLbId(i), kLoadKey1);
+ active_lb_ids.insert(FormatLbId(i));
+ }
+ grpc::string orphaned_lb_id = FormatLbId(std::rand() % num_lb_ids);
+ load_data_store.ReportStreamClosed(kHostname1, orphaned_lb_id);
+ active_lb_ids.erase(orphaned_lb_id);
+ // Find which LB is assigned the orphaned store.
+ grpc::string assigned_lb_id = "";
+ for (auto lb_id : active_lb_ids) {
+ if (PerBalancerStoresContains(
+ load_data_store,
+ load_data_store.GetAssignedStores(kHostname1, lb_id), kHostname1,
+ orphaned_lb_id, kLoadKey1)) {
+ assigned_lb_id = lb_id;
+ break;
+ }
+ }
+ EXPECT_STRNE(assigned_lb_id.c_str(), "");
+ // Close 10 more stream, skipping the assigned_lb_id. The assignment of
+ // orphaned_lb_id shouldn't change.
+ for (size_t _ = 0; _ < 10; ++_) {
+ grpc::string lb_id_to_close = "";
+ for (auto lb_id : active_lb_ids) {
+ if (lb_id != assigned_lb_id) {
+ lb_id_to_close = lb_id;
+ break;
+ }
+ }
+ EXPECT_STRNE(lb_id_to_close.c_str(), "");
+ load_data_store.ReportStreamClosed(kHostname1, lb_id_to_close);
+ active_lb_ids.erase(lb_id_to_close);
+ EXPECT_TRUE(PerBalancerStoresContains(
+ load_data_store,
+ load_data_store.GetAssignedStores(kHostname1, assigned_lb_id),
+ kHostname1, orphaned_lb_id, kLoadKey1));
+ }
+ // Close the assigned_lb_id, orphaned_lb_id will be re-assigned again.
+ load_data_store.ReportStreamClosed(kHostname1, assigned_lb_id);
+ active_lb_ids.erase(assigned_lb_id);
+ size_t orphaned_lb_id_occurences = 0;
+ for (auto lb_id : active_lb_ids) {
+ if (PerBalancerStoresContains(
+ load_data_store,
+ load_data_store.GetAssignedStores(kHostname1, lb_id), kHostname1,
+ orphaned_lb_id, kLoadKey1)) {
+ orphaned_lb_id_occurences++;
+ }
+ }
+ EXPECT_EQ(orphaned_lb_id_occurences, 1U);
+}
+
+TEST_F(LoadDataStoreTest, HostTemporarilyLoseAllStreams) {
+ LoadDataStore load_data_store;
+ load_data_store.ReportStreamCreated(kHostname1, kLbId1, kLoadKey1);
+ load_data_store.ReportStreamCreated(kHostname2, kLbId2, kLoadKey1);
+ auto store_lb_id_1 = load_data_store.FindPerBalancerStore(kHostname1, kLbId1);
+ auto store_invalid_lb_id_1 =
+ load_data_store.FindPerBalancerStore(kHostname1, kInvalidLbId);
+ EXPECT_FALSE(store_lb_id_1->IsSuspended());
+ EXPECT_FALSE(store_invalid_lb_id_1->IsSuspended());
+ // Disconnect all the streams of the first host.
+ load_data_store.ReportStreamClosed(kHostname1, kLbId1);
+ // All the streams of that host are suspended.
+ EXPECT_TRUE(store_lb_id_1->IsSuspended());
+ EXPECT_TRUE(store_invalid_lb_id_1->IsSuspended());
+ // Detailed load data won't be kept when the PerBalancerStore is suspended.
+ store_lb_id_1->MergeRow(kKey1, LoadRecordValue());
+ store_invalid_lb_id_1->MergeRow(kKey1, LoadRecordValue());
+ EXPECT_EQ(store_lb_id_1->load_record_map().size(), 0U);
+ EXPECT_EQ(store_invalid_lb_id_1->load_record_map().size(), 0U);
+ // The stores for different hosts won't mix, even if the load key is the same.
+ auto assigned_to_lb_id_2 =
+ load_data_store.GetAssignedStores(kHostname2, kLbId2);
+ EXPECT_EQ(assigned_to_lb_id_2->size(), 2U);
+ EXPECT_TRUE(PerBalancerStoresContains(load_data_store, assigned_to_lb_id_2,
+ kHostname2, kLbId2, kLoadKey1));
+ EXPECT_TRUE(PerBalancerStoresContains(load_data_store, assigned_to_lb_id_2,
+ kHostname2, kInvalidLbId, ""));
+ // A new stream is created for the first host.
+ load_data_store.ReportStreamCreated(kHostname1, kLbId3, kLoadKey2);
+ // The stores for the first host are resumed.
+ EXPECT_FALSE(store_lb_id_1->IsSuspended());
+ EXPECT_FALSE(store_invalid_lb_id_1->IsSuspended());
+ store_lb_id_1->MergeRow(kKey1, LoadRecordValue());
+ store_invalid_lb_id_1->MergeRow(kKey1, LoadRecordValue());
+ EXPECT_EQ(store_lb_id_1->load_record_map().size(), 1U);
+ EXPECT_EQ(store_invalid_lb_id_1->load_record_map().size(), 1U);
+ // The resumed stores are assigned to the new LB.
+ auto assigned_to_lb_id_3 =
+ load_data_store.GetAssignedStores(kHostname1, kLbId3);
+ EXPECT_EQ(assigned_to_lb_id_3->size(), 3U);
+ EXPECT_TRUE(PerBalancerStoresContains(load_data_store, assigned_to_lb_id_3,
+ kHostname1, kLbId1, kLoadKey1));
+ EXPECT_TRUE(PerBalancerStoresContains(load_data_store, assigned_to_lb_id_3,
+ kHostname1, kInvalidLbId, ""));
+ EXPECT_TRUE(PerBalancerStoresContains(load_data_store, assigned_to_lb_id_3,
+ kHostname1, kLbId3, kLoadKey2));
+}
+
+TEST_F(LoadDataStoreTest, OneStorePerLbId) {
+ LoadDataStore load_data_store;
+ EXPECT_EQ(load_data_store.FindPerBalancerStore(kHostname1, kLbId1), nullptr);
+ EXPECT_EQ(load_data_store.FindPerBalancerStore(kHostname1, kInvalidLbId),
+ nullptr);
+ EXPECT_EQ(load_data_store.FindPerBalancerStore(kHostname2, kLbId2), nullptr);
+ EXPECT_EQ(load_data_store.FindPerBalancerStore(kHostname2, kLbId3), nullptr);
+ // Create The first stream.
+ load_data_store.ReportStreamCreated(kHostname1, kLbId1, kLoadKey1);
+ auto store_lb_id_1 = load_data_store.FindPerBalancerStore(kHostname1, kLbId1);
+ auto store_invalid_lb_id_1 =
+ load_data_store.FindPerBalancerStore(kHostname1, kInvalidLbId);
+ // Two stores will be created: one is for the stream; the other one is for
+ // kInvalidLbId.
+ EXPECT_NE(store_lb_id_1, nullptr);
+ EXPECT_NE(store_invalid_lb_id_1, nullptr);
+ EXPECT_NE(store_lb_id_1, store_invalid_lb_id_1);
+ EXPECT_EQ(load_data_store.FindPerBalancerStore(kHostname2, kLbId2), nullptr);
+ EXPECT_EQ(load_data_store.FindPerBalancerStore(kHostname2, kLbId3), nullptr);
+ // Create the second stream.
+ load_data_store.ReportStreamCreated(kHostname2, kLbId3, kLoadKey1);
+ auto store_lb_id_3 = load_data_store.FindPerBalancerStore(kHostname2, kLbId3);
+ auto store_invalid_lb_id_2 =
+ load_data_store.FindPerBalancerStore(kHostname2, kInvalidLbId);
+ EXPECT_NE(store_lb_id_3, nullptr);
+ EXPECT_NE(store_invalid_lb_id_2, nullptr);
+ EXPECT_NE(store_lb_id_3, store_invalid_lb_id_2);
+ // The PerBalancerStores created for different hosts are independent.
+ EXPECT_NE(store_lb_id_3, store_invalid_lb_id_1);
+ EXPECT_NE(store_invalid_lb_id_2, store_invalid_lb_id_1);
+ EXPECT_EQ(load_data_store.FindPerBalancerStore(kHostname2, kLbId2), nullptr);
+}
+
+TEST_F(LoadDataStoreTest, ExactlyOnceAssignment) {
+ LoadDataStore load_data_store;
+ size_t num_create = 100;
+ size_t num_close = 50;
+ for (size_t i = 0; i < num_create; ++i) {
+ load_data_store.ReportStreamCreated(kHostname1, FormatLbId(i), kLoadKey1);
+ }
+ for (size_t i = 0; i < num_close; ++i) {
+ load_data_store.ReportStreamClosed(kHostname1, FormatLbId(i));
+ }
+ std::set<grpc::string> reported_lb_ids;
+ for (size_t i = num_close; i < num_create; ++i) {
+ for (auto assigned_store :
+ *load_data_store.GetAssignedStores(kHostname1, FormatLbId(i))) {
+ EXPECT_TRUE(reported_lb_ids.insert(assigned_store->lb_id()).second);
+ }
+ }
+ // Add one for kInvalidLbId.
+ EXPECT_EQ(reported_lb_ids.size(), (num_create + 1));
+ EXPECT_NE(reported_lb_ids.find(kInvalidLbId), reported_lb_ids.end());
+}
+
+TEST_F(LoadDataStoreTest, UnknownBalancerIdTracking) {
+ LoadDataStore load_data_store;
+ load_data_store.ReportStreamCreated(kHostname1, kLbId1, kLoadKey1);
+ // Merge data for a known LB ID.
+ LoadRecordValue v1(192);
+ load_data_store.MergeRow(kHostname1, kKey1, v1);
+ // Merge data for unknown LB ID.
+ LoadRecordValue v2(23);
+ EXPECT_FALSE(load_data_store.IsTrackedUnknownBalancerId(kLbId2));
+ load_data_store.MergeRow(
+ kHostname1, LoadRecordKey(kLbId2, kLbTag1, kUser1, kClientIp1), v2);
+ EXPECT_TRUE(load_data_store.IsTrackedUnknownBalancerId(kLbId2));
+ LoadRecordValue v3(952);
+ load_data_store.MergeRow(
+ kHostname2, LoadRecordKey(kLbId3, kLbTag1, kUser1, kClientIp1), v3);
+ EXPECT_TRUE(load_data_store.IsTrackedUnknownBalancerId(kLbId3));
+ // The data kept for a known LB ID is correct.
+ auto store_lb_id_1 = load_data_store.FindPerBalancerStore(kHostname1, kLbId1);
+ EXPECT_EQ(store_lb_id_1->load_record_map().size(), 1U);
+ EXPECT_EQ(store_lb_id_1->load_record_map().find(kKey1)->second.start_count(),
+ v1.start_count());
+ EXPECT_EQ(store_lb_id_1->GetNumCallsInProgressForReport(), v1.start_count());
+ // No PerBalancerStore created for Unknown LB ID.
+ EXPECT_EQ(load_data_store.FindPerBalancerStore(kHostname1, kLbId2), nullptr);
+ EXPECT_EQ(load_data_store.FindPerBalancerStore(kHostname2, kLbId3), nullptr);
+ // End all the started RPCs for kLbId1.
+ LoadRecordValue v4(0, v1.start_count());
+ load_data_store.MergeRow(kHostname1, kKey1, v4);
+ EXPECT_EQ(store_lb_id_1->load_record_map().size(), 1U);
+ EXPECT_EQ(store_lb_id_1->load_record_map().find(kKey1)->second.start_count(),
+ v1.start_count());
+ EXPECT_EQ(store_lb_id_1->load_record_map().find(kKey1)->second.ok_count(),
+ v4.ok_count());
+ EXPECT_EQ(store_lb_id_1->GetNumCallsInProgressForReport(), 0U);
+ EXPECT_FALSE(load_data_store.IsTrackedUnknownBalancerId(kLbId1));
+ // End all the started RPCs for kLbId2.
+ LoadRecordValue v5(0, v2.start_count());
+ load_data_store.MergeRow(
+ kHostname1, LoadRecordKey(kLbId2, kLbTag1, kUser1, kClientIp1), v5);
+ EXPECT_FALSE(load_data_store.IsTrackedUnknownBalancerId(kLbId2));
+ // End some of the started RPCs for kLbId3.
+ LoadRecordValue v6(0, v3.start_count() / 2);
+ load_data_store.MergeRow(
+ kHostname2, LoadRecordKey(kLbId3, kLbTag1, kUser1, kClientIp1), v6);
+ EXPECT_TRUE(load_data_store.IsTrackedUnknownBalancerId(kLbId3));
+}
+
+TEST_F(PerBalancerStoreTest, Suspend) {
+ PerBalancerStore per_balancer_store(kLbId1, kLoadKey1);
+ EXPECT_FALSE(per_balancer_store.IsSuspended());
+ // Suspend the store.
+ per_balancer_store.Suspend();
+ EXPECT_TRUE(per_balancer_store.IsSuspended());
+ EXPECT_EQ(0U, per_balancer_store.load_record_map().size());
+ // Data merged when the store is suspended won't be kept.
+ LoadRecordValue v1(139, 19);
+ per_balancer_store.MergeRow(kKey1, v1);
+ EXPECT_EQ(0U, per_balancer_store.load_record_map().size());
+ // Resume the store.
+ per_balancer_store.Resume();
+ EXPECT_FALSE(per_balancer_store.IsSuspended());
+ EXPECT_EQ(0U, per_balancer_store.load_record_map().size());
+ // Data merged after the store is resumed will be kept.
+ LoadRecordValue v2(23, 0, 51);
+ per_balancer_store.MergeRow(kKey1, v2);
+ EXPECT_EQ(1U, per_balancer_store.load_record_map().size());
+ // Suspend the store.
+ per_balancer_store.Suspend();
+ EXPECT_TRUE(per_balancer_store.IsSuspended());
+ EXPECT_EQ(0U, per_balancer_store.load_record_map().size());
+ // Data merged when the store is suspended won't be kept.
+ LoadRecordValue v3(62, 11);
+ per_balancer_store.MergeRow(kKey1, v3);
+ EXPECT_EQ(0U, per_balancer_store.load_record_map().size());
+ // Resume the store.
+ per_balancer_store.Resume();
+ EXPECT_FALSE(per_balancer_store.IsSuspended());
+ EXPECT_EQ(0U, per_balancer_store.load_record_map().size());
+ // Data merged after the store is resumed will be kept.
+ LoadRecordValue v4(225, 98);
+ per_balancer_store.MergeRow(kKey1, v4);
+ EXPECT_EQ(1U, per_balancer_store.load_record_map().size());
+ // In-progress count is always kept.
+ EXPECT_EQ(per_balancer_store.GetNumCallsInProgressForReport(),
+ v1.start_count() - v1.ok_count() + v2.start_count() -
+ v2.error_count() + v3.start_count() - v3.ok_count() +
+ v4.start_count() - v4.ok_count());
+}
+
+TEST_F(PerBalancerStoreTest, DataAggregation) {
+ PerBalancerStore per_balancer_store(kLbId1, kLoadKey1);
+ // Construct some Values.
+ LoadRecordValue v1(992, 34, 13, 234.0, 164.0, 173467.38);
+ v1.InsertCallMetric(kMetric1, CallMetricValue(3, 2773.2));
+ LoadRecordValue v2(4842, 213, 9, 393.0, 974.0, 1345.2398);
+ v2.InsertCallMetric(kMetric1, CallMetricValue(7, 25.234));
+ v2.InsertCallMetric(kMetric2, CallMetricValue(2, 387.08));
+ // v3 doesn't change the number of in-progress RPCs.
+ LoadRecordValue v3(293, 55, 293 - 55, 28764, 5284, 5772);
+ v3.InsertCallMetric(kMetric1, CallMetricValue(61, 3465.0));
+ v3.InsertCallMetric(kMetric2, CallMetricValue(13, 672.0));
+ // The initial state of the store.
+ uint64_t num_calls_in_progress = 0;
+ EXPECT_FALSE(per_balancer_store.IsNumCallsInProgressChangedSinceLastReport());
+ EXPECT_EQ(per_balancer_store.GetNumCallsInProgressForReport(),
+ num_calls_in_progress);
+ // Merge v1 and get report of the number of in-progress calls.
+ per_balancer_store.MergeRow(kKey1, v1);
+ EXPECT_TRUE(per_balancer_store.IsNumCallsInProgressChangedSinceLastReport());
+ EXPECT_EQ(per_balancer_store.GetNumCallsInProgressForReport(),
+ num_calls_in_progress +=
+ (v1.start_count() - v1.ok_count() - v1.error_count()));
+ EXPECT_FALSE(per_balancer_store.IsNumCallsInProgressChangedSinceLastReport());
+ // Merge v2 and get report of the number of in-progress calls.
+ per_balancer_store.MergeRow(kKey2, v2);
+ EXPECT_TRUE(per_balancer_store.IsNumCallsInProgressChangedSinceLastReport());
+ EXPECT_EQ(per_balancer_store.GetNumCallsInProgressForReport(),
+ num_calls_in_progress +=
+ (v2.start_count() - v2.ok_count() - v2.error_count()));
+ EXPECT_FALSE(per_balancer_store.IsNumCallsInProgressChangedSinceLastReport());
+ // Merge v3 and get report of the number of in-progress calls.
+ per_balancer_store.MergeRow(kKey1, v3);
+ EXPECT_FALSE(per_balancer_store.IsNumCallsInProgressChangedSinceLastReport());
+ EXPECT_EQ(per_balancer_store.GetNumCallsInProgressForReport(),
+ num_calls_in_progress);
+ // LoadRecordValue for kKey1 is aggregated correctly.
+ LoadRecordValue value_for_key1 =
+ per_balancer_store.load_record_map().find(kKey1)->second;
+ EXPECT_EQ(value_for_key1.start_count(), v1.start_count() + v3.start_count());
+ EXPECT_EQ(value_for_key1.ok_count(), v1.ok_count() + v3.ok_count());
+ EXPECT_EQ(value_for_key1.error_count(), v1.error_count() + v3.error_count());
+ EXPECT_EQ(value_for_key1.bytes_sent(), v1.bytes_sent() + v3.bytes_sent());
+ EXPECT_EQ(value_for_key1.bytes_recv(), v1.bytes_recv() + v3.bytes_recv());
+ EXPECT_EQ(value_for_key1.latency_ms(), v1.latency_ms() + v3.latency_ms());
+ EXPECT_EQ(value_for_key1.call_metrics().size(), 2U);
+ EXPECT_EQ(value_for_key1.call_metrics().find(kMetric1)->second.num_calls(),
+ v1.call_metrics().find(kMetric1)->second.num_calls() +
+ v3.call_metrics().find(kMetric1)->second.num_calls());
+ EXPECT_EQ(
+ value_for_key1.call_metrics().find(kMetric1)->second.total_metric_value(),
+ v1.call_metrics().find(kMetric1)->second.total_metric_value() +
+ v3.call_metrics().find(kMetric1)->second.total_metric_value());
+ EXPECT_EQ(value_for_key1.call_metrics().find(kMetric2)->second.num_calls(),
+ v3.call_metrics().find(kMetric2)->second.num_calls());
+ EXPECT_EQ(
+ value_for_key1.call_metrics().find(kMetric2)->second.total_metric_value(),
+ v3.call_metrics().find(kMetric2)->second.total_metric_value());
+ // LoadRecordValue for kKey2 is aggregated (trivially) correctly.
+ LoadRecordValue value_for_key2 =
+ per_balancer_store.load_record_map().find(kKey2)->second;
+ EXPECT_EQ(value_for_key2.start_count(), v2.start_count());
+ EXPECT_EQ(value_for_key2.ok_count(), v2.ok_count());
+ EXPECT_EQ(value_for_key2.error_count(), v2.error_count());
+ EXPECT_EQ(value_for_key2.bytes_sent(), v2.bytes_sent());
+ EXPECT_EQ(value_for_key2.bytes_recv(), v2.bytes_recv());
+ EXPECT_EQ(value_for_key2.latency_ms(), v2.latency_ms());
+ EXPECT_EQ(value_for_key2.call_metrics().size(), 2U);
+ EXPECT_EQ(value_for_key2.call_metrics().find(kMetric1)->second.num_calls(),
+ v2.call_metrics().find(kMetric1)->second.num_calls());
+ EXPECT_EQ(
+ value_for_key2.call_metrics().find(kMetric1)->second.total_metric_value(),
+ v2.call_metrics().find(kMetric1)->second.total_metric_value());
+ EXPECT_EQ(value_for_key2.call_metrics().find(kMetric2)->second.num_calls(),
+ v2.call_metrics().find(kMetric2)->second.num_calls());
+ EXPECT_EQ(
+ value_for_key2.call_metrics().find(kMetric2)->second.total_metric_value(),
+ v2.call_metrics().find(kMetric2)->second.total_metric_value());
+}
+
+} // namespace
+} // namespace testing
+} // namespace grpc
+
+int main(int argc, char** argv) {
+ grpc_test_init(argc, argv);
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
diff --git a/test/cpp/server/server_builder_with_socket_mutator_test.cc b/test/cpp/server/server_builder_with_socket_mutator_test.cc
new file mode 100644
index 0000000000..5c7dd696c9
--- /dev/null
+++ b/test/cpp/server/server_builder_with_socket_mutator_test.cc
@@ -0,0 +1,116 @@
+/*
+ *
+ * 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 <grpcpp/impl/codegen/config.h>
+#include <gtest/gtest.h>
+
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
+
+#include <grpc/grpc.h>
+#include <memory>
+
+#include "src/core/lib/iomgr/socket_mutator.h"
+#include "src/proto/grpc/testing/echo.grpc.pb.h"
+#include "test/core/util/port.h"
+
+/* This test does a sanity check that grpc_socket_mutator's
+ * are used by servers. It's meant to protect code and end-to-end
+ * tests that rely on this functionality but which live outside
+ * of the grpc github repo. */
+
+namespace grpc {
+namespace {
+
+bool mock_socket_mutator_mutate_fd(int, grpc_socket_mutator*);
+int mock_socket_mutator_compare(grpc_socket_mutator*, grpc_socket_mutator*);
+void mock_socket_mutator_destroy(grpc_socket_mutator*);
+
+const grpc_socket_mutator_vtable mock_socket_mutator_vtable = {
+ mock_socket_mutator_mutate_fd,
+ mock_socket_mutator_compare,
+ mock_socket_mutator_destroy,
+};
+
+class MockSocketMutator : public grpc_socket_mutator {
+ public:
+ MockSocketMutator() : mutate_fd_call_count_(0) {
+ grpc_socket_mutator_init(this, &mock_socket_mutator_vtable);
+ }
+ int mutate_fd_call_count_;
+};
+
+bool mock_socket_mutator_mutate_fd(int fd, grpc_socket_mutator* m) {
+ MockSocketMutator* s = reinterpret_cast<MockSocketMutator*>(m);
+ s->mutate_fd_call_count_++;
+ return true;
+}
+
+int mock_socket_mutator_compare(grpc_socket_mutator* a,
+ grpc_socket_mutator* b) {
+ return (uintptr_t)a - (uintptr_t)b;
+}
+
+void mock_socket_mutator_destroy(grpc_socket_mutator* m) {
+ MockSocketMutator* s = reinterpret_cast<MockSocketMutator*>(m);
+ delete s;
+}
+
+class MockSocketMutatorServerBuilderOption : public grpc::ServerBuilderOption {
+ public:
+ MockSocketMutatorServerBuilderOption(MockSocketMutator* mock_socket_mutator)
+ : mock_socket_mutator_(mock_socket_mutator) {}
+
+ void UpdateArguments(ChannelArguments* args) override {
+ args->SetSocketMutator(mock_socket_mutator_);
+ }
+
+ void UpdatePlugins(
+ std::vector<std::unique_ptr<ServerBuilderPlugin>>*) override{};
+
+ MockSocketMutator* mock_socket_mutator_;
+};
+
+TEST(ServerBuilderWithSocketMutatorTest, CreateServerWithSocketMutator) {
+ auto address = "localhost:" + std::to_string(grpc_pick_unused_port_or_die());
+ auto mock_socket_mutator = new MockSocketMutator();
+ std::unique_ptr<grpc::ServerBuilderOption> mock_socket_mutator_builder_option(
+ new MockSocketMutatorServerBuilderOption(mock_socket_mutator));
+ testing::EchoTestService::Service echo_service;
+ EXPECT_EQ(mock_socket_mutator->mutate_fd_call_count_, 0);
+ ServerBuilder builder;
+ builder.RegisterService(&echo_service);
+ builder.AddListeningPort(address, InsecureServerCredentials());
+ builder.SetOption(std::move(mock_socket_mutator_builder_option));
+ std::unique_ptr<grpc::Server> server(builder.BuildAndStart());
+ EXPECT_NE(server, nullptr);
+ // Only assert that the socket mutator was used.
+ EXPECT_GE(mock_socket_mutator->mutate_fd_call_count_, 1);
+ server->Shutdown();
+}
+
+} // namespace
+} // namespace grpc
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ grpc_init();
+ int ret = RUN_ALL_TESTS();
+ grpc_shutdown();
+ return ret;
+}
diff --git a/test/cpp/util/byte_buffer_test.cc b/test/cpp/util/byte_buffer_test.cc
index 47a5b7f03a..b48a53eed1 100644
--- a/test/cpp/util/byte_buffer_test.cc
+++ b/test/cpp/util/byte_buffer_test.cc
@@ -38,6 +38,13 @@ const char* kContent2 = "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy world";
class ByteBufferTest : public ::testing::Test {};
+TEST_F(ByteBufferTest, CopyCtor) {
+ ByteBuffer buffer1;
+ EXPECT_FALSE(buffer1.Valid());
+ ByteBuffer buffer2 = buffer1;
+ EXPECT_FALSE(buffer2.Valid());
+}
+
TEST_F(ByteBufferTest, CreateFromSingleSlice) {
Slice s(kContent1);
ByteBuffer buffer(&s, 1);
diff --git a/test/cpp/util/create_test_channel.cc b/test/cpp/util/create_test_channel.cc
index 1047d44627..0bcd4dbc84 100644
--- a/test/cpp/util/create_test_channel.cc
+++ b/test/cpp/util/create_test_channel.cc
@@ -107,37 +107,37 @@ std::shared_ptr<Channel> CreateTestChannel(
std::shared_ptr<Channel> CreateTestChannel(
const grpc::string& server, const grpc::string& override_hostname,
- bool enable_ssl, bool use_prod_roots,
+ testing::transport_security security_type, bool use_prod_roots,
const std::shared_ptr<CallCredentials>& creds,
const ChannelArguments& args) {
- grpc::string type;
- if (enable_ssl) {
- type = testing::kTlsCredentialsType;
- }
-
+ grpc::string type =
+ security_type == testing::ALTS
+ ? testing::kAltsCredentialsType
+ : (security_type == testing::TLS ? testing::kTlsCredentialsType
+ : testing::kInsecureCredentialsType);
return CreateTestChannel(server, type, override_hostname, use_prod_roots,
creds, args);
}
std::shared_ptr<Channel> CreateTestChannel(
const grpc::string& server, const grpc::string& override_hostname,
- bool enable_ssl, bool use_prod_roots,
+ testing::transport_security security_type, bool use_prod_roots,
const std::shared_ptr<CallCredentials>& creds) {
- return CreateTestChannel(server, override_hostname, enable_ssl,
+ return CreateTestChannel(server, override_hostname, security_type,
use_prod_roots, creds, ChannelArguments());
}
std::shared_ptr<Channel> CreateTestChannel(
const grpc::string& server, const grpc::string& override_hostname,
- bool enable_ssl, bool use_prod_roots) {
- return CreateTestChannel(server, override_hostname, enable_ssl,
+ testing::transport_security security_type, bool use_prod_roots) {
+ return CreateTestChannel(server, override_hostname, security_type,
use_prod_roots, std::shared_ptr<CallCredentials>());
}
// Shortcut for end2end and interop tests.
-std::shared_ptr<Channel> CreateTestChannel(const grpc::string& server,
- bool enable_ssl) {
- return CreateTestChannel(server, "foo.test.google.fr", enable_ssl, false);
+std::shared_ptr<Channel> CreateTestChannel(
+ const grpc::string& server, testing::transport_security security_type) {
+ return CreateTestChannel(server, "foo.test.google.fr", security_type, false);
}
std::shared_ptr<Channel> CreateTestChannel(
diff --git a/test/cpp/util/create_test_channel.h b/test/cpp/util/create_test_channel.h
index ddaa99f43e..c615fb7653 100644
--- a/test/cpp/util/create_test_channel.h
+++ b/test/cpp/util/create_test_channel.h
@@ -26,21 +26,27 @@
namespace grpc {
class Channel;
-std::shared_ptr<Channel> CreateTestChannel(const grpc::string& server,
- bool enable_ssl);
+namespace testing {
+
+typedef enum { INSECURE = 0, TLS, ALTS } transport_security;
+
+} // namespace testing
+
+std::shared_ptr<Channel> CreateTestChannel(
+ const grpc::string& server, testing::transport_security security_type);
std::shared_ptr<Channel> CreateTestChannel(
const grpc::string& server, const grpc::string& override_hostname,
- bool enable_ssl, bool use_prod_roots);
+ testing::transport_security security_type, bool use_prod_roots);
std::shared_ptr<Channel> CreateTestChannel(
const grpc::string& server, const grpc::string& override_hostname,
- bool enable_ssl, bool use_prod_roots,
+ testing::transport_security security_type, bool use_prod_roots,
const std::shared_ptr<CallCredentials>& creds);
std::shared_ptr<Channel> CreateTestChannel(
const grpc::string& server, const grpc::string& override_hostname,
- bool enable_ssl, bool use_prod_roots,
+ testing::transport_security security_type, bool use_prod_roots,
const std::shared_ptr<CallCredentials>& creds,
const ChannelArguments& args);
diff --git a/test/cpp/util/test_credentials_provider.cc b/test/cpp/util/test_credentials_provider.cc
index 76561007c4..c8b0ac73f4 100644
--- a/test/cpp/util/test_credentials_provider.cc
+++ b/test/cpp/util/test_credentials_provider.cc
@@ -56,6 +56,9 @@ class DefaultCredentialsProvider : public CredentialsProvider {
const grpc::string& type, ChannelArguments* args) override {
if (type == grpc::testing::kInsecureCredentialsType) {
return InsecureChannelCredentials();
+ } else if (type == grpc::testing::kAltsCredentialsType) {
+ grpc::experimental::AltsCredentialsOptions alts_opts;
+ return grpc::experimental::AltsCredentials(alts_opts);
} else if (type == grpc::testing::kTlsCredentialsType) {
SslCredentialsOptions ssl_opts = {test_root_cert, "", ""};
args->SetSslTargetNameOverride("foo.test.google.fr");
@@ -77,6 +80,9 @@ class DefaultCredentialsProvider : public CredentialsProvider {
const grpc::string& type) override {
if (type == grpc::testing::kInsecureCredentialsType) {
return InsecureServerCredentials();
+ } else if (type == grpc::testing::kAltsCredentialsType) {
+ grpc::experimental::AltsServerCredentialsOptions alts_opts;
+ return grpc::experimental::AltsServerCredentials(alts_opts);
} else if (type == grpc::testing::kTlsCredentialsType) {
SslServerCredentialsOptions::PemKeyCertPair pkcp = {test_server1_key,
test_server1_cert};
diff --git a/test/cpp/util/test_credentials_provider.h b/test/cpp/util/test_credentials_provider.h
index f489a2c563..b1d69e893d 100644
--- a/test/cpp/util/test_credentials_provider.h
+++ b/test/cpp/util/test_credentials_provider.h
@@ -29,10 +29,10 @@ namespace grpc {
namespace testing {
const char kInsecureCredentialsType[] = "INSECURE_CREDENTIALS";
-
// For real credentials, like tls/ssl, this name should match the AuthContext
// property "transport_security_type".
const char kTlsCredentialsType[] = "ssl";
+const char kAltsCredentialsType[] = "alts";
// Provide test credentials of a particular type.
class CredentialTypeProvider {
diff --git a/test/distrib/csharp/DistribTest/DistribTest.project.json b/test/distrib/csharp/DistribTest/DistribTest.project.json
deleted file mode 100644
index 422545ea8f..0000000000
--- a/test/distrib/csharp/DistribTest/DistribTest.project.json
+++ /dev/null
@@ -1,11 +0,0 @@
-// This file exists only to prevent VS2015 from mistakenly picking up
-// project.json file when building .csproj project.
-// See https://github.com/Microsoft/msbuild/issues/394
-{
- "frameworks": {
- "net45": { }
- },
- "runtimes": {
- "win": { }
- }
-}
diff --git a/test/distrib/csharp/DistribTest/DistribTestDotNet.csproj b/test/distrib/csharp/DistribTest/DistribTestDotNet.csproj
new file mode 100644
index 0000000000..f16a0f9959
--- /dev/null
+++ b/test/distrib/csharp/DistribTest/DistribTestDotNet.csproj
@@ -0,0 +1,27 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFrameworks>netcoreapp1.0;net45</TargetFrameworks>
+ <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
+ <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
+ <GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
+ <GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
+ <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
+ <GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
+ <GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Grpc" Version="__GRPC_NUGET_VERSION__" />
+ <PackageReference Include="Grpc.Auth" Version="__GRPC_NUGET_VERSION__" />
+ <PackageReference Include="Grpc.Tools" Version="__GRPC_NUGET_VERSION__" />
+ </ItemGroup>
+
+ <PropertyGroup Condition="'$(OS)' != 'Windows_NT'">
+ <!-- Workaround for https://github.com/dotnet/sdk/issues/335 -->
+ <FrameworkPathOverride Condition="Exists('/usr/lib/mono/4.5-api')">/usr/lib/mono/4.5-api</FrameworkPathOverride>
+ <FrameworkPathOverride Condition="Exists('/usr/local/lib/mono/4.5-api')">/usr/local/lib/mono/4.5-api</FrameworkPathOverride>
+ <FrameworkPathOverride Condition="Exists('/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5-api')">/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5-api</FrameworkPathOverride>
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/test/distrib/csharp/DistribTest/project.json b/test/distrib/csharp/DistribTest/project.json
deleted file mode 100644
index 09266e5d4d..0000000000
--- a/test/distrib/csharp/DistribTest/project.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "buildOptions": {
- "emitEntryPoint": true
- },
- "dependencies": {
- "Grpc.Auth": "__GRPC_NUGET_VERSION__",
- "Grpc.Core": "__GRPC_NUGET_VERSION__",
- // Necessary for native deps to get copied correctly.
- "Microsoft.NETCore.Platforms": "1.0.1"
- },
- "frameworks": {
- "net45": { },
- "netcoreapp1.0": {
- "dependencies": {
- "Microsoft.NETCore.App": {
- "type": "platform",
- "version": "1.0.0"
- }
- }
- }
- }
-}
diff --git a/test/distrib/csharp/run_distrib_test.sh b/test/distrib/csharp/run_distrib_test.sh
index b96872725e..eee24d0e57 100755
--- a/test/distrib/csharp/run_distrib_test.sh
+++ b/test/distrib/csharp/run_distrib_test.sh
@@ -21,11 +21,6 @@ unzip -o "$EXTERNAL_GIT_ROOT/input_artifacts/csharp_nugets_windows_dotnetcli.zip
./update_version.sh auto
-# With a recent-enough version of mono, the "nuget restore" command would
-# restore packages based on project.json files, but we want to restore packages
-# based on the net45 legacy "packages.config" file instead.
-rm DistribTest/*project.json
-
nuget restore
xbuild DistribTest.sln
diff --git a/test/distrib/csharp/run_distrib_test_dotnetcli.sh b/test/distrib/csharp/run_distrib_test_dotnetcli.sh
index 9e31945dfb..86c2d5231e 100755
--- a/test/distrib/csharp/run_distrib_test_dotnetcli.sh
+++ b/test/distrib/csharp/run_distrib_test_dotnetcli.sh
@@ -25,19 +25,22 @@ cd DistribTest
# TODO(jtattermusch): make sure we don't pollute the global nuget cache with
# the nugets being tested.
-dotnet restore
+dotnet restore DistribTestDotNet.csproj
-dotnet build
-dotnet publish
+dotnet build DistribTestDotNet.csproj
+dotnet publish -f netcoreapp1.0 DistribTestDotNet.csproj
+dotnet publish -f net45 DistribTestDotNet.csproj
+
+ls -R bin
# .NET 4.5 target after dotnet build
-mono bin/Debug/net45/*-x64/DistribTest.exe
+mono bin/Debug/net45/publish/DistribTestDotNet.exe
# .NET 4.5 target after dotnet publish
-mono bin/Debug/net45/*-x64/publish/DistribTest.exe
+mono bin/Debug/net45/publish/DistribTestDotNet.exe
# .NET Core target after dotnet build
-dotnet exec bin/Debug/netcoreapp1.0/DistribTest.dll
+dotnet exec bin/Debug/netcoreapp1.0/DistribTestDotNet.dll
# .NET Core target after dotnet publish
-dotnet exec bin/Debug/netcoreapp1.0/publish/DistribTest.dll
+dotnet exec bin/Debug/netcoreapp1.0/publish/DistribTestDotNet.dll
diff --git a/test/distrib/csharp/update_version.sh b/test/distrib/csharp/update_version.sh
index 734ec21ba2..9759cc5648 100755
--- a/test/distrib/csharp/update_version.sh
+++ b/test/distrib/csharp/update_version.sh
@@ -28,4 +28,4 @@ then
fi
# Replaces version placeholder with value provided as first argument.
-sed -ibak "s/__GRPC_NUGET_VERSION__/${CSHARP_VERSION}/g" DistribTest/packages.config DistribTest/DistribTest.csproj DistribTest/project.json
+sed -ibak "s/__GRPC_NUGET_VERSION__/${CSHARP_VERSION}/g" DistribTest/packages.config DistribTest/DistribTest.csproj DistribTest/DistribTestDotNet.csproj
diff --git a/test/distrib/python/test_packages.sh b/test/distrib/python/test_packages.sh
index e16eddd577..6bf49d45b9 100755
--- a/test/distrib/python/test_packages.sh
+++ b/test/distrib/python/test_packages.sh
@@ -22,12 +22,14 @@ shopt -s nullglob
if [[ "$1" == "binary" ]]
then
echo "Testing Python binary distribution"
- ARCHIVES=("$EXTERNAL_GIT_ROOT"/input_artifacts/grpcio-*.whl)
- TOOLS_ARCHIVES=("$EXTERNAL_GIT_ROOT"/input_artifacts/grpcio_tools-*.whl)
+ ARCHIVES=("$EXTERNAL_GIT_ROOT"/input_artifacts/grpcio-[0-9]*.whl)
+ TOOLS_ARCHIVES=("$EXTERNAL_GIT_ROOT"/input_artifacts/grpcio_tools-[0-9]*.whl)
else
echo "Testing Python source distribution"
- ARCHIVES=("$EXTERNAL_GIT_ROOT"/input_artifacts/grpcio-*.tar.gz)
- TOOLS_ARCHIVES=("$EXTERNAL_GIT_ROOT"/input_artifacts/grpcio_tools-*.tar.gz)
+ ARCHIVES=("$EXTERNAL_GIT_ROOT"/input_artifacts/grpcio-[0-9]*.tar.gz)
+ TOOLS_ARCHIVES=("$EXTERNAL_GIT_ROOT"/input_artifacts/grpcio-tools-[0-9]*.tar.gz)
+ HEALTH_ARCHIVES=("$EXTERNAL_GIT_ROOT"/input_artifacts/grpcio-health-checking-[0-9]*.tar.gz)
+ REFLECTION_ARCHIVES=("$EXTERNAL_GIT_ROOT"/input_artifacts/grpcio-reflection-[0-9]*.tar.gz)
fi
VIRTUAL_ENV=$(mktemp -d)
@@ -52,6 +54,14 @@ function at_least_one_installs() {
at_least_one_installs "${ARCHIVES[@]}"
at_least_one_installs "${TOOLS_ARCHIVES[@]}"
+if [[ "$1" == "source" ]]
+then
+ echo "Testing Python health and reflection packages"
+ at_least_one_installs "${HEALTH_ARCHIVES[@]}"
+ at_least_one_installs "${REFLECTION_ARCHIVES[@]}"
+fi
+
+
#
# Test our distributions
#