aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/client_config
diff options
context:
space:
mode:
Diffstat (limited to 'test/core/client_config')
-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.c11
-rw-r--r--test/core/client_config/uri_parser_test.c17
4 files changed, 29 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 c791ad4e57..b7c3b78fe1 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 043b882184..0e8a3b13dd 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 e23616ca23..b2c4c63b79 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,12 +90,14 @@ 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");
+ test_succeeds(ipv4, "ipv4:10.2.1.1:1234,127.0.0.1:4321");
test_fails(ipv4, "ipv4:10.2.1.1:123456");
test_fails(ipv4, "ipv4:www.google.com");
test_fails(ipv4, "ipv4:[");
@@ -111,6 +111,7 @@ int main(int argc, char **argv) {
grpc_resolver_factory_unref(ipv4);
grpc_resolver_factory_unref(ipv6);
+ grpc_shutdown();
return 0;
}
diff --git a/test/core/client_config/uri_parser_test.c b/test/core/client_config/uri_parser_test.c
index 37b82aeded..f87aa81ee6 100644
--- a/test/core/client_config/uri_parser_test.c
+++ b/test/core/client_config/uri_parser_test.c
@@ -89,6 +89,23 @@ static void test_query_parts() {
grpc_uri_destroy(uri);
}
{
+ /* test the current behavior of multiple query part values */
+ const char *uri_text = "http://auth/path?foo=bar=baz&foobar==";
+ grpc_uri *uri = grpc_uri_parse(uri_text, 0);
+ GPR_ASSERT(uri);
+
+ GPR_ASSERT(0 == strcmp("http", uri->scheme));
+ GPR_ASSERT(0 == strcmp("auth", uri->authority));
+ GPR_ASSERT(0 == strcmp("/path", uri->path));
+ GPR_ASSERT(0 == strcmp("foo=bar=baz&foobar==", uri->query));
+ GPR_ASSERT(2 == uri->num_query_parts);
+
+ GPR_ASSERT(0 == strcmp("bar", grpc_uri_get_query_arg(uri, "foo")));
+ GPR_ASSERT(0 == strcmp("", grpc_uri_get_query_arg(uri, "foobar")));
+
+ grpc_uri_destroy(uri);
+ }
+ {
/* empty query */
const char *uri_text = "http://foo/path";
grpc_uri *uri = grpc_uri_parse(uri_text, 0);