File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Tests/PostgresNIOTests/New Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -36,11 +36,12 @@ final class PSQLRowStreamTests: XCTestCase {
3636 XCTAssertEqual ( $0 as? PSQLError , expectedError)
3737 }
3838
39+ // Drain should work
3940 XCTAssertThrowsError ( try stream. drain ( ) . wait ( ) ) {
4041 XCTAssertEqual ( $0 as? PSQLError , expectedError)
4142 }
4243 }
43-
44+
4445 func testGetArrayAfterStreamHasFinished( ) {
4546 let dataSource = CountingDataSource ( )
4647 let stream = PSQLRowStream (
@@ -250,6 +251,20 @@ final class PSQLRowStreamTests: XCTestCase {
250251 XCTAssertEqual ( stream. commandTag, " INSERT 0 1 " )
251252 }
252253
254+ func testDrainFailedStream( ) {
255+ let stream = PSQLRowStream (
256+ source: . noRows( . failure( PSQLError . serverClosedConnection ( underlying: nil ) ) ) ,
257+ eventLoop: self . eventLoop,
258+ logger: self . logger
259+ )
260+
261+ let expectedError = PSQLError . serverClosedConnection ( underlying: nil )
262+
263+ XCTAssertThrowsError ( try stream. drain ( ) . wait ( ) ) {
264+ XCTAssertEqual ( $0 as? PSQLError , expectedError)
265+ }
266+ }
267+
253268 func testDrainAfterStreamHasFinished( ) {
254269 let dataSource = CountingDataSource ( )
255270 let stream = PSQLRowStream (
You can’t perform that action at this time.
0 commit comments