File tree 1 file changed +21
-0
lines changed
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,27 @@ final class AsyncPostgresConnectionTests: XCTestCase {
79
79
}
80
80
}
81
81
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
+
82
103
func testSelectActiveConnection( ) async throws {
83
104
let eventLoopGroup = MultiThreadedEventLoopGroup ( numberOfThreads: 1 )
84
105
defer { XCTAssertNoThrow ( try eventLoopGroup. syncShutdownGracefully ( ) ) }
You can’t perform that action at this time.
0 commit comments