Skip to content

Commit 25a69ec

Browse files
committed
Add a test for generating series with simple query
1 parent e403409 commit 25a69ec

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Tests/IntegrationTests/AsyncTests.swift

+21
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,27 @@ final class AsyncPostgresConnectionTests: XCTestCase {
7979
}
8080
}
8181

82+
func testSelect10kRowsSimpleQuery() async throws {
83+
let eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1)
84+
defer { XCTAssertNoThrow(try eventLoopGroup.syncShutdownGracefully()) }
85+
let eventLoop = eventLoopGroup.next()
86+
87+
let start = 1
88+
let end = 10000
89+
90+
try await withTestConnection(on: eventLoop) { connection in
91+
let rows = try await connection.__simpleQuery("SELECT generate_series(\(start), \(end));", logger: .psqlTest)
92+
var counter = 0
93+
for try await row in rows {
94+
let element = try row.decode(Int.self)
95+
XCTAssertEqual(element, counter + 1)
96+
counter += 1
97+
}
98+
99+
XCTAssertEqual(counter, end)
100+
}
101+
}
102+
82103
func testSelectActiveConnection() async throws {
83104
let eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1)
84105
defer { XCTAssertNoThrow(try eventLoopGroup.syncShutdownGracefully()) }

0 commit comments

Comments
 (0)