Skip to content

Commit 5313614

Browse files
committed
one more test
1 parent a40b9dd commit 5313614

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

Tests/PostgresNIOTests/New/PSQLRowStreamTests.swift

+16-1
Original file line numberDiff line numberDiff 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(

0 commit comments

Comments
 (0)