|
|
|
@ -279,13 +279,14 @@ void TestCancelDuringActiveQuery( |
|
|
|
|
int fake_dns_port = grpc_pick_unused_port_or_die(); |
|
|
|
|
grpc::testing::FakeNonResponsiveDNSServer fake_dns_server(fake_dns_port); |
|
|
|
|
// Create a call that will try to use the fake DNS server
|
|
|
|
|
std::string client_target = absl::StrFormat( |
|
|
|
|
"dns://[::1]:%d/dont-care-since-wont-be-resolved.test.com:1234", |
|
|
|
|
fake_dns_port); |
|
|
|
|
std::string name = "dont-care-since-wont-be-resolved.test.com:1234"; |
|
|
|
|
std::string client_target = |
|
|
|
|
absl::StrFormat("dns://[::1]:%d/%s", fake_dns_port, name); |
|
|
|
|
gpr_log(GPR_DEBUG, "TestCancelActiveDNSQuery. query timeout setting: %d", |
|
|
|
|
query_timeout_setting); |
|
|
|
|
grpc_channel_args* client_args = nullptr; |
|
|
|
|
grpc_status_code expected_status_code = GRPC_STATUS_OK; |
|
|
|
|
std::string expected_error_message_substring; |
|
|
|
|
gpr_timespec rpc_deadline; |
|
|
|
|
if (query_timeout_setting == NONE) { |
|
|
|
|
// The RPC deadline should go off well before the DNS resolution
|
|
|
|
@ -298,6 +299,8 @@ void TestCancelDuringActiveQuery( |
|
|
|
|
// The DNS resolution timeout should fire well before the
|
|
|
|
|
// RPC's deadline expires.
|
|
|
|
|
expected_status_code = GRPC_STATUS_UNAVAILABLE; |
|
|
|
|
expected_error_message_substring = |
|
|
|
|
absl::StrCat("DNS resolution failed for ", name); |
|
|
|
|
grpc_arg arg; |
|
|
|
|
arg.type = GRPC_ARG_INTEGER; |
|
|
|
|
arg.key = const_cast<char*>(GRPC_ARG_DNS_ARES_QUERY_TIMEOUT_MS); |
|
|
|
@ -374,6 +377,8 @@ void TestCancelDuringActiveQuery( |
|
|
|
|
CQ_EXPECT_COMPLETION(cqv, Tag(1), 1); |
|
|
|
|
cq_verify(cqv); |
|
|
|
|
EXPECT_EQ(status, expected_status_code); |
|
|
|
|
EXPECT_THAT(std::string(error_string), |
|
|
|
|
testing::HasSubstr(expected_error_message_substring)); |
|
|
|
|
// Teardown
|
|
|
|
|
grpc_channel_args_destroy(client_args); |
|
|
|
|
grpc_slice_unref(details); |
|
|
|
|