aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/client_channel/resolvers
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2017-11-03 09:09:36 -0700
committerGravatar Craig Tiller <ctiller@google.com>2017-11-03 09:09:36 -0700
commitbaa14a975ef92ee6fb301f0e684f56f18f2c55a7 (patch)
tree9a6cb2df58fe175e8abfccf2cbd40349726e46f3 /test/core/client_channel/resolvers
parentef68fe7239a89095f1eaa89c1dd28b2b7be2a3c7 (diff)
Update clang-format to 5.0
Diffstat (limited to 'test/core/client_channel/resolvers')
-rw-r--r--test/core/client_channel/resolvers/dns_resolver_connectivity_test.c81
-rw-r--r--test/core/client_channel/resolvers/dns_resolver_test.c18
-rw-r--r--test/core/client_channel/resolvers/fake_resolver_test.c50
-rw-r--r--test/core/client_channel/resolvers/sockaddr_resolver_test.c26
4 files changed, 88 insertions, 87 deletions
diff --git a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.c b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.c
index 4597285063..cefbaa81dc 100644
--- a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.c
+++ b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.c
@@ -33,16 +33,16 @@
static gpr_mu g_mu;
static bool g_fail_resolution = true;
-static grpc_combiner *g_combiner;
+static grpc_combiner* g_combiner;
-static void my_resolve_address(grpc_exec_ctx *exec_ctx, const char *addr,
- const char *default_port,
- grpc_pollset_set *interested_parties,
- grpc_closure *on_done,
- grpc_resolved_addresses **addrs) {
+static void my_resolve_address(grpc_exec_ctx* exec_ctx, const char* addr,
+ const char* default_port,
+ grpc_pollset_set* interested_parties,
+ grpc_closure* on_done,
+ grpc_resolved_addresses** addrs) {
gpr_mu_lock(&g_mu);
GPR_ASSERT(0 == strcmp("test", addr));
- grpc_error *error = GRPC_ERROR_NONE;
+ grpc_error* error = GRPC_ERROR_NONE;
if (g_fail_resolution) {
g_fail_resolution = false;
gpr_mu_unlock(&g_mu);
@@ -57,14 +57,14 @@ static void my_resolve_address(grpc_exec_ctx *exec_ctx, const char *addr,
GRPC_CLOSURE_SCHED(exec_ctx, on_done, error);
}
-static grpc_ares_request *my_dns_lookup_ares(
- grpc_exec_ctx *exec_ctx, const char *dns_server, const char *addr,
- const char *default_port, grpc_pollset_set *interested_parties,
- grpc_closure *on_done, grpc_lb_addresses **lb_addrs, bool check_grpclb,
- char **service_config_json) {
+static grpc_ares_request* my_dns_lookup_ares(
+ grpc_exec_ctx* exec_ctx, const char* dns_server, const char* addr,
+ const char* default_port, grpc_pollset_set* interested_parties,
+ grpc_closure* on_done, grpc_lb_addresses** lb_addrs, bool check_grpclb,
+ char** service_config_json) {
gpr_mu_lock(&g_mu);
GPR_ASSERT(0 == strcmp("test", addr));
- grpc_error *error = GRPC_ERROR_NONE;
+ grpc_error* error = GRPC_ERROR_NONE;
if (g_fail_resolution) {
g_fail_resolution = false;
gpr_mu_unlock(&g_mu);
@@ -78,28 +78,28 @@ static grpc_ares_request *my_dns_lookup_ares(
return NULL;
}
-static grpc_resolver *create_resolver(grpc_exec_ctx *exec_ctx,
- const char *name) {
- grpc_resolver_factory *factory = grpc_resolver_factory_lookup("dns");
- grpc_uri *uri = grpc_uri_parse(exec_ctx, name, 0);
+static grpc_resolver* create_resolver(grpc_exec_ctx* exec_ctx,
+ const char* name) {
+ grpc_resolver_factory* factory = grpc_resolver_factory_lookup("dns");
+ grpc_uri* uri = grpc_uri_parse(exec_ctx, name, 0);
GPR_ASSERT(uri);
grpc_resolver_args args;
memset(&args, 0, sizeof(args));
args.uri = uri;
args.combiner = g_combiner;
- grpc_resolver *resolver =
+ grpc_resolver* resolver =
grpc_resolver_factory_create_resolver(exec_ctx, factory, &args);
grpc_resolver_factory_unref(factory);
grpc_uri_destroy(uri);
return resolver;
}
-static void on_done(grpc_exec_ctx *exec_ctx, void *ev, grpc_error *error) {
- gpr_event_set(ev, (void *)1);
+static void on_done(grpc_exec_ctx* exec_ctx, void* ev, grpc_error* error) {
+ gpr_event_set(ev, (void*)1);
}
// interleave waiting for an event with a timer check
-static bool wait_loop(int deadline_seconds, gpr_event *ev) {
+static bool wait_loop(int deadline_seconds, gpr_event* ev) {
while (deadline_seconds) {
gpr_log(GPR_DEBUG, "Test: waiting for %d more seconds", deadline_seconds);
if (gpr_event_wait(ev, grpc_timeout_seconds_to_deadline(1))) return true;
@@ -113,34 +113,35 @@ static bool wait_loop(int deadline_seconds, gpr_event *ev) {
}
typedef struct next_args {
- grpc_resolver *resolver;
- grpc_channel_args **result;
- grpc_closure *on_complete;
+ grpc_resolver* resolver;
+ grpc_channel_args** result;
+ grpc_closure* on_complete;
} next_args;
-static void call_resolver_next_now_lock_taken(grpc_exec_ctx *exec_ctx,
- void *arg,
- grpc_error *error_unused) {
- next_args *a = arg;
+static void call_resolver_next_now_lock_taken(grpc_exec_ctx* exec_ctx,
+ void* arg,
+ grpc_error* error_unused) {
+ next_args* a = arg;
grpc_resolver_next_locked(exec_ctx, a->resolver, a->result, a->on_complete);
gpr_free(a);
}
-static void call_resolver_next_after_locking(grpc_exec_ctx *exec_ctx,
- grpc_resolver *resolver,
- grpc_channel_args **result,
- grpc_closure *on_complete) {
- next_args *a = gpr_malloc(sizeof(*a));
+static void call_resolver_next_after_locking(grpc_exec_ctx* exec_ctx,
+ grpc_resolver* resolver,
+ grpc_channel_args** result,
+ grpc_closure* on_complete) {
+ next_args* a = gpr_malloc(sizeof(*a));
a->resolver = resolver;
a->result = result;
a->on_complete = on_complete;
- GRPC_CLOSURE_SCHED(exec_ctx, GRPC_CLOSURE_CREATE(
- call_resolver_next_now_lock_taken, a,
- grpc_combiner_scheduler(resolver->combiner)),
- GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(
+ exec_ctx,
+ GRPC_CLOSURE_CREATE(call_resolver_next_now_lock_taken, a,
+ grpc_combiner_scheduler(resolver->combiner)),
+ GRPC_ERROR_NONE);
}
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
grpc_test_init(argc, argv);
grpc_init();
@@ -148,10 +149,10 @@ int main(int argc, char **argv) {
g_combiner = grpc_combiner_create();
grpc_resolve_address = my_resolve_address;
grpc_dns_lookup_ares = my_dns_lookup_ares;
- grpc_channel_args *result = (grpc_channel_args *)1;
+ grpc_channel_args* result = (grpc_channel_args*)1;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_resolver *resolver = create_resolver(&exec_ctx, "dns:test");
+ grpc_resolver* resolver = create_resolver(&exec_ctx, "dns:test");
gpr_event ev1;
gpr_event_init(&ev1);
call_resolver_next_after_locking(
diff --git a/test/core/client_channel/resolvers/dns_resolver_test.c b/test/core/client_channel/resolvers/dns_resolver_test.c
index a14926f173..ef3c1b8216 100644
--- a/test/core/client_channel/resolvers/dns_resolver_test.c
+++ b/test/core/client_channel/resolvers/dns_resolver_test.c
@@ -25,13 +25,13 @@
#include "src/core/lib/iomgr/combiner.h"
#include "test/core/util/test_config.h"
-static grpc_combiner *g_combiner;
+static grpc_combiner* g_combiner;
-static void test_succeeds(grpc_resolver_factory *factory, const char *string) {
+static void test_succeeds(grpc_resolver_factory* factory, const char* string) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_uri *uri = grpc_uri_parse(&exec_ctx, string, 0);
+ grpc_uri* uri = grpc_uri_parse(&exec_ctx, string, 0);
grpc_resolver_args args;
- grpc_resolver *resolver;
+ grpc_resolver* resolver;
gpr_log(GPR_DEBUG, "test: '%s' should be valid for '%s'", string,
factory->vtable->scheme);
GPR_ASSERT(uri);
@@ -45,11 +45,11 @@ static void test_succeeds(grpc_resolver_factory *factory, const char *string) {
grpc_exec_ctx_finish(&exec_ctx);
}
-static void test_fails(grpc_resolver_factory *factory, const char *string) {
+static void test_fails(grpc_resolver_factory* factory, const char* string) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_uri *uri = grpc_uri_parse(&exec_ctx, string, 0);
+ grpc_uri* uri = grpc_uri_parse(&exec_ctx, string, 0);
grpc_resolver_args args;
- grpc_resolver *resolver;
+ grpc_resolver* resolver;
gpr_log(GPR_DEBUG, "test: '%s' should be invalid for '%s'", string,
factory->vtable->scheme);
GPR_ASSERT(uri);
@@ -62,8 +62,8 @@ static void test_fails(grpc_resolver_factory *factory, const char *string) {
grpc_exec_ctx_finish(&exec_ctx);
}
-int main(int argc, char **argv) {
- grpc_resolver_factory *dns;
+int main(int argc, char** argv) {
+ grpc_resolver_factory* dns;
grpc_test_init(argc, argv);
grpc_init();
diff --git a/test/core/client_channel/resolvers/fake_resolver_test.c b/test/core/client_channel/resolvers/fake_resolver_test.c
index 9b0854d6d8..094cd7259d 100644
--- a/test/core/client_channel/resolvers/fake_resolver_test.c
+++ b/test/core/client_channel/resolvers/fake_resolver_test.c
@@ -32,10 +32,10 @@
#include "test/core/util/test_config.h"
-static grpc_resolver *build_fake_resolver(
- grpc_exec_ctx *exec_ctx, grpc_combiner *combiner,
- grpc_fake_resolver_response_generator *response_generator) {
- grpc_resolver_factory *factory = grpc_resolver_factory_lookup("fake");
+static grpc_resolver* build_fake_resolver(
+ grpc_exec_ctx* exec_ctx, grpc_combiner* combiner,
+ grpc_fake_resolver_response_generator* response_generator) {
+ grpc_resolver_factory* factory = grpc_resolver_factory_lookup("fake");
grpc_arg generator_arg =
grpc_fake_resolver_response_generator_arg(response_generator);
grpc_resolver_args args;
@@ -43,50 +43,50 @@ static grpc_resolver *build_fake_resolver(
grpc_channel_args channel_args = {1, &generator_arg};
args.args = &channel_args;
args.combiner = combiner;
- grpc_resolver *resolver =
+ grpc_resolver* resolver =
grpc_resolver_factory_create_resolver(exec_ctx, factory, &args);
grpc_resolver_factory_unref(factory);
return resolver;
}
typedef struct on_resolution_arg {
- grpc_channel_args *resolver_result;
- grpc_channel_args *expected_resolver_result;
+ grpc_channel_args* resolver_result;
+ grpc_channel_args* expected_resolver_result;
gpr_event ev;
} on_resolution_arg;
-void on_resolution_cb(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
- on_resolution_arg *res = arg;
+void on_resolution_cb(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {
+ on_resolution_arg* res = arg;
// We only check the addresses channel arg because that's the only one
// explicitly set by the test via
// grpc_fake_resolver_response_generator_set_response.
- const grpc_lb_addresses *actual_lb_addresses =
+ const grpc_lb_addresses* actual_lb_addresses =
grpc_lb_addresses_find_channel_arg(res->resolver_result);
- const grpc_lb_addresses *expected_lb_addresses =
+ const grpc_lb_addresses* expected_lb_addresses =
grpc_lb_addresses_find_channel_arg(res->expected_resolver_result);
GPR_ASSERT(
grpc_lb_addresses_cmp(actual_lb_addresses, expected_lb_addresses) == 0);
grpc_channel_args_destroy(exec_ctx, res->resolver_result);
grpc_channel_args_destroy(exec_ctx, res->expected_resolver_result);
- gpr_event_set(&res->ev, (void *)1);
+ gpr_event_set(&res->ev, (void*)1);
}
static void test_fake_resolver() {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_combiner *combiner = grpc_combiner_create();
+ grpc_combiner* combiner = grpc_combiner_create();
// Create resolver.
- grpc_fake_resolver_response_generator *response_generator =
+ grpc_fake_resolver_response_generator* response_generator =
grpc_fake_resolver_response_generator_create();
- grpc_resolver *resolver =
+ grpc_resolver* resolver =
build_fake_resolver(&exec_ctx, combiner, response_generator);
GPR_ASSERT(resolver != NULL);
// Setup expectations.
- grpc_uri *uris[] = {grpc_uri_parse(&exec_ctx, "ipv4:10.2.1.1:1234", true),
+ grpc_uri* uris[] = {grpc_uri_parse(&exec_ctx, "ipv4:10.2.1.1:1234", true),
grpc_uri_parse(&exec_ctx, "ipv4:127.0.0.1:4321", true)};
- char *balancer_names[] = {"name1", "name2"};
+ char* balancer_names[] = {"name1", "name2"};
const bool is_balancer[] = {true, false};
- grpc_lb_addresses *addresses = grpc_lb_addresses_create(3, NULL);
+ grpc_lb_addresses* addresses = grpc_lb_addresses_create(3, NULL);
for (size_t i = 0; i < GPR_ARRAY_SIZE(uris); ++i) {
grpc_lb_addresses_set_address_from_uri(
addresses, i, uris[i], is_balancer[i], balancer_names[i], NULL);
@@ -94,14 +94,14 @@ static void test_fake_resolver() {
}
const grpc_arg addresses_arg =
grpc_lb_addresses_create_channel_arg(addresses);
- grpc_channel_args *results =
+ grpc_channel_args* results =
grpc_channel_args_copy_and_add(NULL, &addresses_arg, 1);
grpc_lb_addresses_destroy(&exec_ctx, addresses);
on_resolution_arg on_res_arg;
memset(&on_res_arg, 0, sizeof(on_res_arg));
on_res_arg.expected_resolver_result = results;
gpr_event_init(&on_res_arg.ev);
- grpc_closure *on_resolution = GRPC_CLOSURE_CREATE(
+ grpc_closure* on_resolution = GRPC_CLOSURE_CREATE(
on_resolution_cb, &on_res_arg, grpc_combiner_scheduler(combiner));
// Set resolver results and trigger first resolution. on_resolution_cb
@@ -115,11 +115,11 @@ static void test_fake_resolver() {
grpc_timeout_seconds_to_deadline(5)) != NULL);
// Setup update.
- grpc_uri *uris_update[] = {
+ grpc_uri* uris_update[] = {
grpc_uri_parse(&exec_ctx, "ipv4:192.168.1.0:31416", true)};
- char *balancer_names_update[] = {"name3"};
+ char* balancer_names_update[] = {"name3"};
const bool is_balancer_update[] = {false};
- grpc_lb_addresses *addresses_update = grpc_lb_addresses_create(1, NULL);
+ grpc_lb_addresses* addresses_update = grpc_lb_addresses_create(1, NULL);
for (size_t i = 0; i < GPR_ARRAY_SIZE(uris_update); ++i) {
grpc_lb_addresses_set_address_from_uri(addresses_update, i, uris_update[i],
is_balancer_update[i],
@@ -129,7 +129,7 @@ static void test_fake_resolver() {
grpc_arg addresses_update_arg =
grpc_lb_addresses_create_channel_arg(addresses_update);
- grpc_channel_args *results_update =
+ grpc_channel_args* results_update =
grpc_channel_args_copy_and_add(NULL, &addresses_update_arg, 1);
grpc_lb_addresses_destroy(&exec_ctx, addresses_update);
@@ -166,7 +166,7 @@ static void test_fake_resolver() {
grpc_fake_resolver_response_generator_unref(response_generator);
}
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
grpc_test_init(argc, argv);
grpc_init();
diff --git a/test/core/client_channel/resolvers/sockaddr_resolver_test.c b/test/core/client_channel/resolvers/sockaddr_resolver_test.c
index 8b88619164..99ba84c1ea 100644
--- a/test/core/client_channel/resolvers/sockaddr_resolver_test.c
+++ b/test/core/client_channel/resolvers/sockaddr_resolver_test.c
@@ -28,23 +28,23 @@
#include "test/core/util/test_config.h"
-static grpc_combiner *g_combiner;
+static grpc_combiner* g_combiner;
typedef struct on_resolution_arg {
- char *expected_server_name;
- grpc_channel_args *resolver_result;
+ char* expected_server_name;
+ grpc_channel_args* resolver_result;
} on_resolution_arg;
-void on_resolution_cb(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
- on_resolution_arg *res = arg;
+void on_resolution_cb(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {
+ on_resolution_arg* res = arg;
grpc_channel_args_destroy(exec_ctx, res->resolver_result);
}
-static void test_succeeds(grpc_resolver_factory *factory, const char *string) {
+static void test_succeeds(grpc_resolver_factory* factory, const char* string) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_uri *uri = grpc_uri_parse(&exec_ctx, string, 0);
+ grpc_uri* uri = grpc_uri_parse(&exec_ctx, string, 0);
grpc_resolver_args args;
- grpc_resolver *resolver;
+ grpc_resolver* resolver;
gpr_log(GPR_DEBUG, "test: '%s' should be valid for '%s'", string,
factory->vtable->scheme);
GPR_ASSERT(uri);
@@ -57,7 +57,7 @@ static void test_succeeds(grpc_resolver_factory *factory, const char *string) {
on_resolution_arg on_res_arg;
memset(&on_res_arg, 0, sizeof(on_res_arg));
on_res_arg.expected_server_name = uri->path;
- grpc_closure *on_resolution = GRPC_CLOSURE_CREATE(
+ grpc_closure* on_resolution = GRPC_CLOSURE_CREATE(
on_resolution_cb, &on_res_arg, grpc_schedule_on_exec_ctx);
grpc_resolver_next_locked(&exec_ctx, resolver, &on_res_arg.resolver_result,
@@ -67,11 +67,11 @@ static void test_succeeds(grpc_resolver_factory *factory, const char *string) {
grpc_uri_destroy(uri);
}
-static void test_fails(grpc_resolver_factory *factory, const char *string) {
+static void test_fails(grpc_resolver_factory* factory, const char* string) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_uri *uri = grpc_uri_parse(&exec_ctx, string, 0);
+ grpc_uri* uri = grpc_uri_parse(&exec_ctx, string, 0);
grpc_resolver_args args;
- grpc_resolver *resolver;
+ grpc_resolver* resolver;
gpr_log(GPR_DEBUG, "test: '%s' should be invalid for '%s'", string,
factory->vtable->scheme);
GPR_ASSERT(uri);
@@ -84,7 +84,7 @@ static void test_fails(grpc_resolver_factory *factory, const char *string) {
grpc_exec_ctx_finish(&exec_ctx);
}
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
grpc_resolver_factory *ipv4, *ipv6;
grpc_test_init(argc, argv);
grpc_init();