|
|
@ -287,10 +287,17 @@ void TestCancelDuringActiveQuery( |
|
|
|
query_timeout_setting); |
|
|
|
query_timeout_setting); |
|
|
|
grpc_channel_args* client_args = nullptr; |
|
|
|
grpc_channel_args* client_args = nullptr; |
|
|
|
grpc_status_code expected_status_code = GRPC_STATUS_OK; |
|
|
|
grpc_status_code expected_status_code = GRPC_STATUS_OK; |
|
|
|
|
|
|
|
gpr_timespec rpc_deadline; |
|
|
|
if (query_timeout_setting == NONE) { |
|
|
|
if (query_timeout_setting == NONE) { |
|
|
|
|
|
|
|
// The RPC deadline should go off well before the DNS resolution
|
|
|
|
|
|
|
|
// timeout fires.
|
|
|
|
expected_status_code = GRPC_STATUS_DEADLINE_EXCEEDED; |
|
|
|
expected_status_code = GRPC_STATUS_DEADLINE_EXCEEDED; |
|
|
|
|
|
|
|
// use default DNS resolution timeout (which is over one minute).
|
|
|
|
client_args = nullptr; |
|
|
|
client_args = nullptr; |
|
|
|
|
|
|
|
rpc_deadline = grpc_timeout_milliseconds_to_deadline(100); |
|
|
|
} else if (query_timeout_setting == SHORT) { |
|
|
|
} else if (query_timeout_setting == SHORT) { |
|
|
|
|
|
|
|
// The DNS resolution timeout should fire well before the
|
|
|
|
|
|
|
|
// RPC's deadline expires.
|
|
|
|
expected_status_code = GRPC_STATUS_UNAVAILABLE; |
|
|
|
expected_status_code = GRPC_STATUS_UNAVAILABLE; |
|
|
|
grpc_arg arg; |
|
|
|
grpc_arg arg; |
|
|
|
arg.type = GRPC_ARG_INTEGER; |
|
|
|
arg.type = GRPC_ARG_INTEGER; |
|
|
@ -298,13 +305,21 @@ void TestCancelDuringActiveQuery( |
|
|
|
arg.value.integer = |
|
|
|
arg.value.integer = |
|
|
|
1; // Set this shorter than the call deadline so that it goes off.
|
|
|
|
1; // Set this shorter than the call deadline so that it goes off.
|
|
|
|
client_args = grpc_channel_args_copy_and_add(nullptr, &arg, 1); |
|
|
|
client_args = grpc_channel_args_copy_and_add(nullptr, &arg, 1); |
|
|
|
|
|
|
|
// Set the deadline high enough such that if we hit this and get
|
|
|
|
|
|
|
|
// a deadline exceeded status code, then we are confident that there's
|
|
|
|
|
|
|
|
// a bug causing cancellation of DNS resolutions to not happen in a timely
|
|
|
|
|
|
|
|
// manner.
|
|
|
|
|
|
|
|
rpc_deadline = grpc_timeout_seconds_to_deadline(10); |
|
|
|
} else if (query_timeout_setting == ZERO) { |
|
|
|
} else if (query_timeout_setting == ZERO) { |
|
|
|
|
|
|
|
// The RPC deadline should go off well before the DNS resolution
|
|
|
|
|
|
|
|
// timeout fires.
|
|
|
|
expected_status_code = GRPC_STATUS_DEADLINE_EXCEEDED; |
|
|
|
expected_status_code = GRPC_STATUS_DEADLINE_EXCEEDED; |
|
|
|
grpc_arg arg; |
|
|
|
grpc_arg arg; |
|
|
|
arg.type = GRPC_ARG_INTEGER; |
|
|
|
arg.type = GRPC_ARG_INTEGER; |
|
|
|
arg.key = const_cast<char*>(GRPC_ARG_DNS_ARES_QUERY_TIMEOUT_MS); |
|
|
|
arg.key = const_cast<char*>(GRPC_ARG_DNS_ARES_QUERY_TIMEOUT_MS); |
|
|
|
arg.value.integer = 0; // Set this to zero to disable query timeouts.
|
|
|
|
arg.value.integer = 0; // Set this to zero to disable query timeouts.
|
|
|
|
client_args = grpc_channel_args_copy_and_add(nullptr, &arg, 1); |
|
|
|
client_args = grpc_channel_args_copy_and_add(nullptr, &arg, 1); |
|
|
|
|
|
|
|
rpc_deadline = grpc_timeout_milliseconds_to_deadline(100); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
abort(); |
|
|
|
abort(); |
|
|
|
} |
|
|
|
} |
|
|
@ -312,10 +327,9 @@ void TestCancelDuringActiveQuery( |
|
|
|
grpc_insecure_channel_create(client_target.c_str(), client_args, nullptr); |
|
|
|
grpc_insecure_channel_create(client_target.c_str(), client_args, nullptr); |
|
|
|
grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr); |
|
|
|
grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr); |
|
|
|
cq_verifier* cqv = cq_verifier_create(cq); |
|
|
|
cq_verifier* cqv = cq_verifier_create(cq); |
|
|
|
gpr_timespec deadline = grpc_timeout_milliseconds_to_deadline(100); |
|
|
|
|
|
|
|
grpc_call* call = grpc_channel_create_call( |
|
|
|
grpc_call* call = grpc_channel_create_call( |
|
|
|
client, nullptr, GRPC_PROPAGATE_DEFAULTS, cq, |
|
|
|
client, nullptr, GRPC_PROPAGATE_DEFAULTS, cq, |
|
|
|
grpc_slice_from_static_string("/foo"), nullptr, deadline, nullptr); |
|
|
|
grpc_slice_from_static_string("/foo"), nullptr, rpc_deadline, nullptr); |
|
|
|
GPR_ASSERT(call); |
|
|
|
GPR_ASSERT(call); |
|
|
|
grpc_metadata_array initial_metadata_recv; |
|
|
|
grpc_metadata_array initial_metadata_recv; |
|
|
|
grpc_metadata_array trailing_metadata_recv; |
|
|
|
grpc_metadata_array trailing_metadata_recv; |
|
|
|