Add UT for ipv6 + Universal client implementation

This commit is contained in:
Sean Quinn 2024-05-04 11:14:06 -07:00
parent 5d1109d521
commit 50dde7d676
2 changed files with 17 additions and 0 deletions

View File

@ -9250,6 +9250,8 @@ inline Client::Client(const std::string &scheme_host_port,
client_key_path);
}
} else {
// NOTE: Update TEST(UniversalClientImplTest, Ipv6LiteralAddress)
// if port param below changes.
cli_ = detail::make_unique<ClientImpl>(scheme_host_port, 80,
client_cert_path, client_key_path);
}

View File

@ -7373,3 +7373,18 @@ TEST(PathParamsTest, SequenceOfParams) {
EXPECT_EQ(request.path_params, expected_params);
}
TEST(UniversalClientImplTest, Ipv6LiteralAddress) {
// If ipv6 regex working, regex match codepath is taken.
// else port will default to 80 in Client impl
int clientImplMagicPort = 80;
int port = 4321;
// above ports must be different to avoid false negative
EXPECT_NE(clientImplMagicPort, port);
std::string ipV6TestURL = "http://[ff06::c3]";
Client cli(ipV6TestURL + ":" + std::to_string(port), CLIENT_CERT_FILE,
CLIENT_PRIVATE_KEY_FILE);
EXPECT_EQ(cli.port(), port);
}