diff options
Diffstat (limited to 'test/core/end2end')
-rw-r--r-- | test/core/end2end/fixtures/h2_ssl_cert.c | 2 | ||||
-rw-r--r-- | test/core/end2end/fixtures/http_proxy_fixture.c | 10 | ||||
-rw-r--r-- | test/core/end2end/fuzzers/api_fuzzer.c | 22 | ||||
-rw-r--r-- | test/core/end2end/invalid_call_argument_test.c | 2 | ||||
-rw-r--r-- | test/core/end2end/tests/bad_ping.c | 17 | ||||
-rw-r--r-- | test/core/end2end/tests/keepalive_timeout.c | 26 |
6 files changed, 37 insertions, 42 deletions
diff --git a/test/core/end2end/fixtures/h2_ssl_cert.c b/test/core/end2end/fixtures/h2_ssl_cert.c index 9b1ddadfe4..f0a2ee5430 100644 --- a/test/core/end2end/fixtures/h2_ssl_cert.c +++ b/test/core/end2end/fixtures/h2_ssl_cert.c @@ -319,7 +319,7 @@ static void simple_request_body(grpc_end2end_test_fixture f, op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; - op->flags = 0; + op->flags = GRPC_INITIAL_METADATA_WAIT_FOR_READY; op->reserved = NULL; op++; error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); diff --git a/test/core/end2end/fixtures/http_proxy_fixture.c b/test/core/end2end/fixtures/http_proxy_fixture.c index a4cfc77bcb..d29401fdc3 100644 --- a/test/core/end2end/fixtures/http_proxy_fixture.c +++ b/test/core/end2end/fixtures/http_proxy_fixture.c @@ -412,8 +412,8 @@ static void on_read_request_done(grpc_exec_ctx* exec_ctx, void* arg, GPR_ASSERT(resolved_addresses->naddrs >= 1); // Connect to requested address. // The connection callback inherits our reference to conn. - const gpr_timespec deadline = gpr_time_add( - gpr_now(GPR_CLOCK_MONOTONIC), gpr_time_from_seconds(10, GPR_TIMESPAN)); + const grpc_millis deadline = + grpc_exec_ctx_now(exec_ctx) + 10 * GPR_MS_PER_SEC; grpc_tcp_client_connect(exec_ctx, &conn->on_server_connect_done, &conn->server_endpoint, conn->pollset_set, NULL, &resolved_addresses->addrs[0], deadline); @@ -469,14 +469,12 @@ static void thread_main(void* arg) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; do { gpr_ref(&proxy->users); - const gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC); - const gpr_timespec deadline = - gpr_time_add(now, gpr_time_from_seconds(1, GPR_TIMESPAN)); grpc_pollset_worker* worker = NULL; gpr_mu_lock(proxy->mu); GRPC_LOG_IF_ERROR( "grpc_pollset_work", - grpc_pollset_work(&exec_ctx, proxy->pollset, &worker, now, deadline)); + grpc_pollset_work(&exec_ctx, proxy->pollset, &worker, + grpc_exec_ctx_now(&exec_ctx) + GPR_MS_PER_SEC)); gpr_mu_unlock(proxy->mu); grpc_exec_ctx_flush(&exec_ctx); } while (!gpr_unref(&proxy->users)); diff --git a/test/core/end2end/fuzzers/api_fuzzer.c b/test/core/end2end/fuzzers/api_fuzzer.c index 1228c9fe9a..0a787bbf30 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.c +++ b/test/core/end2end/fuzzers/api_fuzzer.c @@ -60,7 +60,9 @@ extern gpr_timespec (*gpr_now_impl)(gpr_clock_type clock_type); static gpr_timespec now_impl(gpr_clock_type clock_type) { GPR_ASSERT(clock_type != GPR_TIMESPAN); - return g_now; + gpr_timespec ts = g_now; + ts.clock_type = clock_type; + return ts; } //////////////////////////////////////////////////////////////////////////////// @@ -407,10 +409,8 @@ void my_resolve_address(grpc_exec_ctx *exec_ctx, const char *addr, r->addrs = addresses; r->lb_addrs = NULL; grpc_timer_init( - exec_ctx, &r->timer, gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), - gpr_time_from_seconds(1, GPR_TIMESPAN)), - GRPC_CLOSURE_CREATE(finish_resolve, r, grpc_schedule_on_exec_ctx), - gpr_now(GPR_CLOCK_MONOTONIC)); + exec_ctx, &r->timer, GPR_MS_PER_SEC + grpc_exec_ctx_now(exec_ctx), + GRPC_CLOSURE_CREATE(finish_resolve, r, grpc_schedule_on_exec_ctx)); } grpc_ares_request *my_dns_lookup_ares( @@ -424,10 +424,8 @@ grpc_ares_request *my_dns_lookup_ares( r->addrs = NULL; r->lb_addrs = lb_addrs; grpc_timer_init( - exec_ctx, &r->timer, gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), - gpr_time_from_seconds(1, GPR_TIMESPAN)), - GRPC_CLOSURE_CREATE(finish_resolve, r, grpc_schedule_on_exec_ctx), - gpr_now(GPR_CLOCK_MONOTONIC)); + exec_ctx, &r->timer, GPR_MS_PER_SEC + grpc_exec_ctx_now(exec_ctx), + GRPC_CLOSURE_CREATE(finish_resolve, r, grpc_schedule_on_exec_ctx)); return NULL; } @@ -487,10 +485,8 @@ static void sched_connect(grpc_exec_ctx *exec_ctx, grpc_closure *closure, fc->ep = ep; fc->deadline = deadline; grpc_timer_init( - exec_ctx, &fc->timer, gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), - gpr_time_from_millis(1, GPR_TIMESPAN)), - GRPC_CLOSURE_CREATE(do_connect, fc, grpc_schedule_on_exec_ctx), - gpr_now(GPR_CLOCK_MONOTONIC)); + exec_ctx, &fc->timer, GPR_MS_PER_SEC + grpc_exec_ctx_now(exec_ctx), + GRPC_CLOSURE_CREATE(do_connect, fc, grpc_schedule_on_exec_ctx)); } static void my_tcp_client_connect(grpc_exec_ctx *exec_ctx, diff --git a/test/core/end2end/invalid_call_argument_test.c b/test/core/end2end/invalid_call_argument_test.c index bf0d08adec..e3fd5a8fbe 100644 --- a/test/core/end2end/invalid_call_argument_test.c +++ b/test/core/end2end/invalid_call_argument_test.c @@ -92,7 +92,7 @@ static void prepare_test(int is_client) { op = g_state.ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; - op->flags = 0; + op->flags = GRPC_INITIAL_METADATA_WAIT_FOR_READY; op->reserved = NULL; op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(g_state.call, g_state.ops, diff --git a/test/core/end2end/tests/bad_ping.c b/test/core/end2end/tests/bad_ping.c index c97d11b306..d442f12480 100644 --- a/test/core/end2end/tests/bad_ping.c +++ b/test/core/end2end/tests/bad_ping.c @@ -155,14 +155,16 @@ static void test_bad_ping(grpc_end2end_test_config config) { cq_verify(cqv); // Send too many pings to the server to trigger the punishment: - // The first ping is sent after data frames, it won't trigger a ping strike. - // Each of the following pings will trigger a ping strike, and we need at - // least (MAX_PING_STRIKES + 1) strikes to trigger the punishment. So - // (MAX_PING_STRIKES + 2) pings are needed here. + // Each ping will trigger a ping strike, and we need at least MAX_PING_STRIKES + // strikes to trigger the punishment. So (MAX_PING_STRIKES + 1) pings are + // needed here. int i; - for (i = 200; i < 202 + MAX_PING_STRIKES; i++) { - grpc_channel_ping(f.client, f.cq, tag(i), NULL); - CQ_EXPECT_COMPLETION(cqv, tag(i), 1); + for (i = 1; i <= MAX_PING_STRIKES + 1; i++) { + grpc_channel_ping(f.client, f.cq, tag(200 + i), NULL); + CQ_EXPECT_COMPLETION(cqv, tag(200 + i), 1); + if (i == MAX_PING_STRIKES + 1) { + CQ_EXPECT_COMPLETION(cqv, tag(1), 1); + } cq_verify(cqv); } @@ -190,7 +192,6 @@ static void test_bad_ping(grpc_end2end_test_config config) { GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); - CQ_EXPECT_COMPLETION(cqv, tag(1), 1); cq_verify(cqv); grpc_server_shutdown_and_notify(f.server, f.cq, tag(0xdead)); diff --git a/test/core/end2end/tests/keepalive_timeout.c b/test/core/end2end/tests/keepalive_timeout.c index 8d01f23c00..c4280149c7 100644 --- a/test/core/end2end/tests/keepalive_timeout.c +++ b/test/core/end2end/tests/keepalive_timeout.c @@ -98,21 +98,21 @@ static void test_keepalive_timeout(grpc_end2end_test_config config) { grpc_byte_buffer *response_payload = grpc_raw_byte_buffer_create(&response_payload_slice, 1); - grpc_arg keepalive_args[] = {{.type = GRPC_ARG_INTEGER, - .key = GRPC_ARG_KEEPALIVE_TIME_MS, - .value.integer = 1500}, - {.type = GRPC_ARG_INTEGER, - .key = GRPC_ARG_KEEPALIVE_TIMEOUT_MS, - .value.integer = 0}, - {.type = GRPC_ARG_INTEGER, - .key = GRPC_ARG_HTTP2_BDP_PROBE, - .value.integer = 0}}; - - grpc_channel_args client_args = {.num_args = GPR_ARRAY_SIZE(keepalive_args), - .args = keepalive_args}; + grpc_arg keepalive_arg_elems[] = {{.type = GRPC_ARG_INTEGER, + .key = GRPC_ARG_KEEPALIVE_TIME_MS, + .value.integer = 1500}, + {.type = GRPC_ARG_INTEGER, + .key = GRPC_ARG_KEEPALIVE_TIMEOUT_MS, + .value.integer = 0}, + {.type = GRPC_ARG_INTEGER, + .key = GRPC_ARG_HTTP2_BDP_PROBE, + .value.integer = 0}}; + grpc_channel_args keepalive_args = { + .num_args = GPR_ARRAY_SIZE(keepalive_arg_elems), + .args = keepalive_arg_elems}; grpc_end2end_test_fixture f = - begin_test(config, "keepalive_timeout", &client_args, NULL); + begin_test(config, "keepalive_timeout", &keepalive_args, NULL); cq_verifier *cqv = cq_verifier_create(f.cq); grpc_op ops[6]; grpc_op *op; |