aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/iomgr/resolve_address_posix_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/core/iomgr/resolve_address_posix_test.cc')
-rw-r--r--test/core/iomgr/resolve_address_posix_test.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/test/core/iomgr/resolve_address_posix_test.cc b/test/core/iomgr/resolve_address_posix_test.cc
index e495e4c877..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"
@@ -158,13 +160,20 @@ static void test_unix_socket_path_name_too_long(void) {
}
int main(int argc, char** argv) {
- grpc_test_init(argc, argv);
+ grpc::testing::TestEnvironment env(argc, argv);
grpc_init();
{
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();