|
|
|
@ -45,6 +45,12 @@ TEST_F(DefaultChannelTest, SetServers) { |
|
|
|
|
EXPECT_EQ(ARES_SUCCESS, ares_set_servers(channel_, &server1)); |
|
|
|
|
std::vector<std::string> expected = {"1.2.3.4", "2.3.4.5"}; |
|
|
|
|
EXPECT_EQ(expected, GetNameServers(channel_)); |
|
|
|
|
|
|
|
|
|
// Change not allowed while request is pending
|
|
|
|
|
HostResult result; |
|
|
|
|
ares_gethostbyname(channel_, "www.google.com.", AF_INET, HostCallback, &result); |
|
|
|
|
EXPECT_EQ(ARES_ENOTIMP, ares_set_servers(channel_, &server1)); |
|
|
|
|
ares_cancel(channel_); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_F(DefaultChannelTest, SetServersPorts) { |
|
|
|
@ -69,6 +75,12 @@ TEST_F(DefaultChannelTest, SetServersPorts) { |
|
|
|
|
EXPECT_EQ(ARES_SUCCESS, ares_set_servers_ports(channel_, &server1)); |
|
|
|
|
std::vector<std::string> expected = {"1.2.3.4:111", "2.3.4.5"}; |
|
|
|
|
EXPECT_EQ(expected, GetNameServers(channel_)); |
|
|
|
|
|
|
|
|
|
// Change not allowed while request is pending
|
|
|
|
|
HostResult result; |
|
|
|
|
ares_gethostbyname(channel_, "www.google.com.", AF_INET, HostCallback, &result); |
|
|
|
|
EXPECT_EQ(ARES_ENOTIMP, ares_set_servers_ports(channel_, &server1)); |
|
|
|
|
ares_cancel(channel_); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_F(DefaultChannelTest, SetServersCSV) { |
|
|
|
@ -96,6 +108,13 @@ TEST_F(DefaultChannelTest, SetServersCSV) { |
|
|
|
|
std::vector<std::string> expected2 = {"1.2.3.4:54", "[0102:0304:0506:0708:0910:1112:1314:1516]:80", "2.3.4.5:55"}; |
|
|
|
|
EXPECT_EQ(expected2, GetNameServers(channel_)); |
|
|
|
|
|
|
|
|
|
// Change not allowed while request is pending
|
|
|
|
|
HostResult result; |
|
|
|
|
ares_gethostbyname(channel_, "www.google.com.", AF_INET, HostCallback, &result); |
|
|
|
|
EXPECT_EQ(ARES_ENOTIMP, ares_set_servers_csv(channel_, "1.2.3.4,2.3.4.5")); |
|
|
|
|
EXPECT_EQ(ARES_ENOTIMP, ares_set_servers_ports_csv(channel_, "1.2.3.4:56,2.3.4.5:67")); |
|
|
|
|
ares_cancel(channel_); |
|
|
|
|
|
|
|
|
|
// Should survive duplication
|
|
|
|
|
ares_channel channel2; |
|
|
|
|
EXPECT_EQ(ARES_SUCCESS, ares_dup(&channel2, channel_)); |
|
|
|
|