File tree 1 file changed +16
-1
lines changed
Tests/PostgresNIOTests/New
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 {
36
36
XCTAssertEqual ( $0 as? PSQLError , expectedError)
37
37
}
38
38
39
+ // Drain should work
39
40
XCTAssertThrowsError ( try stream. drain ( ) . wait ( ) ) {
40
41
XCTAssertEqual ( $0 as? PSQLError , expectedError)
41
42
}
42
43
}
43
-
44
+
44
45
func testGetArrayAfterStreamHasFinished( ) {
45
46
let dataSource = CountingDataSource ( )
46
47
let stream = PSQLRowStream (
@@ -250,6 +251,20 @@ final class PSQLRowStreamTests: XCTestCase {
250
251
XCTAssertEqual ( stream. commandTag, " INSERT 0 1 " )
251
252
}
252
253
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
+
253
268
func testDrainAfterStreamHasFinished( ) {
254
269
let dataSource = CountingDataSource ( )
255
270
let stream = PSQLRowStream (
You can’t perform that action at this time.
0 commit comments