File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 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 {
7979        } 
8080    } 
8181
82+     func  testSelect10kRowsSimpleQuery( )  async  throws  { 
83+         let  eventLoopGroup  =  MultiThreadedEventLoopGroup ( numberOfThreads:  1 ) 
84+         defer  {  XCTAssertNoThrow ( try . 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 . 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 . syncShutdownGracefully ( ) )  } 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments