Skip to content

Commit 35e0d67

Browse files
authored
Fix crash in tests: Use explicit RedisCommand instead of tuple (#52)
1 parent a7d196e commit 35e0d67

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

Sources/RediStackTestUtils/RedisConnectionPoolIntegrationTestCase.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ open class RedisConnectionPoolIntegrationTestCase: XCTestCase {
8080
) throws -> RedisConnectionPool {
8181
let address = try SocketAddress.makeAddressResolvingHost(self.redisHostname, port: self.redisPort)
8282
let pool = RedisConnectionPool(
83-
configuration: .init(
83+
configuration: RedisConnectionPool.Configuration(
8484
initialServerConnectionAddresses: [address],
8585
maximumConnectionCount: .maximumActiveConnections(4),
8686
connectionFactoryConfiguration: .init(connectionPassword: self.redisPassword),

Tests/RediStackIntegrationTests/RedisConnectionPoolTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ final class RedisConnectionPoolTests: RediStackConnectionPoolIntegrationTestCase
4040

4141
func test_nilConnectionRetryTimeoutStillWorks() throws {
4242
let pool = try self.makeNewPool(connectionRetryTimeout: nil)
43+
defer { pool.close() }
4344
XCTAssertNoThrow(try pool.get(#function).wait())
4445
}
4546
}

Tests/RediStackTests/ChannelHandlers/RedisCommandHandlerTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,19 @@ final class RedisCommandHandlerTests: XCTestCase {
5656

5757
let getFoo = RESPValue.array([.bulkString(.init(string: "GET")), .bulkString(.init(string: "foo"))])
5858
let promiseFoo = loop.makePromise(of: RESPValue.self)
59-
let commandFoo = (message: getFoo, responsePromise: promiseFoo)
59+
let commandFoo = RedisCommand(message: getFoo, responsePromise: promiseFoo)
6060
XCTAssertNoThrow(try channel.writeOutbound(commandFoo))
6161
XCTAssertEqual(try channel.readOutbound(as: RESPValue.self), getFoo)
6262

6363
let getBar = RESPValue.array([.bulkString(.init(string: "GET")), .bulkString(.init(string: "bar"))])
6464
let promiseBar = loop.makePromise(of: RESPValue.self)
65-
let commandBar = (message: getBar, responsePromise: promiseBar)
65+
let commandBar = RedisCommand(message: getBar, responsePromise: promiseBar)
6666
XCTAssertNoThrow(try channel.writeOutbound(commandBar))
6767
XCTAssertEqual(try channel.readOutbound(as: RESPValue.self), getBar)
6868

6969
let getBaz = RESPValue.array([.bulkString(.init(string: "GET")), .bulkString(.init(string: "baz"))])
7070
let promiseBaz = loop.makePromise(of: RESPValue.self)
71-
let commandBaz = (message: getBaz, responsePromise: promiseBaz)
71+
let commandBaz = RedisCommand(message: getBaz, responsePromise: promiseBaz)
7272
XCTAssertNoThrow(try channel.writeOutbound(commandBaz))
7373
XCTAssertEqual(try channel.readOutbound(as: RESPValue.self), getBaz)
7474

@@ -117,7 +117,7 @@ final class RedisCommandHandlerTests: XCTestCase {
117117

118118
let getBar = RESPValue.array([.bulkString(.init(string: "GET")), .bulkString(.init(string: "bar"))])
119119
let promiseBar = loop.makePromise(of: RESPValue.self)
120-
let commandBar = (message: getBar, responsePromise: promiseBar)
120+
let commandBar = RedisCommand(message: getBar, responsePromise: promiseBar)
121121
channel.write(commandBar, promise: nil)
122122
XCTAssertThrowsError(try promiseBar.futureResult.wait()) {
123123
XCTAssertEqual($0 as? RedisClientError, .connectionClosed)

0 commit comments

Comments
 (0)