aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar apolcyn <apolcyn@google.com>2018-12-12 19:24:43 -0800
committerGravatar GitHub <noreply@github.com>2018-12-12 19:24:43 -0800
commit3a97adc7a493b584c423a782f7a3a0860863d429 (patch)
treee1eeca6f2165797e32ed17e5ac1934dc50e8804c /test
parente9cae6bba38bc02062db5abcca4b6afa91ef30e8 (diff)
parent7dc330f298154571163603a8b568015412767cad (diff)
Merge pull request #17470 from apolcyn/cares_default_prep
Avoid SRV and TXT lookups for localhost
Diffstat (limited to 'test')
-rw-r--r--test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc5
-rw-r--r--test/core/end2end/fuzzers/api_fuzzer.cc5
-rw-r--r--test/core/iomgr/resolve_address_posix_test.cc13
3 files changed, 19 insertions, 4 deletions
diff --git a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc
index 1a7a7c9ccc..0cf549d01d 100644
--- a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc
+++ b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc
@@ -76,7 +76,10 @@ static grpc_ares_request* my_dns_lookup_ares_locked(
} else {
gpr_mu_unlock(&g_mu);
*addresses = grpc_core::MakeUnique<grpc_core::ServerAddressList>();
- (*addresses)->emplace_back(nullptr, 0, nullptr);
+ grpc_resolved_address dummy_resolved_address;
+ memset(&dummy_resolved_address, 0, sizeof(dummy_resolved_address));
+ dummy_resolved_address.len = 123;
+ (*addresses)->emplace_back(dummy_resolved_address, nullptr);
}
GRPC_CLOSURE_SCHED(on_done, error);
return nullptr;
diff --git a/test/core/end2end/fuzzers/api_fuzzer.cc b/test/core/end2end/fuzzers/api_fuzzer.cc
index fe47127984..a0b8290475 100644
--- a/test/core/end2end/fuzzers/api_fuzzer.cc
+++ b/test/core/end2end/fuzzers/api_fuzzer.cc
@@ -342,7 +342,10 @@ static void finish_resolve(void* arg, grpc_error* error) {
*r->addrs = addrs;
} else if (r->addresses != nullptr) {
*r->addresses = grpc_core::MakeUnique<grpc_core::ServerAddressList>();
- (*r->addresses)->emplace_back(nullptr, 0, nullptr);
+ grpc_resolved_address dummy_resolved_address;
+ memset(&dummy_resolved_address, 0, sizeof(dummy_resolved_address));
+ dummy_resolved_address.len = 0;
+ (*r->addresses)->emplace_back(dummy_resolved_address, nullptr);
}
GRPC_CLOSURE_SCHED(r->on_done, GRPC_ERROR_NONE);
} else {
diff --git a/test/core/iomgr/resolve_address_posix_test.cc b/test/core/iomgr/resolve_address_posix_test.cc
index ceeb70a108..5785c73e22 100644
--- a/test/core/iomgr/resolve_address_posix_test.cc
+++ b/test/core/iomgr/resolve_address_posix_test.cc
@@ -27,6 +27,8 @@
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
+#include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/iomgr/executor.h"
@@ -163,8 +165,15 @@ int main(int argc, char** argv) {
{
grpc_core::ExecCtx exec_ctx;
- test_unix_socket();
- test_unix_socket_path_name_too_long();
+ char* resolver_env = gpr_getenv("GRPC_DNS_RESOLVER");
+ // c-ares resolver doesn't support UDS (ability for native DNS resolver
+ // to handle this is only expected to be used by servers, which
+ // unconditionally use the native DNS resolver).
+ if (resolver_env == nullptr || gpr_stricmp(resolver_env, "native") == 0) {
+ test_unix_socket();
+ test_unix_socket_path_name_too_long();
+ }
+ gpr_free(resolver_env);
}
grpc_shutdown();