|
|
@@ -24,7 +24,7 @@ final class ServerRPCExecutorTests: XCTestCase {
|
|
|
let harness = ServerRPCExecutorTestHarness()
|
|
|
try await harness.execute(handler: .echo) { inbound in
|
|
|
try await inbound.write(.metadata(["foo": "bar"]))
|
|
|
- inbound.finish()
|
|
|
+ await inbound.finish()
|
|
|
} consumer: { outbound in
|
|
|
let parts = try await outbound.collect()
|
|
|
XCTAssertEqual(
|
|
|
@@ -42,7 +42,7 @@ final class ServerRPCExecutorTests: XCTestCase {
|
|
|
try await harness.execute(handler: .echo) { inbound in
|
|
|
try await inbound.write(.metadata(["foo": "bar"]))
|
|
|
try await inbound.write(.message([0]))
|
|
|
- inbound.finish()
|
|
|
+ await inbound.finish()
|
|
|
} consumer: { outbound in
|
|
|
let parts = try await outbound.collect()
|
|
|
XCTAssertEqual(
|
|
|
@@ -63,7 +63,7 @@ final class ServerRPCExecutorTests: XCTestCase {
|
|
|
try await inbound.write(.message([0]))
|
|
|
try await inbound.write(.message([1]))
|
|
|
try await inbound.write(.message([2]))
|
|
|
- inbound.finish()
|
|
|
+ await inbound.finish()
|
|
|
} consumer: { outbound in
|
|
|
let parts = try await outbound.collect()
|
|
|
XCTAssertEqual(
|
|
|
@@ -94,7 +94,7 @@ final class ServerRPCExecutorTests: XCTestCase {
|
|
|
} producer: { inbound in
|
|
|
try await inbound.write(.metadata(["foo": "bar"]))
|
|
|
try await inbound.write(.message(Array("\"hello\"".utf8)))
|
|
|
- inbound.finish()
|
|
|
+ await inbound.finish()
|
|
|
} consumer: { outbound in
|
|
|
let parts = try await outbound.collect()
|
|
|
XCTAssertEqual(
|
|
|
@@ -125,7 +125,7 @@ final class ServerRPCExecutorTests: XCTestCase {
|
|
|
try await inbound.write(.metadata(["foo": "bar"]))
|
|
|
try await inbound.write(.message(Array("\"hello\"".utf8)))
|
|
|
try await inbound.write(.message(Array("\"world\"".utf8)))
|
|
|
- inbound.finish()
|
|
|
+ await inbound.finish()
|
|
|
} consumer: { outbound in
|
|
|
let parts = try await outbound.collect()
|
|
|
XCTAssertEqual(
|
|
|
@@ -151,7 +151,7 @@ final class ServerRPCExecutorTests: XCTestCase {
|
|
|
}
|
|
|
} producer: { inbound in
|
|
|
try await inbound.write(.metadata(["foo": "bar"]))
|
|
|
- inbound.finish()
|
|
|
+ await inbound.finish()
|
|
|
} consumer: { outbound in
|
|
|
let parts = try await outbound.collect()
|
|
|
XCTAssertEqual(
|
|
|
@@ -167,7 +167,7 @@ final class ServerRPCExecutorTests: XCTestCase {
|
|
|
func testEmptyInbound() async throws {
|
|
|
let harness = ServerRPCExecutorTestHarness()
|
|
|
try await harness.execute(handler: .echo) { inbound in
|
|
|
- inbound.finish()
|
|
|
+ await inbound.finish()
|
|
|
} consumer: { outbound in
|
|
|
let part = try await outbound.collect().first
|
|
|
XCTAssertStatus(part) { status, _ in
|
|
|
@@ -180,7 +180,7 @@ final class ServerRPCExecutorTests: XCTestCase {
|
|
|
let harness = ServerRPCExecutorTestHarness()
|
|
|
try await harness.execute(handler: .echo) { inbound in
|
|
|
try await inbound.write(.message([0]))
|
|
|
- inbound.finish()
|
|
|
+ await inbound.finish()
|
|
|
} consumer: { outbound in
|
|
|
let part = try await outbound.collect().first
|
|
|
XCTAssertStatus(part) { status, _ in
|
|
|
@@ -192,7 +192,7 @@ final class ServerRPCExecutorTests: XCTestCase {
|
|
|
func testInboundStreamThrows() async throws {
|
|
|
let harness = ServerRPCExecutorTestHarness()
|
|
|
try await harness.execute(handler: .echo) { inbound in
|
|
|
- inbound.finish(throwing: RPCError(code: .aborted, message: ""))
|
|
|
+ await inbound.finish(throwing: RPCError(code: .aborted, message: ""))
|
|
|
} consumer: { outbound in
|
|
|
let part = try await outbound.collect().first
|
|
|
XCTAssertStatus(part) { status, _ in
|
|
|
@@ -206,7 +206,7 @@ final class ServerRPCExecutorTests: XCTestCase {
|
|
|
let harness = ServerRPCExecutorTestHarness()
|
|
|
try await harness.execute(handler: .throwing(SomeError())) { inbound in
|
|
|
try await inbound.write(.metadata([:]))
|
|
|
- inbound.finish()
|
|
|
+ await inbound.finish()
|
|
|
} consumer: { outbound in
|
|
|
let part = try await outbound.collect().first
|
|
|
XCTAssertStatus(part) { status, _ in
|
|
|
@@ -220,7 +220,7 @@ final class ServerRPCExecutorTests: XCTestCase {
|
|
|
let harness = ServerRPCExecutorTestHarness()
|
|
|
try await harness.execute(handler: .throwing(error)) { inbound in
|
|
|
try await inbound.write(.metadata([:]))
|
|
|
- inbound.finish()
|
|
|
+ await inbound.finish()
|
|
|
} consumer: { outbound in
|
|
|
let part = try await outbound.collect().first
|
|
|
XCTAssertStatus(part) { status, metadata in
|
|
|
@@ -247,7 +247,7 @@ final class ServerRPCExecutorTests: XCTestCase {
|
|
|
return ServerResponse.Stream(error: RPCError(code: .failedPrecondition, message: ""))
|
|
|
} producer: { inbound in
|
|
|
try await inbound.write(.metadata(["grpc-timeout": "1000n"]))
|
|
|
- inbound.finish()
|
|
|
+ await inbound.finish()
|
|
|
} consumer: { outbound in
|
|
|
let part = try await outbound.collect().first
|
|
|
XCTAssertStatus(part) { status, _ in
|
|
|
@@ -277,7 +277,7 @@ final class ServerRPCExecutorTests: XCTestCase {
|
|
|
)
|
|
|
} producer: { inbound in
|
|
|
try await inbound.write(.metadata([:]))
|
|
|
- inbound.finish()
|
|
|
+ await inbound.finish()
|
|
|
} consumer: { outbound in
|
|
|
let part = try await outbound.collect().first
|
|
|
XCTAssertStatus(part) { status, metadata in
|
|
|
@@ -302,7 +302,7 @@ final class ServerRPCExecutorTests: XCTestCase {
|
|
|
|
|
|
try await harness.execute(handler: .echo) { inbound in
|
|
|
try await inbound.write(.metadata([:]))
|
|
|
- inbound.finish()
|
|
|
+ await inbound.finish()
|
|
|
} consumer: { outbound in
|
|
|
let parts = try await outbound.collect()
|
|
|
XCTAssertEqual(parts, [.metadata([:]), .status(.ok, [:])])
|
|
|
@@ -327,7 +327,7 @@ final class ServerRPCExecutorTests: XCTestCase {
|
|
|
|
|
|
try await harness.execute(handler: .echo) { inbound in
|
|
|
try await inbound.write(.metadata([:]))
|
|
|
- inbound.finish()
|
|
|
+ await inbound.finish()
|
|
|
} consumer: { outbound in
|
|
|
let parts = try await outbound.collect()
|
|
|
XCTAssertEqual(parts, [.status(Status(code: .unavailable, message: ""), [:])])
|
|
|
@@ -345,7 +345,7 @@ final class ServerRPCExecutorTests: XCTestCase {
|
|
|
|
|
|
try await harness.execute(handler: .echo) { inbound in
|
|
|
try await inbound.write(.metadata([:]))
|
|
|
- inbound.finish()
|
|
|
+ await inbound.finish()
|
|
|
} consumer: { outbound in
|
|
|
let parts = try await outbound.collect()
|
|
|
XCTAssertEqual(parts, [.status(Status(code: .unavailable, message: "Unavailable"), [:])])
|