Skip to content

Commit 70c0d48

Browse files
committed
Add multiplexing test
1 parent 1980571 commit 70c0d48

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Tests/ValkeyTests/ValkeyTests.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,26 @@ struct GeneratedCommands {
171171
}
172172
}
173173

174+
@Test
175+
func testMultiplexing() async throws {
176+
var logger = Logger(label: "Valkey")
177+
logger.logLevel = .debug
178+
try await ValkeyClient(.hostname(valkeyHostname, port: 6379), logger: logger).withConnection(logger: logger) { connection in
179+
try await withThrowingTaskGroup(of: Void.self) { group in
180+
for _ in 0..<100 {
181+
group.addTask {
182+
try await withKey(connection: connection) { key in
183+
_ = try await connection.set(key: key, value: key.rawValue)
184+
let response = try await connection.get(key: key)
185+
#expect(response == key.rawValue)
186+
}
187+
}
188+
}
189+
try await group.waitForAll()
190+
}
191+
}
192+
}
193+
174194
/*
175195
@Test
176196
func testSubscriptions() async throws {

0 commit comments

Comments
 (0)