@@ -1847,11 +1847,29 @@ final class HTTPClientTests: XCTestCaseHTTPClientTestsBaseClass {
1847
1847
}
1848
1848
1849
1849
func testPoolClosesIdleConnections( ) {
1850
+ let configuration = HTTPClient . Configuration (
1851
+ certificateVerification: . none,
1852
+ maximumAllowedIdleTimeInConnectionPool: . milliseconds( 100 )
1853
+ )
1854
+
1850
1855
let localClient = HTTPClient ( eventLoopGroupProvider: . shared( self . clientGroup) ,
1851
- configuration: . init ( connectionPool : . init ( idleTimeout : . milliseconds ( 100 ) ) ) )
1856
+ configuration: configuration )
1852
1857
defer {
1853
1858
XCTAssertNoThrow ( try localClient. syncShutdown ( ) )
1854
1859
}
1860
+
1861
+ // Make sure that the idle timeout of the connection pool is properly propagated
1862
+ // to the connection pool itself, when using both inits.
1863
+ XCTAssertEqual ( configuration. connectionPool. idleTimeout, . milliseconds( 100 ) )
1864
+ XCTAssertEqual (
1865
+ configuration. connectionPool. idleTimeout,
1866
+ HTTPClient . Configuration (
1867
+ certificateVerification: . none,
1868
+ connectionPool: . milliseconds( 100 ) ,
1869
+ backgroundActivityLogger: nil
1870
+ ) . connectionPool. idleTimeout
1871
+ )
1872
+
1855
1873
XCTAssertNoThrow ( try localClient. get ( url: self . defaultHTTPBinURLPrefix + " get " ) . wait ( ) )
1856
1874
Thread . sleep ( forTimeInterval: 0.2 )
1857
1875
XCTAssertEqual ( self . defaultHTTPBin. activeConnections, 0 )
0 commit comments