aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/grpclb
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2016-07-29 14:33:15 -0700
committerGravatar David Garcia Quintas <dgq@google.com>2016-07-29 14:38:25 -0700
commit4166cb06ea6b633a6590073a49cc3b8a05caca90 (patch)
tree0b1e37b1e2b92480d561bfa99bfd6078d6494c6d /test/cpp/grpclb
parent6531826a56eb8d9a7daf085e0bc28c760952cefa (diff)
Addressed the rest of the PR comments
Diffstat (limited to 'test/cpp/grpclb')
-rw-r--r--test/cpp/grpclb/grpclb_test.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/test/cpp/grpclb/grpclb_test.cc b/test/cpp/grpclb/grpclb_test.cc
index f5b678ef1d..3c193d2b02 100644
--- a/test/cpp/grpclb/grpclb_test.cc
+++ b/test/cpp/grpclb/grpclb_test.cc
@@ -98,10 +98,6 @@ typedef struct test_fixture {
int lb_server_update_delay_ms;
} test_fixture;
-static gpr_timespec n_seconds_time(int n) {
- return GRPC_TIMEOUT_SECONDS_TO_DEADLINE(n);
-}
-
static void *tag(intptr_t t) { return (void *)t; }
static gpr_slice build_response_payload_slice(
@@ -149,7 +145,8 @@ static gpr_slice build_response_payload_slice(
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
- ev = grpc_completion_queue_next(cq, n_seconds_time(5), NULL);
+ ev = grpc_completion_queue_next(cq, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
+ NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@@ -296,7 +293,8 @@ static void start_backend_server(server_fixture *sf) {
tag(100));
GPR_ASSERT(GRPC_CALL_OK == error);
gpr_log(GPR_INFO, "Server[%s] up", sf->servers_hostport);
- ev = grpc_completion_queue_next(sf->cq, n_seconds_time(60), NULL);
+ ev = grpc_completion_queue_next(sf->cq,
+ GRPC_TIMEOUT_SECONDS_TO_DEADLINE(60), NULL);
if (!ev.success) {
gpr_log(GPR_INFO, "Server[%s] being torn down", sf->servers_hostport);
cq_verifier_destroy(cqv);
@@ -334,7 +332,8 @@ static void start_backend_server(server_fixture *sf) {
op++;
error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
- ev = grpc_completion_queue_next(sf->cq, n_seconds_time(3), NULL);
+ ev = grpc_completion_queue_next(
+ sf->cq, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(3), NULL);
if (ev.type == GRPC_OP_COMPLETE && ev.success) {
GPR_ASSERT(ev.tag = tag(102));
if (request_payload_recv == NULL) {
@@ -363,7 +362,8 @@ static void start_backend_server(server_fixture *sf) {
error =
grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
- ev = grpc_completion_queue_next(sf->cq, n_seconds_time(3), NULL);
+ ev = grpc_completion_queue_next(
+ sf->cq, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(3), NULL);
if (ev.type == GRPC_OP_COMPLETE && ev.success) {
GPR_ASSERT(ev.tag = tag(103));
} else {
@@ -427,7 +427,7 @@ static void perform_request(client_fixture *cf) {
c = grpc_channel_create_call(cf->client, NULL, GRPC_PROPAGATE_DEFAULTS,
cf->cq, "/foo", "foo.test.google.fr:1234",
- n_seconds_time(1000), NULL);
+ GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1000), NULL);
gpr_log(GPR_INFO, "Call 0x%" PRIxPTR " created", (intptr_t)c);
GPR_ASSERT(c);
char *peer;