mirror of https://github.com/grpc/grpc.git
commit
5f45ff384f
11 changed files with 2 additions and 881 deletions
@ -1,4 +0,0 @@ |
||||
%YAML 1.2 |
||||
--- | |
||||
<%namespace file="create_private_dns_zone_defs.include" import="*"/>\ |
||||
${create_private_dns_zone(resolver_gce_integration_tests_zone_id, resolver_tests_common_zone_name)} |
@ -1,32 +0,0 @@ |
||||
<%def name="create_private_dns_zone(resolver_gce_integration_tests_zone_id, resolver_tests_common_zone_name)">#!/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 alpha dns managed-zones create \\ |
||||
|
||||
${resolver_gce_integration_tests_zone_id} \\ |
||||
|
||||
--dns-name=${resolver_tests_common_zone_name} \\ |
||||
|
||||
--description="GCE-DNS-private-zone-for-GRPC-testing" \\ |
||||
|
||||
--visibility=private \\ |
||||
|
||||
--networks=default</%def> |
@ -1,4 +0,0 @@ |
||||
%YAML 1.2 |
||||
--- | |
||||
<%namespace file="private_dns_zone_init_defs.include" import="*"/>\ |
||||
${private_dns_zone_init(all_integration_test_records, resolver_gce_integration_tests_zone_id, resolver_tests_common_zone_name)} |
@ -1,40 +0,0 @@ |
||||
<%def name="private_dns_zone_init(records,resolver_gce_integration_tests_zone_id,resolver_tests_common_zone_name)">#!/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_gce_integration_tests_zone_id} |
||||
|
||||
% for r in records: |
||||
gcloud dns record-sets transaction add \\ |
||||
|
||||
-z=${resolver_gce_integration_tests_zone_id} \\ |
||||
|
||||
--name=${r['name']}.${resolver_tests_common_zone_name} \\ |
||||
|
||||
--type=${r['type']} \\ |
||||
|
||||
--ttl=${r['ttl']} \\ |
||||
|
||||
${r['data']} |
||||
|
||||
% endfor |
||||
gcloud dns record-sets transaction describe -z=${resolver_gce_integration_tests_zone_id} |
||||
gcloud dns record-sets transaction execute -z=${resolver_gce_integration_tests_zone_id} |
||||
gcloud dns record-sets list -z=${resolver_gce_integration_tests_zone_id}</%def> |
@ -1,64 +0,0 @@ |
||||
<%def name="resolver_gce_integration_tests(tests, records, resolver_tests_common_zone_name)">#!/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 |
||||
|
||||
% for r in records: |
||||
ONE_FAILED=0 |
||||
dig ${r['type']} ${r['name']}.${resolver_tests_common_zone_name} | grep 'ANSWER SECTION' || ONE_FAILED=1 |
||||
if [[ "$ONE_FAILED" != 0 ]]; then |
||||
echo "Sanity check: dig ${r['type']} ${r['name']}.${resolver_tests_common_zone_name} FAILED" |
||||
exit 1 |
||||
fi |
||||
|
||||
% endfor |
||||
echo "Sanity check PASSED. Run resolver tests:" |
||||
|
||||
% for test in tests: |
||||
ONE_FAILED=0 |
||||
bins/$CONFIG/resolver_component_test \\ |
||||
|
||||
% for arg_name_and_value in test['arg_names_and_values'][0:-1]: |
||||
\ |
||||
--${arg_name_and_value[0]}='${arg_name_and_value[1]}' \\ |
||||
|
||||
\ |
||||
% endfor |
||||
--${test['arg_names_and_values'][-1][0]}='${test['arg_names_and_values'][-1][1]}' || ONE_FAILED=1 |
||||
if [[ "$ONE_FAILED" != 0 ]]; then |
||||
echo "Test based on target record: ${test['test_title']} FAILED" |
||||
EXIT_CODE=1 |
||||
fi |
||||
|
||||
% endfor |
||||
exit $EXIT_CODE</%def> |
@ -1,4 +0,0 @@ |
||||
%YAML 1.2 |
||||
--- | |
||||
<%namespace file="resolver_gce_integration_tests_defs.include" import="*"/>\ |
||||
${resolver_gce_integration_tests(resolver_gce_integration_test_cases, all_integration_test_records, resolver_tests_common_zone_name)} |
@ -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. |
@ -1,27 +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 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 |
@ -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 |
@ -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 |
Loading…
Reference in new issue