Skip to content

Commit 56f0ab0

Browse files
committed
Add test case for RedisConnectionPool connectionRetryTimeout
1 parent c8cb256 commit 56f0ab0

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Sources/RediStackTestUtils/RedisConnectionPoolIntegrationTestCase.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,17 @@ open class RedisConnectionPoolIntegrationTestCase: XCTestCase {
7474
self.pool = nil
7575
}
7676

77-
public func makeNewPool() throws -> RedisConnectionPool {
77+
public func makeNewPool(
78+
connectionRetryTimeout: TimeAmount? = .seconds(5)
79+
) throws -> RedisConnectionPool {
7880
let address = try SocketAddress.makeAddressResolvingHost(self.redisHostname, port: self.redisPort)
7981
let pool = RedisConnectionPool(
8082
serverConnectionAddresses: [address],
8183
loop: self.eventLoopGroup.next(),
8284
maximumConnectionCount: .maximumActiveConnections(4),
8385
minimumConnectionCount: 0,
84-
connectionPassword: self.redisPassword
86+
connectionPassword: self.redisPassword,
87+
connectionRetryTimeout: connectionRetryTimeout
8588
)
8689
pool.activate()
8790

Tests/RediStackIntegrationTests/RedisConnectionPoolTests.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,9 @@ final class RedisConnectionPoolTests: RediStackConnectionPoolIntegrationTestCase
3737
XCTAssertEqual(error as? RedisConnectionPoolError, .poolClosed)
3838
}
3939
}
40+
41+
func test_nilConnectionRetryTimeoutStillWorks() throws {
42+
let pool = try self.makeNewPool(connectionRetryTimeout: nil)
43+
XCTAssertNoThrow(try pool.get(#function).wait())
44+
}
4045
}

0 commit comments

Comments
 (0)