aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-03-31 13:08:49 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-03-31 13:08:49 -0700
commit65938df105732f9be3d379b69fbea91262761a23 (patch)
tree767c01531730de178d9a6f50ce0a31154da4d5b9 /test/core
parentf3f099ada9dedd941e5a3f7a506a8152bab34a93 (diff)
Optionalize name resolvers
Diffstat (limited to 'test/core')
-rw-r--r--test/core/client_config/resolvers/dns_resolver_connectivity_test.c5
-rw-r--r--test/core/client_config/resolvers/dns_resolver_test.c8
-rw-r--r--test/core/client_config/resolvers/sockaddr_resolver_test.c10
3 files changed, 11 insertions, 12 deletions
diff --git a/test/core/client_config/resolvers/dns_resolver_connectivity_test.c b/test/core/client_config/resolvers/dns_resolver_connectivity_test.c
index dc6a614d55..d88a46ce7b 100644
--- a/test/core/client_config/resolvers/dns_resolver_connectivity_test.c
+++ b/test/core/client_config/resolvers/dns_resolver_connectivity_test.c
@@ -31,13 +31,12 @@
*
*/
-#include "src/core/lib/client_config/resolvers/dns_resolver.h"
-
#include <string.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
+#include "src/core/lib/client_config/resolver_registry.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/timer.h"
#include "test/core/util/test_config.h"
@@ -79,7 +78,7 @@ static grpc_resolved_addresses *my_resolve_address(const char *name,
}
static grpc_resolver *create_resolver(const char *name) {
- grpc_resolver_factory *factory = grpc_dns_resolver_factory_create();
+ grpc_resolver_factory *factory = grpc_resolver_factory_lookup("dns");
grpc_uri *uri = grpc_uri_parse(name, 0);
GPR_ASSERT(uri);
grpc_resolver_args args;
diff --git a/test/core/client_config/resolvers/dns_resolver_test.c b/test/core/client_config/resolvers/dns_resolver_test.c
index 6c7a6b27e4..518403a0cf 100644
--- a/test/core/client_config/resolvers/dns_resolver_test.c
+++ b/test/core/client_config/resolvers/dns_resolver_test.c
@@ -31,13 +31,11 @@
*
*/
-#include "src/core/lib/client_config/resolvers/dns_resolver.h"
-
#include <string.h>
#include <grpc/support/log.h>
-#include "src/core/lib/client_config/resolver.h"
+#include "src/core/lib/client_config/resolver_registry.h"
#include "test/core/util/test_config.h"
static void subchannel_factory_ref(grpc_subchannel_factory *scv) {}
@@ -92,8 +90,9 @@ static void test_fails(grpc_resolver_factory *factory, const char *string) {
int main(int argc, char **argv) {
grpc_resolver_factory *dns;
grpc_test_init(argc, argv);
+ grpc_init();
- dns = grpc_dns_resolver_factory_create();
+ dns = grpc_resolver_factory_lookup("dns");
test_succeeds(dns, "dns:10.2.1.1");
test_succeeds(dns, "dns:10.2.1.1:1234");
@@ -101,6 +100,7 @@ int main(int argc, char **argv) {
test_fails(dns, "ipv4://8.8.8.8/8.8.8.8:8888");
grpc_resolver_factory_unref(dns);
+ grpc_shutdown();
return 0;
}
diff --git a/test/core/client_config/resolvers/sockaddr_resolver_test.c b/test/core/client_config/resolvers/sockaddr_resolver_test.c
index fafddfd166..6ae830e345 100644
--- a/test/core/client_config/resolvers/sockaddr_resolver_test.c
+++ b/test/core/client_config/resolvers/sockaddr_resolver_test.c
@@ -31,13 +31,11 @@
*
*/
-#include "src/core/lib/client_config/resolvers/sockaddr_resolver.h"
-
#include <string.h>
#include <grpc/support/log.h>
-#include "src/core/lib/client_config/resolver.h"
+#include "src/core/lib/client_config/resolver_registry.h"
#include "test/core/util/test_config.h"
static void subchannel_factory_ref(grpc_subchannel_factory *scv) {}
@@ -92,9 +90,10 @@ static void test_fails(grpc_resolver_factory *factory, const char *string) {
int main(int argc, char **argv) {
grpc_resolver_factory *ipv4, *ipv6;
grpc_test_init(argc, argv);
+ grpc_init();
- ipv4 = grpc_ipv4_resolver_factory_create();
- ipv6 = grpc_ipv6_resolver_factory_create();
+ ipv4 = grpc_resolver_factory_lookup("ipv4");
+ ipv6 = grpc_resolver_factory_lookup("ipv6");
test_fails(ipv4, "ipv4:10.2.1.1");
test_succeeds(ipv4, "ipv4:10.2.1.1:1234");
@@ -111,6 +110,7 @@ int main(int argc, char **argv) {
grpc_resolver_factory_unref(ipv4);
grpc_resolver_factory_unref(ipv6);
+ grpc_shutdown();
return 0;
}