Report connection timeout as separate event (#1171)

This commit is contained in:
Gregor Jasny 2022-01-26 23:32:40 +01:00 committed by GitHub
parent e5cacb465d
commit 87e03dd1ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 12 deletions

View file

@ -622,9 +622,14 @@ TEST(ConnectionErrorTest, Timeout) {
#endif
cli.set_connection_timeout(std::chrono::seconds(2));
// only probe one address type so that the error reason
// correlates to the timed-out IPv4, not the unsupported
// IPv6 connection attempt
cli.set_address_family(AF_INET);
auto res = cli.Get("/");
ASSERT_TRUE(!res);
EXPECT_TRUE(res.error() == Error::Connection);
EXPECT_EQ(Error::ConnectionTimeout, res.error());
}
TEST(CancelTest, NoCancel_Online) {