Skip to content

Commit c962004

Browse files
committed
Make the test expectations on receive consistent across Linux and macOS.
1 parent 9128b60 commit c962004

File tree

2 files changed

+8
-24
lines changed

2 files changed

+8
-24
lines changed

Tests/SwiftGRPCTests/ServerThrowingTests.swift

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ extension ServerThrowingTests {
9898
completionHandlerExpectation.fulfill()
9999
}
100100

101-
// TODO(danielalm): Why doesn't `call.receive()` throw once the call times out?
101+
// FIXME(danielalm): Why does `call.receive()` essentially return "end of stream", rather than returning an error?
102102
XCTAssertNil(try! call.receive())
103103

104104
waitForExpectations(timeout: defaultTimeout)
@@ -120,17 +120,8 @@ extension ServerThrowingTests {
120120
}
121121
call.waitForSendOperationsToFinish()
122122

123-
// FIXME(danielalm): Why does `call.receive()` only throw on Linux (but not macOS) once the call times out?
124-
#if os(Linux)
125-
do {
126-
_ = try call.receive()
127-
XCTFail("should have thrown")
128-
} catch let receiveError {
129-
XCTAssertEqual(.unknown, (receiveError as! RPCError).callResult!.statusCode)
130-
}
131-
#else
123+
// FIXME(danielalm): Why does `call.receive()` essentially return "end of stream", rather than returning an error?
132124
XCTAssertNil(try! call.receive())
133-
#endif
134125

135126
waitForExpectations(timeout: defaultTimeout)
136127
}

Tests/SwiftGRPCTests/ServerTimeoutTests.swift

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ extension ServerTimeoutTests {
8181
call.waitForSendOperationsToFinish()
8282

8383
do {
84-
_ = try call.closeAndReceive()
85-
XCTFail("should have thrown")
84+
let result = try call.closeAndReceive()
85+
XCTFail("should have thrown, instead received \(result)")
8686
} catch let receiveError {
8787
XCTAssertEqual(.unknown, (receiveError as! RPCError).callResult!.statusCode)
8888
}
@@ -97,7 +97,8 @@ extension ServerTimeoutTests {
9797
completionHandlerExpectation.fulfill()
9898
}
9999

100-
// TODO(danielalm): Why doesn't `call.receive()` throw once the call times out?
100+
// FIXME(danielalm): Why does `call.receive()` essentially return "end of stream" once the call times out,
101+
// rather than returning an error?
101102
XCTAssertNil(try! call.receive())
102103

103104
waitForExpectations(timeout: defaultTimeout)
@@ -118,17 +119,9 @@ extension ServerTimeoutTests {
118119
}
119120
call.waitForSendOperationsToFinish()
120121

121-
// FIXME(danielalm): Why does `call.receive()` only throw on Linux (but not macOS) once the call times out?
122-
#if os(Linux)
123-
do {
124-
_ = try call.receive()
125-
XCTFail("should have thrown")
126-
} catch let receiveError {
127-
XCTAssertEqual(.unknown, (receiveError as! RPCError).callResult!.statusCode)
128-
}
129-
#else
122+
// FIXME(danielalm): Why does `call.receive()` essentially return "end of stream" once the call times out,
123+
// rather than returning an error?
130124
XCTAssertNil(try! call.receive())
131-
#endif
132125

133126
waitForExpectations(timeout: defaultTimeout)
134127
}

0 commit comments

Comments
 (0)