aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/client_config
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-11-17 16:15:03 -0800
committerGravatar Craig Tiller <ctiller@google.com>2015-11-17 16:15:03 -0800
commit47b48459f3802af8aa7d5e4cbe2d4fda5cd16449 (patch)
treeb584a48d447077a4729b79eb20ff590ef6eebf88 /test/core/client_config
parent892c34a067bef8064a8de587c14198398f4fdc73 (diff)
Robustness work for lb_policies_test
Diffstat (limited to 'test/core/client_config')
-rw-r--r--test/core/client_config/lb_policies_test.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/test/core/client_config/lb_policies_test.c b/test/core/client_config/lb_policies_test.c
index 281d2b2ee1..4a469564bd 100644
--- a/test/core/client_config/lb_policies_test.c
+++ b/test/core/client_config/lb_policies_test.c
@@ -269,7 +269,7 @@ int *perform_request(servers_fixture *f, grpc_channel *client,
}
memset(s_valid, 0, f->num_servers * sizeof(int));
- deadline = n_millis_time(1000);
+ deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1);
c = grpc_channel_create_call(client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq,
"/foo", "foo.test.google.fr", deadline, NULL);
GPR_ASSERT(c);
@@ -304,7 +304,8 @@ int *perform_request(servers_fixture *f, grpc_channel *client,
grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL));
s_idx = -1;
- while ((ev = grpc_completion_queue_next(f->cq, n_millis_time(300), NULL))
+ while ((ev = grpc_completion_queue_next(
+ f->cq, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(2), NULL))
.type != GRPC_QUEUE_TIMEOUT) {
GPR_ASSERT(ev.type == GRPC_OP_COMPLETE);
read_tag = ((int)(gpr_intptr)ev.tag);
@@ -316,6 +317,7 @@ int *perform_request(servers_fixture *f, grpc_channel *client,
s_idx = read_tag - 1000;
s_valid[s_idx] = 1;
connection_sequence[iter_num] = s_idx;
+ break;
} else if (read_tag == 1) {
gpr_log(GPR_DEBUG, "client timed out");
GPR_ASSERT(ev.success);
@@ -453,6 +455,8 @@ void run_spec(const test_spec *spec) {
int *actual_connection_sequence;
request_data rdata;
servers_fixture *f;
+ grpc_channel_args args;
+ grpc_arg arg;
rdata.call_details =
gpr_malloc(sizeof(grpc_call_details) * spec->num_servers);
f = setup_servers("127.0.0.1", &rdata, spec->num_servers);
@@ -462,7 +466,14 @@ void run_spec(const test_spec *spec) {
f->num_servers, ",", NULL);
gpr_asprintf(&client_hostport, "ipv4:%s?lb_policy=round_robin",
servers_hostports_str);
- client = grpc_insecure_channel_create(client_hostport, NULL, NULL);
+
+ arg.type = GRPC_ARG_INTEGER;
+ arg.key = "grpc.testing.fixed_reconnect_backoff";
+ arg.value.integer = 100;
+ args.num_args = 1;
+ args.args = &arg;
+
+ client = grpc_insecure_channel_create(client_hostport, &args, NULL);
gpr_log(GPR_INFO, "Testing '%s' with servers=%s client=%s", spec->description,
servers_hostports_str, client_hostport);