From 070986b5ec3e40c727b39cabc28dccb8e9cd607c Mon Sep 17 00:00:00 2001 From: Steve Ayers Date: Tue, 5 Sep 2023 13:10:37 -0400 Subject: [PATCH 1/9] Conformance --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index eb725549..dd001863 100644 --- a/README.md +++ b/README.md @@ -157,7 +157,7 @@ for details. - [connect-go][connect-go]: Go service stubs for servers - [connect-es][connect-es]: Type-safe APIs with Protobuf and TypeScript - [Buf Studio][buf-studio]: Web UI for ad-hoc RPCs -- [connect-conformance][connect-conformance]: Connect, gRPC, and gRPC-Web +- [conformance][connect-conformance]: Connect, gRPC, and gRPC-Web interoperability tests ## Status From 7a77f6c1816a8a4428d93838bad85cc708332dfa Mon Sep 17 00:00:00 2001 From: Steve Ayers Date: Wed, 6 Sep 2023 12:54:34 -0400 Subject: [PATCH 2/9] Update to latest conformance --- Makefile | 4 +- .../AsyncAwaitConformance.swift | 43 +- .../CallbackConformance.swift | 45 +- .../ConnectMocksTests/ConnectMocksTests.swift | 42 +- .../ConnectTests/ConnectErrorTests.swift | 10 +- .../ConnectTests/JSONCodecTests.swift | 2 +- .../ConnectTests/ProtoCodecTests.swift | 2 +- .../ConnectTests/ServiceMetadataTests.swift | 16 +- .../conformance/v1}/messages.pb.swift | 365 ++++++------- .../conformance/v1/test.connect.swift | 502 ++++++++++++++++++ .../connectrpc/conformance/v1/test.mock.swift | 367 +++++++++++++ .../conformance/v1}/test.pb.swift | 20 +- .../Generated/grpc/testing/empty.pb.swift | 81 --- .../Generated/grpc/testing/test.connect.swift | 498 ----------------- .../Generated/grpc/testing/test.mock.swift | 367 ------------- .../Generated/server/v1/server.pb.swift | 4 +- Tests/ConnectLibraryTests/buf.work.yaml | 3 - Tests/ConnectLibraryTests/proto/README.md | 2 - Tests/ConnectLibraryTests/proto/buf.yaml | 12 - .../proto/grpc/testing/empty.proto | 29 - .../proto/grpc/testing/messages.proto | 284 ---------- .../proto/grpc/testing/test.proto | 122 ----- .../proto/server/v1/server.proto | 40 -- 23 files changed, 1136 insertions(+), 1724 deletions(-) rename Tests/ConnectLibraryTests/Generated/{grpc/testing => connectrpc/conformance/v1}/messages.pb.swift (80%) create mode 100644 Tests/ConnectLibraryTests/Generated/connectrpc/conformance/v1/test.connect.swift create mode 100644 Tests/ConnectLibraryTests/Generated/connectrpc/conformance/v1/test.mock.swift rename Tests/ConnectLibraryTests/Generated/{grpc/testing => connectrpc/conformance/v1}/test.pb.swift (72%) delete mode 100644 Tests/ConnectLibraryTests/Generated/grpc/testing/empty.pb.swift delete mode 100644 Tests/ConnectLibraryTests/Generated/grpc/testing/test.connect.swift delete mode 100644 Tests/ConnectLibraryTests/Generated/grpc/testing/test.mock.swift delete mode 100644 Tests/ConnectLibraryTests/buf.work.yaml delete mode 100644 Tests/ConnectLibraryTests/proto/README.md delete mode 100644 Tests/ConnectLibraryTests/proto/buf.yaml delete mode 100644 Tests/ConnectLibraryTests/proto/grpc/testing/empty.proto delete mode 100644 Tests/ConnectLibraryTests/proto/grpc/testing/messages.proto delete mode 100644 Tests/ConnectLibraryTests/proto/grpc/testing/test.proto delete mode 100644 Tests/ConnectLibraryTests/proto/server/v1/server.proto diff --git a/Makefile b/Makefile index 08a12e66..5770d670 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ MAKEFLAGS += --no-builtin-rules MAKEFLAGS += --no-print-directory BIN := .tmp/bin LICENSE_HEADER_YEAR_RANGE := 2022-2023 -CONFORMANCE_VERSION := 4f4e96d8fea3ed9473b90a964a5ba429e7ea5649 +CONFORMANCE_VERSION := 0b07f579cb61ad89de24524d62f804a2b03b1acf LICENSE_HEADER_VERSION := v1.12.0 LICENSE_IGNORE := -e Package.swift \ -e $(BIN)\/ \ @@ -57,7 +57,7 @@ conformanceserverrun: conformanceserverstop ## Start the conformance server generate: cleangenerated ## Regenerate outputs for all .proto files cd Examples; buf generate cd Libraries/Connect; buf generate - cd Tests/ConnectLibraryTests; buf generate + cd Tests/ConnectLibraryTests; buf generate https://github.com/connectrpc/conformance.git#ref=$(CONFORMANCE_VERSION),subdir=proto .PHONY: help help: ## Describe useful make targets diff --git a/Tests/ConnectLibraryTests/ConnectConformance/AsyncAwaitConformance.swift b/Tests/ConnectLibraryTests/ConnectConformance/AsyncAwaitConformance.swift index ef0def95..6def78f2 100644 --- a/Tests/ConnectLibraryTests/ConnectConformance/AsyncAwaitConformance.swift +++ b/Tests/ConnectLibraryTests/ConnectConformance/AsyncAwaitConformance.swift @@ -14,12 +14,13 @@ import Connect import Foundation +import SwiftProtobuf import XCTest private let kTimeout = TimeInterval(10.0) -private typealias TestServiceClient = Grpc_Testing_TestServiceClient -private typealias UnimplementedServiceClient = Grpc_Testing_UnimplementedServiceClient +private typealias TestServiceClient = Connectrpc_Conformance_V1_TestServiceClient +private typealias UnimplementedServiceClient = Connectrpc_Conformance_V1_UnimplementedServiceClient /// This test suite runs against multiple protocols and serialization formats. /// Tests are based on https://github.com/connectrpc/conformance @@ -56,15 +57,15 @@ final class AsyncAwaitConformance: XCTestCase { func testEmptyUnary() async { await self.executeTestWithClients { client in - let response = await client.emptyCall(request: Grpc_Testing_Empty()) - XCTAssertEqual(response.message, Grpc_Testing_Empty()) + let response = await client.emptyCall(request: SwiftProtobuf.Google_Protobuf_Empty()) + XCTAssertEqual(response.message, SwiftProtobuf.Google_Protobuf_Empty()) } } func testLargeUnary() async { await self.executeTestWithClients { client in let size = 314_159 - let message = Grpc_Testing_SimpleRequest.with { proto in + let message = Connectrpc_Conformance_V1_SimpleRequest.with { proto in proto.responseSize = Int32(size) proto.payload = .with { $0.body = Data(repeating: 0, count: size) } } @@ -78,7 +79,7 @@ final class AsyncAwaitConformance: XCTestCase { try await self.executeTestWithClients { client in let sizes = [31_415, 9, 2_653, 58_979] let stream = client.streamingOutputCall() - try stream.send(Grpc_Testing_StreamingOutputCallRequest.with { proto in + try stream.send(Connectrpc_Conformance_V1_StreamingOutputCallRequest.with { proto in proto.responseParameters = sizes.enumerated().map { index, size in return .with { parameters in parameters.size = Int32(size) @@ -114,7 +115,7 @@ final class AsyncAwaitConformance: XCTestCase { try await self.executeTestWithClients { client in let closeExpectation = self.expectation(description: "Stream completes") let stream = client.streamingOutputCall() - try stream.send(Grpc_Testing_StreamingOutputCallRequest.with { proto in + try stream.send(Connectrpc_Conformance_V1_StreamingOutputCallRequest.with { proto in proto.responseParameters = [] }) for await result in stream.results() { @@ -147,7 +148,7 @@ final class AsyncAwaitConformance: XCTestCase { leadingKey: [leadingValue], trailingKey: [trailingValue.base64EncodedString()], ] - let message = Grpc_Testing_SimpleRequest.with { proto in + let message = Connectrpc_Conformance_V1_SimpleRequest.with { proto in proto.responseSize = Int32(size) proto.payload = .with { $0.body = Data(repeating: 0, count: size) } } @@ -179,7 +180,7 @@ final class AsyncAwaitConformance: XCTestCase { let messageExpectation = self.expectation(description: "Receives message") let trailersExpectation = self.expectation(description: "Receives trailers") let stream = client.streamingOutputCall(headers: headers) - try stream.send(Grpc_Testing_StreamingOutputCallRequest.with { proto in + try stream.send(Connectrpc_Conformance_V1_StreamingOutputCallRequest.with { proto in proto.responseParameters = [.with { $0.size = Int32(size) }] }) for await result in stream.results() { @@ -207,7 +208,7 @@ final class AsyncAwaitConformance: XCTestCase { } func testStatusCodeAndMessage() async { - let message = Grpc_Testing_SimpleRequest.with { proto in + let message = Connectrpc_Conformance_V1_SimpleRequest.with { proto in proto.responseStatus = .with { status in status.code = Int32(Code.unknown.rawValue) status.message = "test status message" @@ -224,7 +225,7 @@ final class AsyncAwaitConformance: XCTestCase { func testSpecialStatus() async { let statusMessage = "\\t\\ntest with whitespace\\r\\nand Unicode BMP ☺ and non-BMP \\uD83D\\uDE08\\t\\n" - let message = Grpc_Testing_SimpleRequest.with { proto in + let message = Connectrpc_Conformance_V1_SimpleRequest.with { proto in proto.responseStatus = .with { status in status.code = 2 status.message = statusMessage @@ -241,7 +242,7 @@ final class AsyncAwaitConformance: XCTestCase { func testTimeoutOnSleepingServer() async throws { try await self.executeTestWithClients(timeout: 0.01) { client in let expectation = self.expectation(description: "Stream times out") - let message = Grpc_Testing_StreamingOutputCallRequest.with { proto in + let message = Connectrpc_Conformance_V1_StreamingOutputCallRequest.with { proto in proto.payload = .with { $0.body = Data(count: 271_828) } proto.responseParameters = [ .with { parameters in @@ -273,7 +274,7 @@ final class AsyncAwaitConformance: XCTestCase { func testUnimplementedMethod() async { await self.executeTestWithClients { client in - let response = await client.unimplementedCall(request: Grpc_Testing_Empty()) + let response = await client.unimplementedCall(request: SwiftProtobuf.Google_Protobuf_Empty()) XCTAssertEqual(response.code, .unimplemented) XCTAssertEqual( response.error?.message, @@ -286,7 +287,7 @@ final class AsyncAwaitConformance: XCTestCase { try await self.executeTestWithClients { client in let expectation = self.expectation(description: "Stream completes") let stream = client.unimplementedStreamingOutputCall() - try stream.send(Grpc_Testing_Empty()) + try stream.send(SwiftProtobuf.Google_Protobuf_Empty()) for await result in stream.results() { switch result { case .headers, .message: @@ -310,7 +311,7 @@ final class AsyncAwaitConformance: XCTestCase { func testUnimplementedService() async { await self.executeTestWithUnimplementedClients { client in - let response = await client.unimplementedCall(request: Grpc_Testing_Empty()) + let response = await client.unimplementedCall(request: SwiftProtobuf.Google_Protobuf_Empty()) XCTAssertEqual(response.code, .unimplemented) XCTAssertNotNil(response.error) } @@ -320,7 +321,7 @@ final class AsyncAwaitConformance: XCTestCase { try await self.executeTestWithUnimplementedClients { client in let expectation = self.expectation(description: "Stream completes") let stream = client.unimplementedStreamingOutputCall() - try stream.send(Grpc_Testing_Empty()) + try stream.send(SwiftProtobuf.Google_Protobuf_Empty()) for await result in stream.results() { switch result { case .headers: @@ -341,11 +342,11 @@ final class AsyncAwaitConformance: XCTestCase { func testFailUnary() async { await self.executeTestWithClients { client in - let expectedErrorDetail = Grpc_Testing_ErrorDetail.with { proto in + let expectedErrorDetail = Connectrpc_Conformance_V1_ErrorDetail.with { proto in proto.reason = "soirée 🎉" proto.domain = "connect-conformance" } - let response = await client.failUnaryCall(request: Grpc_Testing_SimpleRequest()) + let response = await client.failUnaryCall(request: Connectrpc_Conformance_V1_SimpleRequest()) XCTAssertEqual(response.error?.code, .resourceExhausted) XCTAssertEqual(response.error?.message, "soirée 🎉") XCTAssertEqual(response.error?.unpackedDetails(), [expectedErrorDetail]) @@ -354,17 +355,17 @@ final class AsyncAwaitConformance: XCTestCase { func testFailServerStreaming() async throws { try await self.executeTestWithClients { client in - let expectedErrorDetail = Grpc_Testing_ErrorDetail.with { proto in + let expectedErrorDetail = Connectrpc_Conformance_V1_ErrorDetail.with { proto in proto.reason = "soirée 🎉" proto.domain = "connect-conformance" } let expectation = self.expectation(description: "Stream completes") let stream = client.failStreamingOutputCall() - try stream.send(Grpc_Testing_StreamingOutputCallRequest.with { proto in + try stream.send(Connectrpc_Conformance_V1_StreamingOutputCallRequest.with { proto in proto.responseParameters = [31_415, 9, 2_653, 58_979] .enumerated() .map { index, value in - return Grpc_Testing_ResponseParameters.with { parameters in + return Connectrpc_Conformance_V1_ResponseParameters.with { parameters in parameters.size = Int32(value) parameters.intervalUs = Int32(index * 10) } diff --git a/Tests/ConnectLibraryTests/ConnectConformance/CallbackConformance.swift b/Tests/ConnectLibraryTests/ConnectConformance/CallbackConformance.swift index c86b9bf6..3fbe4073 100644 --- a/Tests/ConnectLibraryTests/ConnectConformance/CallbackConformance.swift +++ b/Tests/ConnectLibraryTests/ConnectConformance/CallbackConformance.swift @@ -16,12 +16,13 @@ import Connect import Foundation +import SwiftProtobuf import XCTest private let kTimeout = TimeInterval(10.0) -private typealias TestServiceClient = Grpc_Testing_TestServiceClient -private typealias UnimplementedServiceClient = Grpc_Testing_UnimplementedServiceClient +private typealias TestServiceClient = Connectrpc_Conformance_V1_TestServiceClient +private typealias UnimplementedServiceClient = Connectrpc_Conformance_V1_UnimplementedServiceClient /// This test suite runs against multiple protocols and serialization formats. /// Tests are based on https://github.com/connectrpc/conformance @@ -56,9 +57,9 @@ final class CallbackConformance: XCTestCase { func testEmptyUnary() { self.executeTestWithClients { client in let expectation = self.expectation(description: "Receives successful response") - client.emptyCall(request: Grpc_Testing_Empty()) { response in + client.emptyCall(request: SwiftProtobuf.Google_Protobuf_Empty()) { response in XCTAssertNil(response.error) - XCTAssertEqual(response.message, Grpc_Testing_Empty()) + XCTAssertEqual(response.message, SwiftProtobuf.Google_Protobuf_Empty()) expectation.fulfill() } XCTAssertEqual(XCTWaiter().wait(for: [expectation], timeout: kTimeout), .completed) @@ -68,7 +69,7 @@ final class CallbackConformance: XCTestCase { func testLargeUnary() { self.executeTestWithClients { client in let size = 314_159 - let message = Grpc_Testing_SimpleRequest.with { proto in + let message = Connectrpc_Conformance_V1_SimpleRequest.with { proto in proto.responseSize = Int32(size) proto.payload = .with { $0.body = Data(repeating: 0, count: size) } } @@ -102,7 +103,7 @@ final class CallbackConformance: XCTestCase { expectation.fulfill() } } - try stream.send(Grpc_Testing_StreamingOutputCallRequest.with { proto in + try stream.send(Connectrpc_Conformance_V1_StreamingOutputCallRequest.with { proto in proto.responseParameters = sizes.enumerated().map { index, size in return .with { parameters in parameters.size = Int32(size) @@ -133,7 +134,7 @@ final class CallbackConformance: XCTestCase { closeExpectation.fulfill() } } - try stream.send(Grpc_Testing_StreamingOutputCallRequest.with { proto in + try stream.send(Connectrpc_Conformance_V1_StreamingOutputCallRequest.with { proto in proto.responseParameters = [] }) @@ -152,7 +153,7 @@ final class CallbackConformance: XCTestCase { leadingKey: [leadingValue], trailingKey: [trailingValue.base64EncodedString()], ] - let message = Grpc_Testing_SimpleRequest.with { proto in + let message = Connectrpc_Conformance_V1_SimpleRequest.with { proto in proto.responseSize = Int32(size) proto.payload = .with { $0.body = Data(repeating: 0, count: size) } } @@ -205,7 +206,7 @@ final class CallbackConformance: XCTestCase { trailersExpectation.fulfill() } } - try stream.send(Grpc_Testing_StreamingOutputCallRequest.with { proto in + try stream.send(Connectrpc_Conformance_V1_StreamingOutputCallRequest.with { proto in proto.responseParameters = [.with { $0.size = Int32(size) }] }) @@ -216,7 +217,7 @@ final class CallbackConformance: XCTestCase { } func testStatusCodeAndMessage() { - let message = Grpc_Testing_SimpleRequest.with { proto in + let message = Connectrpc_Conformance_V1_SimpleRequest.with { proto in proto.responseStatus = .with { status in status.code = Int32(Code.unknown.rawValue) status.message = "test status message" @@ -242,7 +243,7 @@ final class CallbackConformance: XCTestCase { func testSpecialStatus() { let statusMessage = "\\t\\ntest with whitespace\\r\\nand Unicode BMP ☺ and non-BMP \\uD83D\\uDE08\\t\\n" - let message = Grpc_Testing_SimpleRequest.with { proto in + let message = Connectrpc_Conformance_V1_SimpleRequest.with { proto in proto.responseStatus = .with { status in status.code = 2 status.message = statusMessage @@ -268,7 +269,7 @@ final class CallbackConformance: XCTestCase { func testTimeoutOnSleepingServer() throws { try self.executeTestWithClients(timeout: 0.01) { client in let expectation = self.expectation(description: "Stream times out") - let message = Grpc_Testing_StreamingOutputCallRequest.with { proto in + let message = Connectrpc_Conformance_V1_StreamingOutputCallRequest.with { proto in proto.payload = .with { $0.body = Data(count: 271_828) } proto.responseParameters = [ .with { parameters in @@ -300,7 +301,7 @@ final class CallbackConformance: XCTestCase { func testUnimplementedMethod() { self.executeTestWithClients { client in let expectation = self.expectation(description: "Request completes") - client.unimplementedCall(request: Grpc_Testing_Empty()) { response in + client.unimplementedCall(request: SwiftProtobuf.Google_Protobuf_Empty()) { response in XCTAssertEqual(response.code, .unimplemented) XCTAssertEqual( response.error?.message, @@ -332,7 +333,7 @@ final class CallbackConformance: XCTestCase { expectation.fulfill() } } - try stream.send(Grpc_Testing_Empty()) + try stream.send(SwiftProtobuf.Google_Protobuf_Empty()) XCTAssertEqual(XCTWaiter().wait(for: [expectation], timeout: kTimeout), .completed) } @@ -341,7 +342,7 @@ final class CallbackConformance: XCTestCase { func testUnimplementedService() { self.executeTestWithUnimplementedClients { client in let expectation = self.expectation(description: "Request completes") - client.unimplementedCall(request: Grpc_Testing_Empty()) { response in + client.unimplementedCall(request: SwiftProtobuf.Google_Protobuf_Empty()) { response in XCTAssertEqual(response.code, .unimplemented) XCTAssertNotNil(response.error) expectation.fulfill() @@ -367,7 +368,7 @@ final class CallbackConformance: XCTestCase { expectation.fulfill() } } - try stream.send(Grpc_Testing_Empty()) + try stream.send(SwiftProtobuf.Google_Protobuf_Empty()) XCTAssertEqual(XCTWaiter().wait(for: [expectation], timeout: kTimeout), .completed) } @@ -375,12 +376,12 @@ final class CallbackConformance: XCTestCase { func testFailUnary() { self.executeTestWithClients { client in - let expectedErrorDetail = Grpc_Testing_ErrorDetail.with { proto in + let expectedErrorDetail = Connectrpc_Conformance_V1_ErrorDetail.with { proto in proto.reason = "soirée 🎉" proto.domain = "connect-conformance" } let expectation = self.expectation(description: "Request completes") - client.failUnaryCall(request: Grpc_Testing_SimpleRequest()) { response in + client.failUnaryCall(request: Connectrpc_Conformance_V1_SimpleRequest()) { response in XCTAssertEqual(response.error?.code, .resourceExhausted) XCTAssertEqual(response.error?.message, "soirée 🎉") XCTAssertEqual(response.error?.unpackedDetails(), [expectedErrorDetail]) @@ -393,7 +394,7 @@ final class CallbackConformance: XCTestCase { func testFailServerStreaming() throws { try self.executeTestWithClients { client in - let expectedErrorDetail = Grpc_Testing_ErrorDetail.with { proto in + let expectedErrorDetail = Connectrpc_Conformance_V1_ErrorDetail.with { proto in proto.reason = "soirée 🎉" proto.domain = "connect-conformance" } @@ -418,11 +419,11 @@ final class CallbackConformance: XCTestCase { expectation.fulfill() } } - try stream.send(Grpc_Testing_StreamingOutputCallRequest.with { proto in + try stream.send(Connectrpc_Conformance_V1_StreamingOutputCallRequest.with { proto in proto.responseParameters = [31_415, 9, 2_653, 58_979] .enumerated() .map { index, value in - return Grpc_Testing_ResponseParameters.with { parameters in + return Connectrpc_Conformance_V1_ResponseParameters.with { parameters in parameters.size = Int32(value) parameters.intervalUs = Int32(index * 10) } @@ -438,7 +439,7 @@ final class CallbackConformance: XCTestCase { func testCancelingUnary() { self.executeTestWithClients { client in let expectation = self.expectation(description: "Receives canceled response") - let cancelable = client.emptyCall(request: Grpc_Testing_Empty()) { response in + let cancelable = client.emptyCall(request: SwiftProtobuf.Google_Protobuf_Empty()) { response in XCTAssertEqual(response.code, .canceled) XCTAssertEqual(response.error?.code, .canceled) expectation.fulfill() diff --git a/Tests/ConnectLibraryTests/ConnectMocksTests/ConnectMocksTests.swift b/Tests/ConnectLibraryTests/ConnectMocksTests/ConnectMocksTests.swift index 5ac38041..864cb4c3 100644 --- a/Tests/ConnectLibraryTests/ConnectMocksTests/ConnectMocksTests.swift +++ b/Tests/ConnectLibraryTests/ConnectMocksTests/ConnectMocksTests.swift @@ -23,13 +23,13 @@ final class ConnectMocksTests: XCTestCase { // MARK: - Unary func testMockUnaryCallbacks() { - let client = Grpc_Testing_TestServiceClientMock() + let client = Connectrpc_Conformance_V1_TestServiceClientMock() client.mockUnaryCall = { request in XCTAssertTrue(request.fillUsername) return ResponseMessage(result: .success(.with { $0.hostname = "pong" })) } - var receivedMessage: Grpc_Testing_SimpleResponse? + var receivedMessage: Connectrpc_Conformance_V1_SimpleResponse? client.unaryCall(request: .with { $0.fillUsername = true }) { response in receivedMessage = response.message } @@ -37,7 +37,7 @@ final class ConnectMocksTests: XCTestCase { } func testMockUnaryAsyncAwait() async { - let client = Grpc_Testing_TestServiceClientMock() + let client = Connectrpc_Conformance_V1_TestServiceClientMock() client.mockAsyncUnaryCall = { request in XCTAssertTrue(request.fillUsername) return ResponseMessage(result: .success(.with { $0.hostname = "pong" })) @@ -50,12 +50,12 @@ final class ConnectMocksTests: XCTestCase { // MARK: - Bidirectional stream func testMockBidirectionalStreamCallbacks() throws { - let client = Grpc_Testing_TestServiceClientMock() - let expectedInputs: [Grpc_Testing_StreamingOutputCallRequest] = [ + let client = Connectrpc_Conformance_V1_TestServiceClientMock() + let expectedInputs: [Connectrpc_Conformance_V1_StreamingOutputCallRequest] = [ .with { $0.responseParameters = [.with { $0.size = 123 }] }, .with { $0.responseParameters = [.with { $0.size = 456 }] }, ] - let expectedResults: [StreamResult] = [ + let expectedResults: [StreamResult] = [ .headers(["x-header": ["123"]]), .message(.with { $0.payload.body = Data(repeating: 0, count: 123) }), .message(.with { $0.payload.body = Data(repeating: 0, count: 456) }), @@ -63,13 +63,13 @@ final class ConnectMocksTests: XCTestCase { ] XCTAssertFalse(client.mockFullDuplexCall.isClosed) - var sentInputs = [Grpc_Testing_StreamingOutputCallRequest]() + var sentInputs = [Connectrpc_Conformance_V1_StreamingOutputCallRequest]() var closeCalled = false client.mockFullDuplexCall.onSend = { sentInputs.append($0) } client.mockFullDuplexCall.onClose = { closeCalled = true } client.mockFullDuplexCall.outputs = Array(expectedResults) - var receivedResults = [StreamResult]() + var receivedResults = [StreamResult]() let stream = client.fullDuplexCall { receivedResults.append($0) } try stream.send(expectedInputs[0]) try stream.send(expectedInputs[1]) @@ -83,12 +83,12 @@ final class ConnectMocksTests: XCTestCase { } func testMockBidirectionalStreamAsyncAwait() async throws { - let client = Grpc_Testing_TestServiceClientMock() - let expectedInputs: [Grpc_Testing_StreamingOutputCallRequest] = [ + let client = Connectrpc_Conformance_V1_TestServiceClientMock() + let expectedInputs: [Connectrpc_Conformance_V1_StreamingOutputCallRequest] = [ .with { $0.responseParameters = [.with { $0.size = 123 }] }, .with { $0.responseParameters = [.with { $0.size = 456 }] }, ] - var expectedResults: [StreamResult] = [ + var expectedResults: [StreamResult] = [ .headers(["x-header": ["123"]]), .message(.with { $0.payload.body = Data(repeating: 0, count: 123) }), .message(.with { $0.payload.body = Data(repeating: 0, count: 456) }), @@ -96,7 +96,7 @@ final class ConnectMocksTests: XCTestCase { ] XCTAssertFalse(client.mockAsyncFullDuplexCall.isClosed) - var sentInputs = [Grpc_Testing_StreamingOutputCallRequest]() + var sentInputs = [Connectrpc_Conformance_V1_StreamingOutputCallRequest]() var closeCalled = false client.mockAsyncFullDuplexCall.onSend = { sentInputs.append($0) } client.mockAsyncFullDuplexCall.onClose = { closeCalled = true } @@ -121,20 +121,20 @@ final class ConnectMocksTests: XCTestCase { // MARK: - Server-only stream func testMockServerOnlyStreamCallbacks() throws { - let client = Grpc_Testing_TestServiceClientMock() - let expectedInput = Grpc_Testing_Empty() - let expectedResults: [StreamResult] = [ + let client = Connectrpc_Conformance_V1_TestServiceClientMock() + let expectedInput = SwiftProtobuf.Google_Protobuf_Empty() + let expectedResults: [StreamResult] = [ .headers(["x-header": ["123"]]), .message(.init()), .message(.init()), .complete(code: .ok, error: nil, trailers: nil), ] - var sentInputs = [Grpc_Testing_Empty]() + var sentInputs = [SwiftProtobuf.Google_Protobuf_Empty]() client.mockUnimplementedStreamingOutputCall.onSend = { sentInputs.append($0) } client.mockUnimplementedStreamingOutputCall.outputs = Array(expectedResults) - var receivedResults = [StreamResult]() + var receivedResults = [StreamResult]() let stream = client.unimplementedStreamingOutputCall { receivedResults.append($0) } try stream.send(expectedInput) @@ -144,18 +144,18 @@ final class ConnectMocksTests: XCTestCase { } func testMockServerOnlyStreamAsyncAwait() async throws { - let client = Grpc_Testing_TestServiceClientMock() - let expectedInput = Grpc_Testing_StreamingOutputCallRequest.with { request in + let client = Connectrpc_Conformance_V1_TestServiceClientMock() + let expectedInput = Connectrpc_Conformance_V1_StreamingOutputCallRequest.with { request in request.responseParameters = [.with { $0.size = 123 }] } - var expectedResults: [StreamResult] = [ + var expectedResults: [StreamResult] = [ .headers(["x-header": ["123"]]), .message(.with { $0.payload.body = Data(repeating: 0, count: 123) }), .message(.with { $0.payload.body = Data(repeating: 0, count: 456) }), .complete(code: .ok, error: nil, trailers: nil), ] - var sentInputs = [Grpc_Testing_StreamingOutputCallRequest]() + var sentInputs = [Connectrpc_Conformance_V1_StreamingOutputCallRequest]() client.mockAsyncStreamingOutputCall.onSend = { sentInputs.append($0) } client.mockAsyncStreamingOutputCall.outputs = Array(expectedResults) diff --git a/Tests/ConnectLibraryTests/ConnectTests/ConnectErrorTests.swift b/Tests/ConnectLibraryTests/ConnectTests/ConnectErrorTests.swift index b9ac6f87..8343c97e 100644 --- a/Tests/ConnectLibraryTests/ConnectTests/ConnectErrorTests.swift +++ b/Tests/ConnectLibraryTests/ConnectTests/ConnectErrorTests.swift @@ -19,7 +19,7 @@ import XCTest final class ConnectErrorTests: XCTestCase { func testDeserializingFullErrorAndUnpackingDetails() throws { - let expectedDetails = Grpc_Testing_SimpleResponse.with { $0.hostname = "foobar" } + let expectedDetails = Connectrpc_Conformance_V1_SimpleResponse.with { $0.hostname = "foobar" } let errorData = try self.errorData(expectedDetails: [expectedDetails]) let error = try JSONDecoder().decode(ConnectError.self, from: errorData) XCTAssertEqual(error.code, .unavailable) @@ -31,8 +31,8 @@ final class ConnectErrorTests: XCTestCase { } func testDeserializingFullErrorAndUnpackingMultipleDetails() throws { - let expectedDetails1 = Grpc_Testing_SimpleResponse.with { $0.hostname = "foo" } - let expectedDetails2 = Grpc_Testing_SimpleResponse.with { $0.hostname = "bar" } + let expectedDetails1 = Connectrpc_Conformance_V1_SimpleResponse.with { $0.hostname = "foo" } + let expectedDetails2 = Connectrpc_Conformance_V1_SimpleResponse.with { $0.hostname = "bar" } let errorData = try self.errorData(expectedDetails: [expectedDetails1, expectedDetails2]) let error = try JSONDecoder().decode(ConnectError.self, from: errorData) XCTAssertEqual(error.code, .unavailable) @@ -44,7 +44,7 @@ final class ConnectErrorTests: XCTestCase { } func testDeserializingErrorUsingHelperFunctionLowercasesHeaderKeys() throws { - let expectedDetails = Grpc_Testing_SimpleResponse.with { $0.hostname = "foobar" } + let expectedDetails = Connectrpc_Conformance_V1_SimpleResponse.with { $0.hostname = "foobar" } let errorData = try self.errorData(expectedDetails: [expectedDetails]) let error = ConnectError.from( code: .aborted, @@ -72,7 +72,7 @@ final class ConnectErrorTests: XCTestCase { XCTAssertNil(error.message) XCTAssertNil(error.exception) XCTAssertTrue(error.details.isEmpty) - XCTAssertEqual(error.unpackedDetails(), [Grpc_Testing_SimpleResponse]()) + XCTAssertEqual(error.unpackedDetails(), [Connectrpc_Conformance_V1_SimpleResponse]()) XCTAssertTrue(error.metadata.isEmpty) } diff --git a/Tests/ConnectLibraryTests/ConnectTests/JSONCodecTests.swift b/Tests/ConnectLibraryTests/ConnectTests/JSONCodecTests.swift index 27beb928..e3874b69 100644 --- a/Tests/ConnectLibraryTests/ConnectTests/JSONCodecTests.swift +++ b/Tests/ConnectLibraryTests/ConnectTests/JSONCodecTests.swift @@ -18,7 +18,7 @@ import SwiftProtobuf import XCTest final class JSONCodecTests: XCTestCase { - private let message: Grpc_Testing_SimpleResponse = .with { proto in + private let message: Connectrpc_Conformance_V1_SimpleResponse = .with { proto in proto.grpclbRouteType = .backend proto.payload = .with { payload in payload.body = Data([0x0, 0x1, 0x2, 0x3]) } proto.serverID = "12345" diff --git a/Tests/ConnectLibraryTests/ConnectTests/ProtoCodecTests.swift b/Tests/ConnectLibraryTests/ConnectTests/ProtoCodecTests.swift index 0c13f234..02374a1a 100644 --- a/Tests/ConnectLibraryTests/ConnectTests/ProtoCodecTests.swift +++ b/Tests/ConnectLibraryTests/ConnectTests/ProtoCodecTests.swift @@ -17,7 +17,7 @@ import SwiftProtobuf import XCTest final class ProtoCodecTests: XCTestCase { - private let message: Grpc_Testing_SimpleResponse = .with { proto in + private let message: Connectrpc_Conformance_V1_SimpleResponse = .with { proto in proto.grpclbRouteType = .backend proto.payload = .with { payload in payload.body = Data([0x0, 0x1, 0x2, 0x3]) } proto.serverID = "12345" diff --git a/Tests/ConnectLibraryTests/ConnectTests/ServiceMetadataTests.swift b/Tests/ConnectLibraryTests/ConnectTests/ServiceMetadataTests.swift index 44c8d755..2a63436a 100644 --- a/Tests/ConnectLibraryTests/ConnectTests/ServiceMetadataTests.swift +++ b/Tests/ConnectLibraryTests/ConnectTests/ServiceMetadataTests.swift @@ -18,7 +18,7 @@ import XCTest final class ServiceMetadataTests: XCTestCase { func testMethodSpecsAreGeneratedCorrectlyForService() { XCTAssertEqual( - Grpc_Testing_TestServiceClient.Metadata.Methods.unaryCall, + Connectrpc_Conformance_V1_TestServiceClient.Metadata.Methods.unaryCall, MethodSpec( name: "UnaryCall", service: "grpc.testing.TestService", @@ -26,11 +26,11 @@ final class ServiceMetadataTests: XCTestCase { ) ) XCTAssertEqual( - Grpc_Testing_TestServiceClient.Metadata.Methods.unaryCall.path, + Connectrpc_Conformance_V1_TestServiceClient.Metadata.Methods.unaryCall.path, "grpc.testing.TestService/UnaryCall" ) XCTAssertEqual( - Grpc_Testing_TestServiceClient.Metadata.Methods.streamingOutputCall, + Connectrpc_Conformance_V1_TestServiceClient.Metadata.Methods.streamingOutputCall, MethodSpec( name: "StreamingOutputCall", service: "grpc.testing.TestService", @@ -38,11 +38,11 @@ final class ServiceMetadataTests: XCTestCase { ) ) XCTAssertEqual( - Grpc_Testing_TestServiceClient.Metadata.Methods.streamingOutputCall.path, + Connectrpc_Conformance_V1_TestServiceClient.Metadata.Methods.streamingOutputCall.path, "grpc.testing.TestService/StreamingOutputCall" ) XCTAssertEqual( - Grpc_Testing_TestServiceClient.Metadata.Methods.streamingInputCall, + Connectrpc_Conformance_V1_TestServiceClient.Metadata.Methods.streamingInputCall, MethodSpec( name: "StreamingInputCall", service: "grpc.testing.TestService", @@ -50,11 +50,11 @@ final class ServiceMetadataTests: XCTestCase { ) ) XCTAssertEqual( - Grpc_Testing_TestServiceClient.Metadata.Methods.streamingInputCall.path, + Connectrpc_Conformance_V1_TestServiceClient.Metadata.Methods.streamingInputCall.path, "grpc.testing.TestService/StreamingInputCall" ) XCTAssertEqual( - Grpc_Testing_TestServiceClient.Metadata.Methods.fullDuplexCall, + Connectrpc_Conformance_V1_TestServiceClient.Metadata.Methods.fullDuplexCall, MethodSpec( name: "FullDuplexCall", service: "grpc.testing.TestService", @@ -62,7 +62,7 @@ final class ServiceMetadataTests: XCTestCase { ) ) XCTAssertEqual( - Grpc_Testing_TestServiceClient.Metadata.Methods.fullDuplexCall.path, + Connectrpc_Conformance_V1_TestServiceClient.Metadata.Methods.fullDuplexCall.path, "grpc.testing.TestService/FullDuplexCall" ) } diff --git a/Tests/ConnectLibraryTests/Generated/grpc/testing/messages.pb.swift b/Tests/ConnectLibraryTests/Generated/connectrpc/conformance/v1/messages.pb.swift similarity index 80% rename from Tests/ConnectLibraryTests/Generated/grpc/testing/messages.pb.swift rename to Tests/ConnectLibraryTests/Generated/connectrpc/conformance/v1/messages.pb.swift index 2e6e0fb4..e46a3b68 100644 --- a/Tests/ConnectLibraryTests/Generated/grpc/testing/messages.pb.swift +++ b/Tests/ConnectLibraryTests/Generated/connectrpc/conformance/v1/messages.pb.swift @@ -2,11 +2,25 @@ // swift-format-ignore-file // // Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: grpc/testing/messages.proto +// Source: connectrpc/conformance/v1/messages.proto // // For information on using the generated types, please see the documentation: // https://github.com/apple/swift-protobuf/ +// Copyright 2022 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // This is copied from gRPC's testing Protobuf definitions: https://github.com/grpc/grpc/blob/master/src/proto/grpc/testing/messages.proto // Copyright 2015-2016 gRPC authors. @@ -39,7 +53,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP } /// The type of payload that should be returned. -enum Grpc_Testing_PayloadType: SwiftProtobuf.Enum { +enum Connectrpc_Conformance_V1_PayloadType: SwiftProtobuf.Enum { typealias RawValue = Int /// Compressable text format. @@ -68,9 +82,9 @@ enum Grpc_Testing_PayloadType: SwiftProtobuf.Enum { #if swift(>=4.2) -extension Grpc_Testing_PayloadType: CaseIterable { +extension Connectrpc_Conformance_V1_PayloadType: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Grpc_Testing_PayloadType] = [ + static let allCases: [Connectrpc_Conformance_V1_PayloadType] = [ .compressable, ] } @@ -83,7 +97,7 @@ extension Grpc_Testing_PayloadType: CaseIterable { /// that the RPC reached the server via "gRPCLB backend" path (i.e. if it got /// the address of this server from the gRPCLB server BalanceLoad RPC). Exactly /// how this detection is done is context and server dependent. -enum Grpc_Testing_GrpclbRouteType: SwiftProtobuf.Enum { +enum Connectrpc_Conformance_V1_GrpclbRouteType: SwiftProtobuf.Enum { typealias RawValue = Int /// Server didn't detect the route that a client took to reach it. @@ -122,9 +136,9 @@ enum Grpc_Testing_GrpclbRouteType: SwiftProtobuf.Enum { #if swift(>=4.2) -extension Grpc_Testing_GrpclbRouteType: CaseIterable { +extension Connectrpc_Conformance_V1_GrpclbRouteType: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Grpc_Testing_GrpclbRouteType] = [ + static let allCases: [Connectrpc_Conformance_V1_GrpclbRouteType] = [ .unknown, .fallback, .backend, @@ -133,30 +147,14 @@ extension Grpc_Testing_GrpclbRouteType: CaseIterable { #endif // swift(>=4.2) -/// TODO(dgq): Go back to using well-known types once -/// https://github.com/grpc/grpc/issues/6980 has been fixed. -/// import "google/protobuf/wrappers.proto"; -struct Grpc_Testing_BoolValue { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - /// The bool value. - var value: Bool = false - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - /// A block of data, to simply increase gRPC message size. -struct Grpc_Testing_Payload { +struct Connectrpc_Conformance_V1_Payload { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. /// The type of data in body. - var type: Grpc_Testing_PayloadType = .compressable + var type: Connectrpc_Conformance_V1_PayloadType = .compressable /// Primary contents of payload. var body: Data = Data() @@ -168,7 +166,7 @@ struct Grpc_Testing_Payload { /// A protobuf representation for grpc status. This is used by test /// clients to specify a status that the server should attempt to return. -struct Grpc_Testing_EchoStatus { +struct Connectrpc_Conformance_V1_EchoStatus { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. @@ -183,21 +181,21 @@ struct Grpc_Testing_EchoStatus { } /// Unary request. -struct Grpc_Testing_SimpleRequest { +struct Connectrpc_Conformance_V1_SimpleRequest { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. /// Desired payload type in the response from the server. /// If response_type is RANDOM, server randomly chooses one from other formats. - var responseType: Grpc_Testing_PayloadType = .compressable + var responseType: Connectrpc_Conformance_V1_PayloadType = .compressable /// Desired payload size in the response from the server. var responseSize: Int32 = 0 /// Optional input payload sent along with the request. - var payload: Grpc_Testing_Payload { - get {return _payload ?? Grpc_Testing_Payload()} + var payload: Connectrpc_Conformance_V1_Payload { + get {return _payload ?? Connectrpc_Conformance_V1_Payload()} set {_payload = newValue} } /// Returns true if `payload` has been explicitly set. @@ -215,8 +213,8 @@ struct Grpc_Testing_SimpleRequest { /// "nullable" in order to interoperate seamlessly with clients not able to /// implement the full compression tests by introspecting the call to verify /// the response's compression status. - var responseCompressed: Grpc_Testing_BoolValue { - get {return _responseCompressed ?? Grpc_Testing_BoolValue()} + var responseCompressed: SwiftProtobuf.Google_Protobuf_BoolValue { + get {return _responseCompressed ?? SwiftProtobuf.Google_Protobuf_BoolValue()} set {_responseCompressed = newValue} } /// Returns true if `responseCompressed` has been explicitly set. @@ -225,8 +223,8 @@ struct Grpc_Testing_SimpleRequest { mutating func clearResponseCompressed() {self._responseCompressed = nil} /// Whether server should return a given status - var responseStatus: Grpc_Testing_EchoStatus { - get {return _responseStatus ?? Grpc_Testing_EchoStatus()} + var responseStatus: Connectrpc_Conformance_V1_EchoStatus { + get {return _responseStatus ?? Connectrpc_Conformance_V1_EchoStatus()} set {_responseStatus = newValue} } /// Returns true if `responseStatus` has been explicitly set. @@ -235,8 +233,8 @@ struct Grpc_Testing_SimpleRequest { mutating func clearResponseStatus() {self._responseStatus = nil} /// Whether the server should expect this request to be compressed. - var expectCompressed: Grpc_Testing_BoolValue { - get {return _expectCompressed ?? Grpc_Testing_BoolValue()} + var expectCompressed: SwiftProtobuf.Google_Protobuf_BoolValue { + get {return _expectCompressed ?? SwiftProtobuf.Google_Protobuf_BoolValue()} set {_expectCompressed = newValue} } /// Returns true if `expectCompressed` has been explicitly set. @@ -254,21 +252,21 @@ struct Grpc_Testing_SimpleRequest { init() {} - fileprivate var _payload: Grpc_Testing_Payload? = nil - fileprivate var _responseCompressed: Grpc_Testing_BoolValue? = nil - fileprivate var _responseStatus: Grpc_Testing_EchoStatus? = nil - fileprivate var _expectCompressed: Grpc_Testing_BoolValue? = nil + fileprivate var _payload: Connectrpc_Conformance_V1_Payload? = nil + fileprivate var _responseCompressed: SwiftProtobuf.Google_Protobuf_BoolValue? = nil + fileprivate var _responseStatus: Connectrpc_Conformance_V1_EchoStatus? = nil + fileprivate var _expectCompressed: SwiftProtobuf.Google_Protobuf_BoolValue? = nil } /// Unary response, as configured by the request. -struct Grpc_Testing_SimpleResponse { +struct Connectrpc_Conformance_V1_SimpleResponse { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. /// Payload to increase message size. - var payload: Grpc_Testing_Payload { - get {return _payload ?? Grpc_Testing_Payload()} + var payload: Connectrpc_Conformance_V1_Payload { + get {return _payload ?? Connectrpc_Conformance_V1_Payload()} set {_payload = newValue} } /// Returns true if `payload` has been explicitly set. @@ -288,7 +286,7 @@ struct Grpc_Testing_SimpleResponse { var serverID: String = String() /// gRPCLB Path. - var grpclbRouteType: Grpc_Testing_GrpclbRouteType = .unknown + var grpclbRouteType: Connectrpc_Conformance_V1_GrpclbRouteType = .unknown /// Server hostname. var hostname: String = String() @@ -297,18 +295,18 @@ struct Grpc_Testing_SimpleResponse { init() {} - fileprivate var _payload: Grpc_Testing_Payload? = nil + fileprivate var _payload: Connectrpc_Conformance_V1_Payload? = nil } /// Client-streaming request. -struct Grpc_Testing_StreamingInputCallRequest { +struct Connectrpc_Conformance_V1_StreamingInputCallRequest { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. /// Optional input payload sent along with the request. - var payload: Grpc_Testing_Payload { - get {return _payload ?? Grpc_Testing_Payload()} + var payload: Connectrpc_Conformance_V1_Payload { + get {return _payload ?? Connectrpc_Conformance_V1_Payload()} set {_payload = newValue} } /// Returns true if `payload` has been explicitly set. @@ -320,8 +318,8 @@ struct Grpc_Testing_StreamingInputCallRequest { /// is "nullable" in order to interoperate seamlessly with servers not able to /// implement the full compression tests by introspecting the call to verify /// the request's compression status. - var expectCompressed: Grpc_Testing_BoolValue { - get {return _expectCompressed ?? Grpc_Testing_BoolValue()} + var expectCompressed: SwiftProtobuf.Google_Protobuf_BoolValue { + get {return _expectCompressed ?? SwiftProtobuf.Google_Protobuf_BoolValue()} set {_expectCompressed = newValue} } /// Returns true if `expectCompressed` has been explicitly set. @@ -333,12 +331,12 @@ struct Grpc_Testing_StreamingInputCallRequest { init() {} - fileprivate var _payload: Grpc_Testing_Payload? = nil - fileprivate var _expectCompressed: Grpc_Testing_BoolValue? = nil + fileprivate var _payload: Connectrpc_Conformance_V1_Payload? = nil + fileprivate var _expectCompressed: SwiftProtobuf.Google_Protobuf_BoolValue? = nil } /// Client-streaming response. -struct Grpc_Testing_StreamingInputCallResponse { +struct Connectrpc_Conformance_V1_StreamingInputCallResponse { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. @@ -352,7 +350,7 @@ struct Grpc_Testing_StreamingInputCallResponse { } /// Configuration for a particular response. -struct Grpc_Testing_ResponseParameters { +struct Connectrpc_Conformance_V1_ResponseParameters { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. @@ -368,8 +366,8 @@ struct Grpc_Testing_ResponseParameters { /// "nullable" in order to interoperate seamlessly with clients not able to /// implement the full compression tests by introspecting the call to verify /// the response's compression status. - var compressed: Grpc_Testing_BoolValue { - get {return _compressed ?? Grpc_Testing_BoolValue()} + var compressed: SwiftProtobuf.Google_Protobuf_BoolValue { + get {return _compressed ?? SwiftProtobuf.Google_Protobuf_BoolValue()} set {_compressed = newValue} } /// Returns true if `compressed` has been explicitly set. @@ -381,11 +379,11 @@ struct Grpc_Testing_ResponseParameters { init() {} - fileprivate var _compressed: Grpc_Testing_BoolValue? = nil + fileprivate var _compressed: SwiftProtobuf.Google_Protobuf_BoolValue? = nil } /// Server-streaming request. -struct Grpc_Testing_StreamingOutputCallRequest { +struct Connectrpc_Conformance_V1_StreamingOutputCallRequest { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. @@ -394,14 +392,14 @@ struct Grpc_Testing_StreamingOutputCallRequest { /// If response_type is RANDOM, the payload from each response in the stream /// might be of different types. This is to simulate a mixed type of payload /// stream. - var responseType: Grpc_Testing_PayloadType = .compressable + var responseType: Connectrpc_Conformance_V1_PayloadType = .compressable /// Configuration for each expected response message. - var responseParameters: [Grpc_Testing_ResponseParameters] = [] + var responseParameters: [Connectrpc_Conformance_V1_ResponseParameters] = [] /// Optional input payload sent along with the request. - var payload: Grpc_Testing_Payload { - get {return _payload ?? Grpc_Testing_Payload()} + var payload: Connectrpc_Conformance_V1_Payload { + get {return _payload ?? Connectrpc_Conformance_V1_Payload()} set {_payload = newValue} } /// Returns true if `payload` has been explicitly set. @@ -410,8 +408,8 @@ struct Grpc_Testing_StreamingOutputCallRequest { mutating func clearPayload() {self._payload = nil} /// Whether server should return a given status - var responseStatus: Grpc_Testing_EchoStatus { - get {return _responseStatus ?? Grpc_Testing_EchoStatus()} + var responseStatus: Connectrpc_Conformance_V1_EchoStatus { + get {return _responseStatus ?? Connectrpc_Conformance_V1_EchoStatus()} set {_responseStatus = newValue} } /// Returns true if `responseStatus` has been explicitly set. @@ -423,19 +421,19 @@ struct Grpc_Testing_StreamingOutputCallRequest { init() {} - fileprivate var _payload: Grpc_Testing_Payload? = nil - fileprivate var _responseStatus: Grpc_Testing_EchoStatus? = nil + fileprivate var _payload: Connectrpc_Conformance_V1_Payload? = nil + fileprivate var _responseStatus: Connectrpc_Conformance_V1_EchoStatus? = nil } /// Server-streaming response, as configured by the request and parameters. -struct Grpc_Testing_StreamingOutputCallResponse { +struct Connectrpc_Conformance_V1_StreamingOutputCallResponse { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. /// Payload to increase response size. - var payload: Grpc_Testing_Payload { - get {return _payload ?? Grpc_Testing_Payload()} + var payload: Connectrpc_Conformance_V1_Payload { + get {return _payload ?? Connectrpc_Conformance_V1_Payload()} set {_payload = newValue} } /// Returns true if `payload` has been explicitly set. @@ -447,12 +445,12 @@ struct Grpc_Testing_StreamingOutputCallResponse { init() {} - fileprivate var _payload: Grpc_Testing_Payload? = nil + fileprivate var _payload: Connectrpc_Conformance_V1_Payload? = nil } /// For reconnect interop test only. /// Client tells server what reconnection parameters it used. -struct Grpc_Testing_ReconnectParams { +struct Connectrpc_Conformance_V1_ReconnectParams { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. @@ -467,7 +465,7 @@ struct Grpc_Testing_ReconnectParams { /// For reconnect interop test only. /// Server tells client whether its reconnects are following the spec and the /// reconnect backoffs it saw. -struct Grpc_Testing_ReconnectInfo { +struct Connectrpc_Conformance_V1_ReconnectInfo { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. @@ -481,7 +479,7 @@ struct Grpc_Testing_ReconnectInfo { init() {} } -struct Grpc_Testing_LoadBalancerStatsRequest { +struct Connectrpc_Conformance_V1_LoadBalancerStatsRequest { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. @@ -497,7 +495,7 @@ struct Grpc_Testing_LoadBalancerStatsRequest { init() {} } -struct Grpc_Testing_LoadBalancerStatsResponse { +struct Connectrpc_Conformance_V1_LoadBalancerStatsResponse { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. @@ -508,7 +506,7 @@ struct Grpc_Testing_LoadBalancerStatsResponse { /// The number of RPCs that failed to record a remote peer. var numFailures: Int32 = 0 - var rpcsByMethod: Dictionary = [:] + var rpcsByMethod: Dictionary = [:] var unknownFields = SwiftProtobuf.UnknownStorage() @@ -529,7 +527,7 @@ struct Grpc_Testing_LoadBalancerStatsResponse { } /// Request for retrieving a test client's accumulated stats. -struct Grpc_Testing_LoadBalancerAccumulatedStatsRequest { +struct Connectrpc_Conformance_V1_LoadBalancerAccumulatedStatsRequest { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. @@ -540,7 +538,7 @@ struct Grpc_Testing_LoadBalancerAccumulatedStatsRequest { } /// Accumulated stats for RPCs sent by a test client. -struct Grpc_Testing_LoadBalancerAccumulatedStatsResponse { +struct Connectrpc_Conformance_V1_LoadBalancerAccumulatedStatsResponse { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. @@ -559,7 +557,7 @@ struct Grpc_Testing_LoadBalancerAccumulatedStatsResponse { /// Per-method RPC statistics. The key is the RpcType in string form; e.g. /// 'EMPTY_CALL' or 'UNARY_CALL' - var statsPerMethod: Dictionary = [:] + var statsPerMethod: Dictionary = [:] var unknownFields = SwiftProtobuf.UnknownStorage() @@ -584,16 +582,16 @@ struct Grpc_Testing_LoadBalancerAccumulatedStatsResponse { } /// Configurations for a test client. -struct Grpc_Testing_ClientConfigureRequest { +struct Connectrpc_Conformance_V1_ClientConfigureRequest { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. /// The types of RPCs the client sends. - var types: [Grpc_Testing_ClientConfigureRequest.RpcType] = [] + var types: [Connectrpc_Conformance_V1_ClientConfigureRequest.RpcType] = [] /// The collection of custom metadata to be attached to RPCs sent by the client. - var metadata: [Grpc_Testing_ClientConfigureRequest.Metadata] = [] + var metadata: [Connectrpc_Conformance_V1_ClientConfigureRequest.Metadata] = [] /// The deadline to use, in seconds, for all RPCs. If unset or zero, the /// client will use the default from the command-line. @@ -636,7 +634,7 @@ struct Grpc_Testing_ClientConfigureRequest { // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. - var type: Grpc_Testing_ClientConfigureRequest.RpcType = .emptyCall + var type: Connectrpc_Conformance_V1_ClientConfigureRequest.RpcType = .emptyCall var key: String = String() @@ -652,9 +650,9 @@ struct Grpc_Testing_ClientConfigureRequest { #if swift(>=4.2) -extension Grpc_Testing_ClientConfigureRequest.RpcType: CaseIterable { +extension Connectrpc_Conformance_V1_ClientConfigureRequest.RpcType: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Grpc_Testing_ClientConfigureRequest.RpcType] = [ + static let allCases: [Connectrpc_Conformance_V1_ClientConfigureRequest.RpcType] = [ .emptyCall, .unaryCall, ] @@ -663,7 +661,7 @@ extension Grpc_Testing_ClientConfigureRequest.RpcType: CaseIterable { #endif // swift(>=4.2) /// Response for updating a test client's configuration. -struct Grpc_Testing_ClientConfigureResponse { +struct Connectrpc_Conformance_V1_ClientConfigureResponse { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. @@ -673,7 +671,7 @@ struct Grpc_Testing_ClientConfigureResponse { init() {} } -struct Grpc_Testing_ErrorDetail { +struct Connectrpc_Conformance_V1_ErrorDetail { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. @@ -687,7 +685,7 @@ struct Grpc_Testing_ErrorDetail { init() {} } -struct Grpc_Testing_ErrorStatus { +struct Connectrpc_Conformance_V1_ErrorStatus { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. @@ -704,45 +702,44 @@ struct Grpc_Testing_ErrorStatus { } #if swift(>=5.5) && canImport(_Concurrency) -extension Grpc_Testing_PayloadType: @unchecked Sendable {} -extension Grpc_Testing_GrpclbRouteType: @unchecked Sendable {} -extension Grpc_Testing_BoolValue: @unchecked Sendable {} -extension Grpc_Testing_Payload: @unchecked Sendable {} -extension Grpc_Testing_EchoStatus: @unchecked Sendable {} -extension Grpc_Testing_SimpleRequest: @unchecked Sendable {} -extension Grpc_Testing_SimpleResponse: @unchecked Sendable {} -extension Grpc_Testing_StreamingInputCallRequest: @unchecked Sendable {} -extension Grpc_Testing_StreamingInputCallResponse: @unchecked Sendable {} -extension Grpc_Testing_ResponseParameters: @unchecked Sendable {} -extension Grpc_Testing_StreamingOutputCallRequest: @unchecked Sendable {} -extension Grpc_Testing_StreamingOutputCallResponse: @unchecked Sendable {} -extension Grpc_Testing_ReconnectParams: @unchecked Sendable {} -extension Grpc_Testing_ReconnectInfo: @unchecked Sendable {} -extension Grpc_Testing_LoadBalancerStatsRequest: @unchecked Sendable {} -extension Grpc_Testing_LoadBalancerStatsResponse: @unchecked Sendable {} -extension Grpc_Testing_LoadBalancerStatsResponse.RpcsByPeer: @unchecked Sendable {} -extension Grpc_Testing_LoadBalancerAccumulatedStatsRequest: @unchecked Sendable {} -extension Grpc_Testing_LoadBalancerAccumulatedStatsResponse: @unchecked Sendable {} -extension Grpc_Testing_LoadBalancerAccumulatedStatsResponse.MethodStats: @unchecked Sendable {} -extension Grpc_Testing_ClientConfigureRequest: @unchecked Sendable {} -extension Grpc_Testing_ClientConfigureRequest.RpcType: @unchecked Sendable {} -extension Grpc_Testing_ClientConfigureRequest.Metadata: @unchecked Sendable {} -extension Grpc_Testing_ClientConfigureResponse: @unchecked Sendable {} -extension Grpc_Testing_ErrorDetail: @unchecked Sendable {} -extension Grpc_Testing_ErrorStatus: @unchecked Sendable {} +extension Connectrpc_Conformance_V1_PayloadType: @unchecked Sendable {} +extension Connectrpc_Conformance_V1_GrpclbRouteType: @unchecked Sendable {} +extension Connectrpc_Conformance_V1_Payload: @unchecked Sendable {} +extension Connectrpc_Conformance_V1_EchoStatus: @unchecked Sendable {} +extension Connectrpc_Conformance_V1_SimpleRequest: @unchecked Sendable {} +extension Connectrpc_Conformance_V1_SimpleResponse: @unchecked Sendable {} +extension Connectrpc_Conformance_V1_StreamingInputCallRequest: @unchecked Sendable {} +extension Connectrpc_Conformance_V1_StreamingInputCallResponse: @unchecked Sendable {} +extension Connectrpc_Conformance_V1_ResponseParameters: @unchecked Sendable {} +extension Connectrpc_Conformance_V1_StreamingOutputCallRequest: @unchecked Sendable {} +extension Connectrpc_Conformance_V1_StreamingOutputCallResponse: @unchecked Sendable {} +extension Connectrpc_Conformance_V1_ReconnectParams: @unchecked Sendable {} +extension Connectrpc_Conformance_V1_ReconnectInfo: @unchecked Sendable {} +extension Connectrpc_Conformance_V1_LoadBalancerStatsRequest: @unchecked Sendable {} +extension Connectrpc_Conformance_V1_LoadBalancerStatsResponse: @unchecked Sendable {} +extension Connectrpc_Conformance_V1_LoadBalancerStatsResponse.RpcsByPeer: @unchecked Sendable {} +extension Connectrpc_Conformance_V1_LoadBalancerAccumulatedStatsRequest: @unchecked Sendable {} +extension Connectrpc_Conformance_V1_LoadBalancerAccumulatedStatsResponse: @unchecked Sendable {} +extension Connectrpc_Conformance_V1_LoadBalancerAccumulatedStatsResponse.MethodStats: @unchecked Sendable {} +extension Connectrpc_Conformance_V1_ClientConfigureRequest: @unchecked Sendable {} +extension Connectrpc_Conformance_V1_ClientConfigureRequest.RpcType: @unchecked Sendable {} +extension Connectrpc_Conformance_V1_ClientConfigureRequest.Metadata: @unchecked Sendable {} +extension Connectrpc_Conformance_V1_ClientConfigureResponse: @unchecked Sendable {} +extension Connectrpc_Conformance_V1_ErrorDetail: @unchecked Sendable {} +extension Connectrpc_Conformance_V1_ErrorStatus: @unchecked Sendable {} #endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "grpc.testing" +fileprivate let _protobuf_package = "connectrpc.conformance.v1" -extension Grpc_Testing_PayloadType: SwiftProtobuf._ProtoNameProviding { +extension Connectrpc_Conformance_V1_PayloadType: SwiftProtobuf._ProtoNameProviding { static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "COMPRESSABLE"), ] } -extension Grpc_Testing_GrpclbRouteType: SwiftProtobuf._ProtoNameProviding { +extension Connectrpc_Conformance_V1_GrpclbRouteType: SwiftProtobuf._ProtoNameProviding { static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "GRPCLB_ROUTE_TYPE_UNKNOWN"), 1: .same(proto: "GRPCLB_ROUTE_TYPE_FALLBACK"), @@ -750,39 +747,7 @@ extension Grpc_Testing_GrpclbRouteType: SwiftProtobuf._ProtoNameProviding { ] } -extension Grpc_Testing_BoolValue: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".BoolValue" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "value"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularBoolField(value: &self.value) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.value != false { - try visitor.visitSingularBoolField(value: self.value, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Grpc_Testing_BoolValue, rhs: Grpc_Testing_BoolValue) -> Bool { - if lhs.value != rhs.value {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Grpc_Testing_Payload: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Connectrpc_Conformance_V1_Payload: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".Payload" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "type"), @@ -812,7 +777,7 @@ extension Grpc_Testing_Payload: SwiftProtobuf.Message, SwiftProtobuf._MessageImp try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Grpc_Testing_Payload, rhs: Grpc_Testing_Payload) -> Bool { + static func ==(lhs: Connectrpc_Conformance_V1_Payload, rhs: Connectrpc_Conformance_V1_Payload) -> Bool { if lhs.type != rhs.type {return false} if lhs.body != rhs.body {return false} if lhs.unknownFields != rhs.unknownFields {return false} @@ -820,7 +785,7 @@ extension Grpc_Testing_Payload: SwiftProtobuf.Message, SwiftProtobuf._MessageImp } } -extension Grpc_Testing_EchoStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Connectrpc_Conformance_V1_EchoStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".EchoStatus" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "code"), @@ -850,7 +815,7 @@ extension Grpc_Testing_EchoStatus: SwiftProtobuf.Message, SwiftProtobuf._Message try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Grpc_Testing_EchoStatus, rhs: Grpc_Testing_EchoStatus) -> Bool { + static func ==(lhs: Connectrpc_Conformance_V1_EchoStatus, rhs: Connectrpc_Conformance_V1_EchoStatus) -> Bool { if lhs.code != rhs.code {return false} if lhs.message != rhs.message {return false} if lhs.unknownFields != rhs.unknownFields {return false} @@ -858,7 +823,7 @@ extension Grpc_Testing_EchoStatus: SwiftProtobuf.Message, SwiftProtobuf._Message } } -extension Grpc_Testing_SimpleRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Connectrpc_Conformance_V1_SimpleRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".SimpleRequest" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "response_type"), @@ -932,7 +897,7 @@ extension Grpc_Testing_SimpleRequest: SwiftProtobuf.Message, SwiftProtobuf._Mess try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Grpc_Testing_SimpleRequest, rhs: Grpc_Testing_SimpleRequest) -> Bool { + static func ==(lhs: Connectrpc_Conformance_V1_SimpleRequest, rhs: Connectrpc_Conformance_V1_SimpleRequest) -> Bool { if lhs.responseType != rhs.responseType {return false} if lhs.responseSize != rhs.responseSize {return false} if lhs._payload != rhs._payload {return false} @@ -948,7 +913,7 @@ extension Grpc_Testing_SimpleRequest: SwiftProtobuf.Message, SwiftProtobuf._Mess } } -extension Grpc_Testing_SimpleResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Connectrpc_Conformance_V1_SimpleResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".SimpleResponse" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "payload"), @@ -1002,7 +967,7 @@ extension Grpc_Testing_SimpleResponse: SwiftProtobuf.Message, SwiftProtobuf._Mes try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Grpc_Testing_SimpleResponse, rhs: Grpc_Testing_SimpleResponse) -> Bool { + static func ==(lhs: Connectrpc_Conformance_V1_SimpleResponse, rhs: Connectrpc_Conformance_V1_SimpleResponse) -> Bool { if lhs._payload != rhs._payload {return false} if lhs.username != rhs.username {return false} if lhs.oauthScope != rhs.oauthScope {return false} @@ -1014,7 +979,7 @@ extension Grpc_Testing_SimpleResponse: SwiftProtobuf.Message, SwiftProtobuf._Mes } } -extension Grpc_Testing_StreamingInputCallRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Connectrpc_Conformance_V1_StreamingInputCallRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".StreamingInputCallRequest" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "payload"), @@ -1048,7 +1013,7 @@ extension Grpc_Testing_StreamingInputCallRequest: SwiftProtobuf.Message, SwiftPr try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Grpc_Testing_StreamingInputCallRequest, rhs: Grpc_Testing_StreamingInputCallRequest) -> Bool { + static func ==(lhs: Connectrpc_Conformance_V1_StreamingInputCallRequest, rhs: Connectrpc_Conformance_V1_StreamingInputCallRequest) -> Bool { if lhs._payload != rhs._payload {return false} if lhs._expectCompressed != rhs._expectCompressed {return false} if lhs.unknownFields != rhs.unknownFields {return false} @@ -1056,7 +1021,7 @@ extension Grpc_Testing_StreamingInputCallRequest: SwiftProtobuf.Message, SwiftPr } } -extension Grpc_Testing_StreamingInputCallResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Connectrpc_Conformance_V1_StreamingInputCallResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".StreamingInputCallResponse" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "aggregated_payload_size"), @@ -1081,14 +1046,14 @@ extension Grpc_Testing_StreamingInputCallResponse: SwiftProtobuf.Message, SwiftP try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Grpc_Testing_StreamingInputCallResponse, rhs: Grpc_Testing_StreamingInputCallResponse) -> Bool { + static func ==(lhs: Connectrpc_Conformance_V1_StreamingInputCallResponse, rhs: Connectrpc_Conformance_V1_StreamingInputCallResponse) -> Bool { if lhs.aggregatedPayloadSize != rhs.aggregatedPayloadSize {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } } -extension Grpc_Testing_ResponseParameters: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Connectrpc_Conformance_V1_ResponseParameters: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".ResponseParameters" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "size"), @@ -1127,7 +1092,7 @@ extension Grpc_Testing_ResponseParameters: SwiftProtobuf.Message, SwiftProtobuf. try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Grpc_Testing_ResponseParameters, rhs: Grpc_Testing_ResponseParameters) -> Bool { + static func ==(lhs: Connectrpc_Conformance_V1_ResponseParameters, rhs: Connectrpc_Conformance_V1_ResponseParameters) -> Bool { if lhs.size != rhs.size {return false} if lhs.intervalUs != rhs.intervalUs {return false} if lhs._compressed != rhs._compressed {return false} @@ -1136,7 +1101,7 @@ extension Grpc_Testing_ResponseParameters: SwiftProtobuf.Message, SwiftProtobuf. } } -extension Grpc_Testing_StreamingOutputCallRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Connectrpc_Conformance_V1_StreamingOutputCallRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".StreamingOutputCallRequest" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "response_type"), @@ -1180,7 +1145,7 @@ extension Grpc_Testing_StreamingOutputCallRequest: SwiftProtobuf.Message, SwiftP try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Grpc_Testing_StreamingOutputCallRequest, rhs: Grpc_Testing_StreamingOutputCallRequest) -> Bool { + static func ==(lhs: Connectrpc_Conformance_V1_StreamingOutputCallRequest, rhs: Connectrpc_Conformance_V1_StreamingOutputCallRequest) -> Bool { if lhs.responseType != rhs.responseType {return false} if lhs.responseParameters != rhs.responseParameters {return false} if lhs._payload != rhs._payload {return false} @@ -1190,7 +1155,7 @@ extension Grpc_Testing_StreamingOutputCallRequest: SwiftProtobuf.Message, SwiftP } } -extension Grpc_Testing_StreamingOutputCallResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Connectrpc_Conformance_V1_StreamingOutputCallResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".StreamingOutputCallResponse" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "payload"), @@ -1219,14 +1184,14 @@ extension Grpc_Testing_StreamingOutputCallResponse: SwiftProtobuf.Message, Swift try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Grpc_Testing_StreamingOutputCallResponse, rhs: Grpc_Testing_StreamingOutputCallResponse) -> Bool { + static func ==(lhs: Connectrpc_Conformance_V1_StreamingOutputCallResponse, rhs: Connectrpc_Conformance_V1_StreamingOutputCallResponse) -> Bool { if lhs._payload != rhs._payload {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } } -extension Grpc_Testing_ReconnectParams: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Connectrpc_Conformance_V1_ReconnectParams: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".ReconnectParams" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "max_reconnect_backoff_ms"), @@ -1251,14 +1216,14 @@ extension Grpc_Testing_ReconnectParams: SwiftProtobuf.Message, SwiftProtobuf._Me try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Grpc_Testing_ReconnectParams, rhs: Grpc_Testing_ReconnectParams) -> Bool { + static func ==(lhs: Connectrpc_Conformance_V1_ReconnectParams, rhs: Connectrpc_Conformance_V1_ReconnectParams) -> Bool { if lhs.maxReconnectBackoffMs != rhs.maxReconnectBackoffMs {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } } -extension Grpc_Testing_ReconnectInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Connectrpc_Conformance_V1_ReconnectInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".ReconnectInfo" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "passed"), @@ -1288,7 +1253,7 @@ extension Grpc_Testing_ReconnectInfo: SwiftProtobuf.Message, SwiftProtobuf._Mess try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Grpc_Testing_ReconnectInfo, rhs: Grpc_Testing_ReconnectInfo) -> Bool { + static func ==(lhs: Connectrpc_Conformance_V1_ReconnectInfo, rhs: Connectrpc_Conformance_V1_ReconnectInfo) -> Bool { if lhs.passed != rhs.passed {return false} if lhs.backoffMs != rhs.backoffMs {return false} if lhs.unknownFields != rhs.unknownFields {return false} @@ -1296,7 +1261,7 @@ extension Grpc_Testing_ReconnectInfo: SwiftProtobuf.Message, SwiftProtobuf._Mess } } -extension Grpc_Testing_LoadBalancerStatsRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Connectrpc_Conformance_V1_LoadBalancerStatsRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".LoadBalancerStatsRequest" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "num_rpcs"), @@ -1326,7 +1291,7 @@ extension Grpc_Testing_LoadBalancerStatsRequest: SwiftProtobuf.Message, SwiftPro try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Grpc_Testing_LoadBalancerStatsRequest, rhs: Grpc_Testing_LoadBalancerStatsRequest) -> Bool { + static func ==(lhs: Connectrpc_Conformance_V1_LoadBalancerStatsRequest, rhs: Connectrpc_Conformance_V1_LoadBalancerStatsRequest) -> Bool { if lhs.numRpcs != rhs.numRpcs {return false} if lhs.timeoutSec != rhs.timeoutSec {return false} if lhs.unknownFields != rhs.unknownFields {return false} @@ -1334,7 +1299,7 @@ extension Grpc_Testing_LoadBalancerStatsRequest: SwiftProtobuf.Message, SwiftPro } } -extension Grpc_Testing_LoadBalancerStatsResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Connectrpc_Conformance_V1_LoadBalancerStatsResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".LoadBalancerStatsResponse" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "rpcs_by_peer"), @@ -1350,7 +1315,7 @@ extension Grpc_Testing_LoadBalancerStatsResponse: SwiftProtobuf.Message, SwiftPr switch fieldNumber { case 1: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: &self.rpcsByPeer) }() case 2: try { try decoder.decodeSingularInt32Field(value: &self.numFailures) }() - case 3: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: &self.rpcsByMethod) }() + case 3: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: &self.rpcsByMethod) }() default: break } } @@ -1364,12 +1329,12 @@ extension Grpc_Testing_LoadBalancerStatsResponse: SwiftProtobuf.Message, SwiftPr try visitor.visitSingularInt32Field(value: self.numFailures, fieldNumber: 2) } if !self.rpcsByMethod.isEmpty { - try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: self.rpcsByMethod, fieldNumber: 3) + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: self.rpcsByMethod, fieldNumber: 3) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Grpc_Testing_LoadBalancerStatsResponse, rhs: Grpc_Testing_LoadBalancerStatsResponse) -> Bool { + static func ==(lhs: Connectrpc_Conformance_V1_LoadBalancerStatsResponse, rhs: Connectrpc_Conformance_V1_LoadBalancerStatsResponse) -> Bool { if lhs.rpcsByPeer != rhs.rpcsByPeer {return false} if lhs.numFailures != rhs.numFailures {return false} if lhs.rpcsByMethod != rhs.rpcsByMethod {return false} @@ -1378,8 +1343,8 @@ extension Grpc_Testing_LoadBalancerStatsResponse: SwiftProtobuf.Message, SwiftPr } } -extension Grpc_Testing_LoadBalancerStatsResponse.RpcsByPeer: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = Grpc_Testing_LoadBalancerStatsResponse.protoMessageName + ".RpcsByPeer" +extension Connectrpc_Conformance_V1_LoadBalancerStatsResponse.RpcsByPeer: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Connectrpc_Conformance_V1_LoadBalancerStatsResponse.protoMessageName + ".RpcsByPeer" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "rpcs_by_peer"), ] @@ -1403,14 +1368,14 @@ extension Grpc_Testing_LoadBalancerStatsResponse.RpcsByPeer: SwiftProtobuf.Messa try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Grpc_Testing_LoadBalancerStatsResponse.RpcsByPeer, rhs: Grpc_Testing_LoadBalancerStatsResponse.RpcsByPeer) -> Bool { + static func ==(lhs: Connectrpc_Conformance_V1_LoadBalancerStatsResponse.RpcsByPeer, rhs: Connectrpc_Conformance_V1_LoadBalancerStatsResponse.RpcsByPeer) -> Bool { if lhs.rpcsByPeer != rhs.rpcsByPeer {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } } -extension Grpc_Testing_LoadBalancerAccumulatedStatsRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Connectrpc_Conformance_V1_LoadBalancerAccumulatedStatsRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".LoadBalancerAccumulatedStatsRequest" static let _protobuf_nameMap = SwiftProtobuf._NameMap() @@ -1423,13 +1388,13 @@ extension Grpc_Testing_LoadBalancerAccumulatedStatsRequest: SwiftProtobuf.Messag try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Grpc_Testing_LoadBalancerAccumulatedStatsRequest, rhs: Grpc_Testing_LoadBalancerAccumulatedStatsRequest) -> Bool { + static func ==(lhs: Connectrpc_Conformance_V1_LoadBalancerAccumulatedStatsRequest, rhs: Connectrpc_Conformance_V1_LoadBalancerAccumulatedStatsRequest) -> Bool { if lhs.unknownFields != rhs.unknownFields {return false} return true } } -extension Grpc_Testing_LoadBalancerAccumulatedStatsResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Connectrpc_Conformance_V1_LoadBalancerAccumulatedStatsResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".LoadBalancerAccumulatedStatsResponse" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "num_rpcs_started_by_method"), @@ -1447,7 +1412,7 @@ extension Grpc_Testing_LoadBalancerAccumulatedStatsResponse: SwiftProtobuf.Messa case 1: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: &self.numRpcsStartedByMethod) }() case 2: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: &self.numRpcsSucceededByMethod) }() case 3: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: &self.numRpcsFailedByMethod) }() - case 4: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: &self.statsPerMethod) }() + case 4: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: &self.statsPerMethod) }() default: break } } @@ -1464,12 +1429,12 @@ extension Grpc_Testing_LoadBalancerAccumulatedStatsResponse: SwiftProtobuf.Messa try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: self.numRpcsFailedByMethod, fieldNumber: 3) } if !self.statsPerMethod.isEmpty { - try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: self.statsPerMethod, fieldNumber: 4) + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: self.statsPerMethod, fieldNumber: 4) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Grpc_Testing_LoadBalancerAccumulatedStatsResponse, rhs: Grpc_Testing_LoadBalancerAccumulatedStatsResponse) -> Bool { + static func ==(lhs: Connectrpc_Conformance_V1_LoadBalancerAccumulatedStatsResponse, rhs: Connectrpc_Conformance_V1_LoadBalancerAccumulatedStatsResponse) -> Bool { if lhs.numRpcsStartedByMethod != rhs.numRpcsStartedByMethod {return false} if lhs.numRpcsSucceededByMethod != rhs.numRpcsSucceededByMethod {return false} if lhs.numRpcsFailedByMethod != rhs.numRpcsFailedByMethod {return false} @@ -1479,8 +1444,8 @@ extension Grpc_Testing_LoadBalancerAccumulatedStatsResponse: SwiftProtobuf.Messa } } -extension Grpc_Testing_LoadBalancerAccumulatedStatsResponse.MethodStats: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = Grpc_Testing_LoadBalancerAccumulatedStatsResponse.protoMessageName + ".MethodStats" +extension Connectrpc_Conformance_V1_LoadBalancerAccumulatedStatsResponse.MethodStats: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Connectrpc_Conformance_V1_LoadBalancerAccumulatedStatsResponse.protoMessageName + ".MethodStats" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "rpcs_started"), 2: .same(proto: "result"), @@ -1509,7 +1474,7 @@ extension Grpc_Testing_LoadBalancerAccumulatedStatsResponse.MethodStats: SwiftPr try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Grpc_Testing_LoadBalancerAccumulatedStatsResponse.MethodStats, rhs: Grpc_Testing_LoadBalancerAccumulatedStatsResponse.MethodStats) -> Bool { + static func ==(lhs: Connectrpc_Conformance_V1_LoadBalancerAccumulatedStatsResponse.MethodStats, rhs: Connectrpc_Conformance_V1_LoadBalancerAccumulatedStatsResponse.MethodStats) -> Bool { if lhs.rpcsStarted != rhs.rpcsStarted {return false} if lhs.result != rhs.result {return false} if lhs.unknownFields != rhs.unknownFields {return false} @@ -1517,7 +1482,7 @@ extension Grpc_Testing_LoadBalancerAccumulatedStatsResponse.MethodStats: SwiftPr } } -extension Grpc_Testing_ClientConfigureRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Connectrpc_Conformance_V1_ClientConfigureRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".ClientConfigureRequest" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "types"), @@ -1552,7 +1517,7 @@ extension Grpc_Testing_ClientConfigureRequest: SwiftProtobuf.Message, SwiftProto try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Grpc_Testing_ClientConfigureRequest, rhs: Grpc_Testing_ClientConfigureRequest) -> Bool { + static func ==(lhs: Connectrpc_Conformance_V1_ClientConfigureRequest, rhs: Connectrpc_Conformance_V1_ClientConfigureRequest) -> Bool { if lhs.types != rhs.types {return false} if lhs.metadata != rhs.metadata {return false} if lhs.timeoutSec != rhs.timeoutSec {return false} @@ -1561,15 +1526,15 @@ extension Grpc_Testing_ClientConfigureRequest: SwiftProtobuf.Message, SwiftProto } } -extension Grpc_Testing_ClientConfigureRequest.RpcType: SwiftProtobuf._ProtoNameProviding { +extension Connectrpc_Conformance_V1_ClientConfigureRequest.RpcType: SwiftProtobuf._ProtoNameProviding { static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "EMPTY_CALL"), 1: .same(proto: "UNARY_CALL"), ] } -extension Grpc_Testing_ClientConfigureRequest.Metadata: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = Grpc_Testing_ClientConfigureRequest.protoMessageName + ".Metadata" +extension Connectrpc_Conformance_V1_ClientConfigureRequest.Metadata: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Connectrpc_Conformance_V1_ClientConfigureRequest.protoMessageName + ".Metadata" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "type"), 2: .same(proto: "key"), @@ -1603,7 +1568,7 @@ extension Grpc_Testing_ClientConfigureRequest.Metadata: SwiftProtobuf.Message, S try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Grpc_Testing_ClientConfigureRequest.Metadata, rhs: Grpc_Testing_ClientConfigureRequest.Metadata) -> Bool { + static func ==(lhs: Connectrpc_Conformance_V1_ClientConfigureRequest.Metadata, rhs: Connectrpc_Conformance_V1_ClientConfigureRequest.Metadata) -> Bool { if lhs.type != rhs.type {return false} if lhs.key != rhs.key {return false} if lhs.value != rhs.value {return false} @@ -1612,7 +1577,7 @@ extension Grpc_Testing_ClientConfigureRequest.Metadata: SwiftProtobuf.Message, S } } -extension Grpc_Testing_ClientConfigureResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Connectrpc_Conformance_V1_ClientConfigureResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".ClientConfigureResponse" static let _protobuf_nameMap = SwiftProtobuf._NameMap() @@ -1625,13 +1590,13 @@ extension Grpc_Testing_ClientConfigureResponse: SwiftProtobuf.Message, SwiftProt try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Grpc_Testing_ClientConfigureResponse, rhs: Grpc_Testing_ClientConfigureResponse) -> Bool { + static func ==(lhs: Connectrpc_Conformance_V1_ClientConfigureResponse, rhs: Connectrpc_Conformance_V1_ClientConfigureResponse) -> Bool { if lhs.unknownFields != rhs.unknownFields {return false} return true } } -extension Grpc_Testing_ErrorDetail: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Connectrpc_Conformance_V1_ErrorDetail: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".ErrorDetail" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "reason"), @@ -1661,7 +1626,7 @@ extension Grpc_Testing_ErrorDetail: SwiftProtobuf.Message, SwiftProtobuf._Messag try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Grpc_Testing_ErrorDetail, rhs: Grpc_Testing_ErrorDetail) -> Bool { + static func ==(lhs: Connectrpc_Conformance_V1_ErrorDetail, rhs: Connectrpc_Conformance_V1_ErrorDetail) -> Bool { if lhs.reason != rhs.reason {return false} if lhs.domain != rhs.domain {return false} if lhs.unknownFields != rhs.unknownFields {return false} @@ -1669,7 +1634,7 @@ extension Grpc_Testing_ErrorDetail: SwiftProtobuf.Message, SwiftProtobuf._Messag } } -extension Grpc_Testing_ErrorStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Connectrpc_Conformance_V1_ErrorStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".ErrorStatus" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "code"), @@ -1704,7 +1669,7 @@ extension Grpc_Testing_ErrorStatus: SwiftProtobuf.Message, SwiftProtobuf._Messag try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Grpc_Testing_ErrorStatus, rhs: Grpc_Testing_ErrorStatus) -> Bool { + static func ==(lhs: Connectrpc_Conformance_V1_ErrorStatus, rhs: Connectrpc_Conformance_V1_ErrorStatus) -> Bool { if lhs.code != rhs.code {return false} if lhs.message != rhs.message {return false} if lhs.details != rhs.details {return false} diff --git a/Tests/ConnectLibraryTests/Generated/connectrpc/conformance/v1/test.connect.swift b/Tests/ConnectLibraryTests/Generated/connectrpc/conformance/v1/test.connect.swift new file mode 100644 index 00000000..ceca6dc6 --- /dev/null +++ b/Tests/ConnectLibraryTests/Generated/connectrpc/conformance/v1/test.connect.swift @@ -0,0 +1,502 @@ +// Code generated by protoc-gen-connect-swift. DO NOT EDIT. +// +// Source: connectrpc/conformance/v1/test.proto +// + +import Connect +import Foundation +import SwiftProtobuf + +/// A simple service to test the various types of RPCs and experiment with +/// performance with various types of payload. +internal protocol Connectrpc_Conformance_V1_TestServiceClientInterface { + + /// One empty request followed by one empty response. + @discardableResult + func `emptyCall`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers, completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable + + /// One empty request followed by one empty response. + @available(iOS 13, *) + func `emptyCall`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers) async -> ResponseMessage + + /// One request followed by one response. + @discardableResult + func `unaryCall`(request: Connectrpc_Conformance_V1_SimpleRequest, headers: Connect.Headers, completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable + + /// One request followed by one response. + @available(iOS 13, *) + func `unaryCall`(request: Connectrpc_Conformance_V1_SimpleRequest, headers: Connect.Headers) async -> ResponseMessage + + /// One request followed by one response. This RPC always fails. + @discardableResult + func `failUnaryCall`(request: Connectrpc_Conformance_V1_SimpleRequest, headers: Connect.Headers, completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable + + /// One request followed by one response. This RPC always fails. + @available(iOS 13, *) + func `failUnaryCall`(request: Connectrpc_Conformance_V1_SimpleRequest, headers: Connect.Headers) async -> ResponseMessage + + /// One request followed by one response. Response has cache control + /// headers set such that a caching HTTP proxy (such as GFE) can + /// satisfy subsequent requests. + @discardableResult + func `cacheableUnaryCall`(request: Connectrpc_Conformance_V1_SimpleRequest, headers: Connect.Headers, completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable + + /// One request followed by one response. Response has cache control + /// headers set such that a caching HTTP proxy (such as GFE) can + /// satisfy subsequent requests. + @available(iOS 13, *) + func `cacheableUnaryCall`(request: Connectrpc_Conformance_V1_SimpleRequest, headers: Connect.Headers) async -> ResponseMessage + + /// One request followed by a sequence of responses (streamed download). + /// The server returns the payload with client desired type and sizes. + func `streamingOutputCall`(headers: Connect.Headers, onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ServerOnlyStreamInterface + + /// One request followed by a sequence of responses (streamed download). + /// The server returns the payload with client desired type and sizes. + @available(iOS 13, *) + func `streamingOutputCall`(headers: Connect.Headers) -> any Connect.ServerOnlyAsyncStreamInterface + + /// One request followed by a sequence of responses (streamed download). + /// The server returns the payload with client desired type and sizes. + /// This RPC always responds with an error status. + func `failStreamingOutputCall`(headers: Connect.Headers, onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ServerOnlyStreamInterface + + /// One request followed by a sequence of responses (streamed download). + /// The server returns the payload with client desired type and sizes. + /// This RPC always responds with an error status. + @available(iOS 13, *) + func `failStreamingOutputCall`(headers: Connect.Headers) -> any Connect.ServerOnlyAsyncStreamInterface + + /// A sequence of requests followed by one response (streamed upload). + /// The server returns the aggregated size of client payload as the result. + func `streamingInputCall`(headers: Connect.Headers, onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ClientOnlyStreamInterface + + /// A sequence of requests followed by one response (streamed upload). + /// The server returns the aggregated size of client payload as the result. + @available(iOS 13, *) + func `streamingInputCall`(headers: Connect.Headers) -> any Connect.ClientOnlyAsyncStreamInterface + + /// A sequence of requests with each request served by the server immediately. + /// As one request could lead to multiple responses, this interface + /// demonstrates the idea of full duplexing. + func `fullDuplexCall`(headers: Connect.Headers, onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.BidirectionalStreamInterface + + /// A sequence of requests with each request served by the server immediately. + /// As one request could lead to multiple responses, this interface + /// demonstrates the idea of full duplexing. + @available(iOS 13, *) + func `fullDuplexCall`(headers: Connect.Headers) -> any Connect.BidirectionalAsyncStreamInterface + + /// A sequence of requests followed by a sequence of responses. + /// The server buffers all the client requests and then serves them in order. A + /// stream of responses are returned to the client when the server starts with + /// first request. + func `halfDuplexCall`(headers: Connect.Headers, onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.BidirectionalStreamInterface + + /// A sequence of requests followed by a sequence of responses. + /// The server buffers all the client requests and then serves them in order. A + /// stream of responses are returned to the client when the server starts with + /// first request. + @available(iOS 13, *) + func `halfDuplexCall`(headers: Connect.Headers) -> any Connect.BidirectionalAsyncStreamInterface + + /// The test server will not implement this method. It will be used + /// to test the behavior when clients call unimplemented methods. + @discardableResult + func `unimplementedCall`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers, completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable + + /// The test server will not implement this method. It will be used + /// to test the behavior when clients call unimplemented methods. + @available(iOS 13, *) + func `unimplementedCall`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers) async -> ResponseMessage + + /// The test server will not implement this method. It will be used + /// to test the behavior when clients call unimplemented streaming output methods. + func `unimplementedStreamingOutputCall`(headers: Connect.Headers, onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ServerOnlyStreamInterface + + /// The test server will not implement this method. It will be used + /// to test the behavior when clients call unimplemented streaming output methods. + @available(iOS 13, *) + func `unimplementedStreamingOutputCall`(headers: Connect.Headers) -> any Connect.ServerOnlyAsyncStreamInterface +} + +/// Concrete implementation of `Connectrpc_Conformance_V1_TestServiceClientInterface`. +internal final class Connectrpc_Conformance_V1_TestServiceClient: Connectrpc_Conformance_V1_TestServiceClientInterface { + private let client: Connect.ProtocolClientInterface + + internal init(client: Connect.ProtocolClientInterface) { + self.client = client + } + + @discardableResult + internal func `emptyCall`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { + return self.client.unary(path: "connectrpc.conformance.v1.TestService/EmptyCall", request: request, headers: headers, completion: completion) + } + + @available(iOS 13, *) + internal func `emptyCall`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers = [:]) async -> ResponseMessage { + return await self.client.unary(path: "connectrpc.conformance.v1.TestService/EmptyCall", request: request, headers: headers) + } + + @discardableResult + internal func `unaryCall`(request: Connectrpc_Conformance_V1_SimpleRequest, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { + return self.client.unary(path: "connectrpc.conformance.v1.TestService/UnaryCall", request: request, headers: headers, completion: completion) + } + + @available(iOS 13, *) + internal func `unaryCall`(request: Connectrpc_Conformance_V1_SimpleRequest, headers: Connect.Headers = [:]) async -> ResponseMessage { + return await self.client.unary(path: "connectrpc.conformance.v1.TestService/UnaryCall", request: request, headers: headers) + } + + @discardableResult + internal func `failUnaryCall`(request: Connectrpc_Conformance_V1_SimpleRequest, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { + return self.client.unary(path: "connectrpc.conformance.v1.TestService/FailUnaryCall", request: request, headers: headers, completion: completion) + } + + @available(iOS 13, *) + internal func `failUnaryCall`(request: Connectrpc_Conformance_V1_SimpleRequest, headers: Connect.Headers = [:]) async -> ResponseMessage { + return await self.client.unary(path: "connectrpc.conformance.v1.TestService/FailUnaryCall", request: request, headers: headers) + } + + @discardableResult + internal func `cacheableUnaryCall`(request: Connectrpc_Conformance_V1_SimpleRequest, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { + return self.client.unary(path: "connectrpc.conformance.v1.TestService/CacheableUnaryCall", request: request, headers: headers, completion: completion) + } + + @available(iOS 13, *) + internal func `cacheableUnaryCall`(request: Connectrpc_Conformance_V1_SimpleRequest, headers: Connect.Headers = [:]) async -> ResponseMessage { + return await self.client.unary(path: "connectrpc.conformance.v1.TestService/CacheableUnaryCall", request: request, headers: headers) + } + + internal func `streamingOutputCall`(headers: Connect.Headers = [:], onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ServerOnlyStreamInterface { + return self.client.serverOnlyStream(path: "connectrpc.conformance.v1.TestService/StreamingOutputCall", headers: headers, onResult: onResult) + } + + @available(iOS 13, *) + internal func `streamingOutputCall`(headers: Connect.Headers = [:]) -> any Connect.ServerOnlyAsyncStreamInterface { + return self.client.serverOnlyStream(path: "connectrpc.conformance.v1.TestService/StreamingOutputCall", headers: headers) + } + + internal func `failStreamingOutputCall`(headers: Connect.Headers = [:], onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ServerOnlyStreamInterface { + return self.client.serverOnlyStream(path: "connectrpc.conformance.v1.TestService/FailStreamingOutputCall", headers: headers, onResult: onResult) + } + + @available(iOS 13, *) + internal func `failStreamingOutputCall`(headers: Connect.Headers = [:]) -> any Connect.ServerOnlyAsyncStreamInterface { + return self.client.serverOnlyStream(path: "connectrpc.conformance.v1.TestService/FailStreamingOutputCall", headers: headers) + } + + internal func `streamingInputCall`(headers: Connect.Headers = [:], onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ClientOnlyStreamInterface { + return self.client.clientOnlyStream(path: "connectrpc.conformance.v1.TestService/StreamingInputCall", headers: headers, onResult: onResult) + } + + @available(iOS 13, *) + internal func `streamingInputCall`(headers: Connect.Headers = [:]) -> any Connect.ClientOnlyAsyncStreamInterface { + return self.client.clientOnlyStream(path: "connectrpc.conformance.v1.TestService/StreamingInputCall", headers: headers) + } + + internal func `fullDuplexCall`(headers: Connect.Headers = [:], onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.BidirectionalStreamInterface { + return self.client.bidirectionalStream(path: "connectrpc.conformance.v1.TestService/FullDuplexCall", headers: headers, onResult: onResult) + } + + @available(iOS 13, *) + internal func `fullDuplexCall`(headers: Connect.Headers = [:]) -> any Connect.BidirectionalAsyncStreamInterface { + return self.client.bidirectionalStream(path: "connectrpc.conformance.v1.TestService/FullDuplexCall", headers: headers) + } + + internal func `halfDuplexCall`(headers: Connect.Headers = [:], onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.BidirectionalStreamInterface { + return self.client.bidirectionalStream(path: "connectrpc.conformance.v1.TestService/HalfDuplexCall", headers: headers, onResult: onResult) + } + + @available(iOS 13, *) + internal func `halfDuplexCall`(headers: Connect.Headers = [:]) -> any Connect.BidirectionalAsyncStreamInterface { + return self.client.bidirectionalStream(path: "connectrpc.conformance.v1.TestService/HalfDuplexCall", headers: headers) + } + + @discardableResult + internal func `unimplementedCall`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { + return self.client.unary(path: "connectrpc.conformance.v1.TestService/UnimplementedCall", request: request, headers: headers, completion: completion) + } + + @available(iOS 13, *) + internal func `unimplementedCall`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers = [:]) async -> ResponseMessage { + return await self.client.unary(path: "connectrpc.conformance.v1.TestService/UnimplementedCall", request: request, headers: headers) + } + + internal func `unimplementedStreamingOutputCall`(headers: Connect.Headers = [:], onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ServerOnlyStreamInterface { + return self.client.serverOnlyStream(path: "connectrpc.conformance.v1.TestService/UnimplementedStreamingOutputCall", headers: headers, onResult: onResult) + } + + @available(iOS 13, *) + internal func `unimplementedStreamingOutputCall`(headers: Connect.Headers = [:]) -> any Connect.ServerOnlyAsyncStreamInterface { + return self.client.serverOnlyStream(path: "connectrpc.conformance.v1.TestService/UnimplementedStreamingOutputCall", headers: headers) + } + + internal enum Metadata { + internal enum Methods { + internal static let emptyCall = Connect.MethodSpec(name: "EmptyCall", service: "connectrpc.conformance.v1.TestService", type: .unary) + internal static let unaryCall = Connect.MethodSpec(name: "UnaryCall", service: "connectrpc.conformance.v1.TestService", type: .unary) + internal static let failUnaryCall = Connect.MethodSpec(name: "FailUnaryCall", service: "connectrpc.conformance.v1.TestService", type: .unary) + internal static let cacheableUnaryCall = Connect.MethodSpec(name: "CacheableUnaryCall", service: "connectrpc.conformance.v1.TestService", type: .unary) + internal static let streamingOutputCall = Connect.MethodSpec(name: "StreamingOutputCall", service: "connectrpc.conformance.v1.TestService", type: .serverStream) + internal static let failStreamingOutputCall = Connect.MethodSpec(name: "FailStreamingOutputCall", service: "connectrpc.conformance.v1.TestService", type: .serverStream) + internal static let streamingInputCall = Connect.MethodSpec(name: "StreamingInputCall", service: "connectrpc.conformance.v1.TestService", type: .clientStream) + internal static let fullDuplexCall = Connect.MethodSpec(name: "FullDuplexCall", service: "connectrpc.conformance.v1.TestService", type: .bidirectionalStream) + internal static let halfDuplexCall = Connect.MethodSpec(name: "HalfDuplexCall", service: "connectrpc.conformance.v1.TestService", type: .bidirectionalStream) + internal static let unimplementedCall = Connect.MethodSpec(name: "UnimplementedCall", service: "connectrpc.conformance.v1.TestService", type: .unary) + internal static let unimplementedStreamingOutputCall = Connect.MethodSpec(name: "UnimplementedStreamingOutputCall", service: "connectrpc.conformance.v1.TestService", type: .serverStream) + } + } +} + +/// A simple service NOT implemented at servers so clients can test for +/// that case. +internal protocol Connectrpc_Conformance_V1_UnimplementedServiceClientInterface { + + /// A call that no server should implement + @discardableResult + func `unimplementedCall`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers, completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable + + /// A call that no server should implement + @available(iOS 13, *) + func `unimplementedCall`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers) async -> ResponseMessage + + /// A call that no server should implement + func `unimplementedStreamingOutputCall`(headers: Connect.Headers, onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ServerOnlyStreamInterface + + /// A call that no server should implement + @available(iOS 13, *) + func `unimplementedStreamingOutputCall`(headers: Connect.Headers) -> any Connect.ServerOnlyAsyncStreamInterface +} + +/// Concrete implementation of `Connectrpc_Conformance_V1_UnimplementedServiceClientInterface`. +internal final class Connectrpc_Conformance_V1_UnimplementedServiceClient: Connectrpc_Conformance_V1_UnimplementedServiceClientInterface { + private let client: Connect.ProtocolClientInterface + + internal init(client: Connect.ProtocolClientInterface) { + self.client = client + } + + @discardableResult + internal func `unimplementedCall`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { + return self.client.unary(path: "connectrpc.conformance.v1.UnimplementedService/UnimplementedCall", request: request, headers: headers, completion: completion) + } + + @available(iOS 13, *) + internal func `unimplementedCall`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers = [:]) async -> ResponseMessage { + return await self.client.unary(path: "connectrpc.conformance.v1.UnimplementedService/UnimplementedCall", request: request, headers: headers) + } + + internal func `unimplementedStreamingOutputCall`(headers: Connect.Headers = [:], onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ServerOnlyStreamInterface { + return self.client.serverOnlyStream(path: "connectrpc.conformance.v1.UnimplementedService/UnimplementedStreamingOutputCall", headers: headers, onResult: onResult) + } + + @available(iOS 13, *) + internal func `unimplementedStreamingOutputCall`(headers: Connect.Headers = [:]) -> any Connect.ServerOnlyAsyncStreamInterface { + return self.client.serverOnlyStream(path: "connectrpc.conformance.v1.UnimplementedService/UnimplementedStreamingOutputCall", headers: headers) + } + + internal enum Metadata { + internal enum Methods { + internal static let unimplementedCall = Connect.MethodSpec(name: "UnimplementedCall", service: "connectrpc.conformance.v1.UnimplementedService", type: .unary) + internal static let unimplementedStreamingOutputCall = Connect.MethodSpec(name: "UnimplementedStreamingOutputCall", service: "connectrpc.conformance.v1.UnimplementedService", type: .serverStream) + } + } +} + +/// A service used to control reconnect server. +internal protocol Connectrpc_Conformance_V1_ReconnectServiceClientInterface { + + @discardableResult + func `start`(request: Connectrpc_Conformance_V1_ReconnectParams, headers: Connect.Headers, completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable + + @available(iOS 13, *) + func `start`(request: Connectrpc_Conformance_V1_ReconnectParams, headers: Connect.Headers) async -> ResponseMessage + + @discardableResult + func `stop`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers, completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable + + @available(iOS 13, *) + func `stop`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers) async -> ResponseMessage +} + +/// Concrete implementation of `Connectrpc_Conformance_V1_ReconnectServiceClientInterface`. +internal final class Connectrpc_Conformance_V1_ReconnectServiceClient: Connectrpc_Conformance_V1_ReconnectServiceClientInterface { + private let client: Connect.ProtocolClientInterface + + internal init(client: Connect.ProtocolClientInterface) { + self.client = client + } + + @discardableResult + internal func `start`(request: Connectrpc_Conformance_V1_ReconnectParams, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { + return self.client.unary(path: "connectrpc.conformance.v1.ReconnectService/Start", request: request, headers: headers, completion: completion) + } + + @available(iOS 13, *) + internal func `start`(request: Connectrpc_Conformance_V1_ReconnectParams, headers: Connect.Headers = [:]) async -> ResponseMessage { + return await self.client.unary(path: "connectrpc.conformance.v1.ReconnectService/Start", request: request, headers: headers) + } + + @discardableResult + internal func `stop`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { + return self.client.unary(path: "connectrpc.conformance.v1.ReconnectService/Stop", request: request, headers: headers, completion: completion) + } + + @available(iOS 13, *) + internal func `stop`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers = [:]) async -> ResponseMessage { + return await self.client.unary(path: "connectrpc.conformance.v1.ReconnectService/Stop", request: request, headers: headers) + } + + internal enum Metadata { + internal enum Methods { + internal static let start = Connect.MethodSpec(name: "Start", service: "connectrpc.conformance.v1.ReconnectService", type: .unary) + internal static let stop = Connect.MethodSpec(name: "Stop", service: "connectrpc.conformance.v1.ReconnectService", type: .unary) + } + } +} + +/// A service used to obtain stats for verifying LB behavior. +internal protocol Connectrpc_Conformance_V1_LoadBalancerStatsServiceClientInterface { + + /// Gets the backend distribution for RPCs sent by a test client. + @discardableResult + func `getClientStats`(request: Connectrpc_Conformance_V1_LoadBalancerStatsRequest, headers: Connect.Headers, completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable + + /// Gets the backend distribution for RPCs sent by a test client. + @available(iOS 13, *) + func `getClientStats`(request: Connectrpc_Conformance_V1_LoadBalancerStatsRequest, headers: Connect.Headers) async -> ResponseMessage + + /// Gets the accumulated stats for RPCs sent by a test client. + @discardableResult + func `getClientAccumulatedStats`(request: Connectrpc_Conformance_V1_LoadBalancerAccumulatedStatsRequest, headers: Connect.Headers, completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable + + /// Gets the accumulated stats for RPCs sent by a test client. + @available(iOS 13, *) + func `getClientAccumulatedStats`(request: Connectrpc_Conformance_V1_LoadBalancerAccumulatedStatsRequest, headers: Connect.Headers) async -> ResponseMessage +} + +/// Concrete implementation of `Connectrpc_Conformance_V1_LoadBalancerStatsServiceClientInterface`. +internal final class Connectrpc_Conformance_V1_LoadBalancerStatsServiceClient: Connectrpc_Conformance_V1_LoadBalancerStatsServiceClientInterface { + private let client: Connect.ProtocolClientInterface + + internal init(client: Connect.ProtocolClientInterface) { + self.client = client + } + + @discardableResult + internal func `getClientStats`(request: Connectrpc_Conformance_V1_LoadBalancerStatsRequest, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { + return self.client.unary(path: "connectrpc.conformance.v1.LoadBalancerStatsService/GetClientStats", request: request, headers: headers, completion: completion) + } + + @available(iOS 13, *) + internal func `getClientStats`(request: Connectrpc_Conformance_V1_LoadBalancerStatsRequest, headers: Connect.Headers = [:]) async -> ResponseMessage { + return await self.client.unary(path: "connectrpc.conformance.v1.LoadBalancerStatsService/GetClientStats", request: request, headers: headers) + } + + @discardableResult + internal func `getClientAccumulatedStats`(request: Connectrpc_Conformance_V1_LoadBalancerAccumulatedStatsRequest, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { + return self.client.unary(path: "connectrpc.conformance.v1.LoadBalancerStatsService/GetClientAccumulatedStats", request: request, headers: headers, completion: completion) + } + + @available(iOS 13, *) + internal func `getClientAccumulatedStats`(request: Connectrpc_Conformance_V1_LoadBalancerAccumulatedStatsRequest, headers: Connect.Headers = [:]) async -> ResponseMessage { + return await self.client.unary(path: "connectrpc.conformance.v1.LoadBalancerStatsService/GetClientAccumulatedStats", request: request, headers: headers) + } + + internal enum Metadata { + internal enum Methods { + internal static let getClientStats = Connect.MethodSpec(name: "GetClientStats", service: "connectrpc.conformance.v1.LoadBalancerStatsService", type: .unary) + internal static let getClientAccumulatedStats = Connect.MethodSpec(name: "GetClientAccumulatedStats", service: "connectrpc.conformance.v1.LoadBalancerStatsService", type: .unary) + } + } +} + +/// A service to remotely control health status of an xDS test server. +internal protocol Connectrpc_Conformance_V1_XdsUpdateHealthServiceClientInterface { + + @discardableResult + func `setServing`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers, completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable + + @available(iOS 13, *) + func `setServing`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers) async -> ResponseMessage + + @discardableResult + func `setNotServing`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers, completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable + + @available(iOS 13, *) + func `setNotServing`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers) async -> ResponseMessage +} + +/// Concrete implementation of `Connectrpc_Conformance_V1_XdsUpdateHealthServiceClientInterface`. +internal final class Connectrpc_Conformance_V1_XdsUpdateHealthServiceClient: Connectrpc_Conformance_V1_XdsUpdateHealthServiceClientInterface { + private let client: Connect.ProtocolClientInterface + + internal init(client: Connect.ProtocolClientInterface) { + self.client = client + } + + @discardableResult + internal func `setServing`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { + return self.client.unary(path: "connectrpc.conformance.v1.XdsUpdateHealthService/SetServing", request: request, headers: headers, completion: completion) + } + + @available(iOS 13, *) + internal func `setServing`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers = [:]) async -> ResponseMessage { + return await self.client.unary(path: "connectrpc.conformance.v1.XdsUpdateHealthService/SetServing", request: request, headers: headers) + } + + @discardableResult + internal func `setNotServing`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { + return self.client.unary(path: "connectrpc.conformance.v1.XdsUpdateHealthService/SetNotServing", request: request, headers: headers, completion: completion) + } + + @available(iOS 13, *) + internal func `setNotServing`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers = [:]) async -> ResponseMessage { + return await self.client.unary(path: "connectrpc.conformance.v1.XdsUpdateHealthService/SetNotServing", request: request, headers: headers) + } + + internal enum Metadata { + internal enum Methods { + internal static let setServing = Connect.MethodSpec(name: "SetServing", service: "connectrpc.conformance.v1.XdsUpdateHealthService", type: .unary) + internal static let setNotServing = Connect.MethodSpec(name: "SetNotServing", service: "connectrpc.conformance.v1.XdsUpdateHealthService", type: .unary) + } + } +} + +/// A service to dynamically update the configuration of an xDS test client. +internal protocol Connectrpc_Conformance_V1_XdsUpdateClientConfigureServiceClientInterface { + + /// Update the tes client's configuration. + @discardableResult + func `configure`(request: Connectrpc_Conformance_V1_ClientConfigureRequest, headers: Connect.Headers, completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable + + /// Update the tes client's configuration. + @available(iOS 13, *) + func `configure`(request: Connectrpc_Conformance_V1_ClientConfigureRequest, headers: Connect.Headers) async -> ResponseMessage +} + +/// Concrete implementation of `Connectrpc_Conformance_V1_XdsUpdateClientConfigureServiceClientInterface`. +internal final class Connectrpc_Conformance_V1_XdsUpdateClientConfigureServiceClient: Connectrpc_Conformance_V1_XdsUpdateClientConfigureServiceClientInterface { + private let client: Connect.ProtocolClientInterface + + internal init(client: Connect.ProtocolClientInterface) { + self.client = client + } + + @discardableResult + internal func `configure`(request: Connectrpc_Conformance_V1_ClientConfigureRequest, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { + return self.client.unary(path: "connectrpc.conformance.v1.XdsUpdateClientConfigureService/Configure", request: request, headers: headers, completion: completion) + } + + @available(iOS 13, *) + internal func `configure`(request: Connectrpc_Conformance_V1_ClientConfigureRequest, headers: Connect.Headers = [:]) async -> ResponseMessage { + return await self.client.unary(path: "connectrpc.conformance.v1.XdsUpdateClientConfigureService/Configure", request: request, headers: headers) + } + + internal enum Metadata { + internal enum Methods { + internal static let configure = Connect.MethodSpec(name: "Configure", service: "connectrpc.conformance.v1.XdsUpdateClientConfigureService", type: .unary) + } + } +} diff --git a/Tests/ConnectLibraryTests/Generated/connectrpc/conformance/v1/test.mock.swift b/Tests/ConnectLibraryTests/Generated/connectrpc/conformance/v1/test.mock.swift new file mode 100644 index 00000000..bf22c7dd --- /dev/null +++ b/Tests/ConnectLibraryTests/Generated/connectrpc/conformance/v1/test.mock.swift @@ -0,0 +1,367 @@ +// Code generated by protoc-gen-connect-swift. DO NOT EDIT. +// +// Source: connectrpc/conformance/v1/test.proto +// + +import Combine +import Connect +import ConnectMocks +import Foundation +import SwiftProtobuf + +/// Mock implementation of `Connectrpc_Conformance_V1_TestServiceClientInterface`. +/// +/// Production implementations can be substituted with instances of this +/// class, allowing for mocking RPC calls. Behavior can be customized +/// either through the properties on this class or by +/// subclassing the class and overriding its methods. +@available(iOS 13, *) +internal class Connectrpc_Conformance_V1_TestServiceClientMock: Connectrpc_Conformance_V1_TestServiceClientInterface { + private var cancellables = [Combine.AnyCancellable]() + + /// Mocked for calls to `emptyCall()`. + internal var mockEmptyCall = { (_: SwiftProtobuf.Google_Protobuf_Empty) -> ResponseMessage in .init(result: .success(.init())) } + /// Mocked for async calls to `emptyCall()`. + internal var mockAsyncEmptyCall = { (_: SwiftProtobuf.Google_Protobuf_Empty) -> ResponseMessage in .init(result: .success(.init())) } + /// Mocked for calls to `unaryCall()`. + internal var mockUnaryCall = { (_: Connectrpc_Conformance_V1_SimpleRequest) -> ResponseMessage in .init(result: .success(.init())) } + /// Mocked for async calls to `unaryCall()`. + internal var mockAsyncUnaryCall = { (_: Connectrpc_Conformance_V1_SimpleRequest) -> ResponseMessage in .init(result: .success(.init())) } + /// Mocked for calls to `failUnaryCall()`. + internal var mockFailUnaryCall = { (_: Connectrpc_Conformance_V1_SimpleRequest) -> ResponseMessage in .init(result: .success(.init())) } + /// Mocked for async calls to `failUnaryCall()`. + internal var mockAsyncFailUnaryCall = { (_: Connectrpc_Conformance_V1_SimpleRequest) -> ResponseMessage in .init(result: .success(.init())) } + /// Mocked for calls to `cacheableUnaryCall()`. + internal var mockCacheableUnaryCall = { (_: Connectrpc_Conformance_V1_SimpleRequest) -> ResponseMessage in .init(result: .success(.init())) } + /// Mocked for async calls to `cacheableUnaryCall()`. + internal var mockAsyncCacheableUnaryCall = { (_: Connectrpc_Conformance_V1_SimpleRequest) -> ResponseMessage in .init(result: .success(.init())) } + /// Mocked for calls to `streamingOutputCall()`. + internal var mockStreamingOutputCall = MockServerOnlyStream() + /// Mocked for async calls to `streamingOutputCall()`. + internal var mockAsyncStreamingOutputCall = MockServerOnlyAsyncStream() + /// Mocked for calls to `failStreamingOutputCall()`. + internal var mockFailStreamingOutputCall = MockServerOnlyStream() + /// Mocked for async calls to `failStreamingOutputCall()`. + internal var mockAsyncFailStreamingOutputCall = MockServerOnlyAsyncStream() + /// Mocked for calls to `streamingInputCall()`. + internal var mockStreamingInputCall = MockClientOnlyStream() + /// Mocked for async calls to `streamingInputCall()`. + internal var mockAsyncStreamingInputCall = MockClientOnlyAsyncStream() + /// Mocked for calls to `fullDuplexCall()`. + internal var mockFullDuplexCall = MockBidirectionalStream() + /// Mocked for async calls to `fullDuplexCall()`. + internal var mockAsyncFullDuplexCall = MockBidirectionalAsyncStream() + /// Mocked for calls to `halfDuplexCall()`. + internal var mockHalfDuplexCall = MockBidirectionalStream() + /// Mocked for async calls to `halfDuplexCall()`. + internal var mockAsyncHalfDuplexCall = MockBidirectionalAsyncStream() + /// Mocked for calls to `unimplementedCall()`. + internal var mockUnimplementedCall = { (_: SwiftProtobuf.Google_Protobuf_Empty) -> ResponseMessage in .init(result: .success(.init())) } + /// Mocked for async calls to `unimplementedCall()`. + internal var mockAsyncUnimplementedCall = { (_: SwiftProtobuf.Google_Protobuf_Empty) -> ResponseMessage in .init(result: .success(.init())) } + /// Mocked for calls to `unimplementedStreamingOutputCall()`. + internal var mockUnimplementedStreamingOutputCall = MockServerOnlyStream() + /// Mocked for async calls to `unimplementedStreamingOutputCall()`. + internal var mockAsyncUnimplementedStreamingOutputCall = MockServerOnlyAsyncStream() + + internal init() {} + + @discardableResult + internal func `emptyCall`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { + completion(self.mockEmptyCall(request)) + return Connect.Cancelable {} + } + + internal func `emptyCall`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers = [:]) async -> ResponseMessage { + return self.mockAsyncEmptyCall(request) + } + + @discardableResult + internal func `unaryCall`(request: Connectrpc_Conformance_V1_SimpleRequest, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { + completion(self.mockUnaryCall(request)) + return Connect.Cancelable {} + } + + internal func `unaryCall`(request: Connectrpc_Conformance_V1_SimpleRequest, headers: Connect.Headers = [:]) async -> ResponseMessage { + return self.mockAsyncUnaryCall(request) + } + + @discardableResult + internal func `failUnaryCall`(request: Connectrpc_Conformance_V1_SimpleRequest, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { + completion(self.mockFailUnaryCall(request)) + return Connect.Cancelable {} + } + + internal func `failUnaryCall`(request: Connectrpc_Conformance_V1_SimpleRequest, headers: Connect.Headers = [:]) async -> ResponseMessage { + return self.mockAsyncFailUnaryCall(request) + } + + @discardableResult + internal func `cacheableUnaryCall`(request: Connectrpc_Conformance_V1_SimpleRequest, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { + completion(self.mockCacheableUnaryCall(request)) + return Connect.Cancelable {} + } + + internal func `cacheableUnaryCall`(request: Connectrpc_Conformance_V1_SimpleRequest, headers: Connect.Headers = [:]) async -> ResponseMessage { + return self.mockAsyncCacheableUnaryCall(request) + } + + internal func `streamingOutputCall`(headers: Connect.Headers = [:], onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ServerOnlyStreamInterface { + self.mockStreamingOutputCall.$inputs.first { !$0.isEmpty }.sink { _ in self.mockStreamingOutputCall.outputs.forEach(onResult) }.store(in: &self.cancellables) + return self.mockStreamingOutputCall + } + + internal func `streamingOutputCall`(headers: Connect.Headers = [:]) -> any Connect.ServerOnlyAsyncStreamInterface { + return self.mockAsyncStreamingOutputCall + } + + internal func `failStreamingOutputCall`(headers: Connect.Headers = [:], onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ServerOnlyStreamInterface { + self.mockFailStreamingOutputCall.$inputs.first { !$0.isEmpty }.sink { _ in self.mockFailStreamingOutputCall.outputs.forEach(onResult) }.store(in: &self.cancellables) + return self.mockFailStreamingOutputCall + } + + internal func `failStreamingOutputCall`(headers: Connect.Headers = [:]) -> any Connect.ServerOnlyAsyncStreamInterface { + return self.mockAsyncFailStreamingOutputCall + } + + internal func `streamingInputCall`(headers: Connect.Headers = [:], onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ClientOnlyStreamInterface { + self.mockStreamingInputCall.$inputs.first { !$0.isEmpty }.sink { _ in self.mockStreamingInputCall.outputs.forEach(onResult) }.store(in: &self.cancellables) + return self.mockStreamingInputCall + } + + internal func `streamingInputCall`(headers: Connect.Headers = [:]) -> any Connect.ClientOnlyAsyncStreamInterface { + return self.mockAsyncStreamingInputCall + } + + internal func `fullDuplexCall`(headers: Connect.Headers = [:], onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.BidirectionalStreamInterface { + self.mockFullDuplexCall.$inputs.first { !$0.isEmpty }.sink { _ in self.mockFullDuplexCall.outputs.forEach(onResult) }.store(in: &self.cancellables) + return self.mockFullDuplexCall + } + + internal func `fullDuplexCall`(headers: Connect.Headers = [:]) -> any Connect.BidirectionalAsyncStreamInterface { + return self.mockAsyncFullDuplexCall + } + + internal func `halfDuplexCall`(headers: Connect.Headers = [:], onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.BidirectionalStreamInterface { + self.mockHalfDuplexCall.$inputs.first { !$0.isEmpty }.sink { _ in self.mockHalfDuplexCall.outputs.forEach(onResult) }.store(in: &self.cancellables) + return self.mockHalfDuplexCall + } + + internal func `halfDuplexCall`(headers: Connect.Headers = [:]) -> any Connect.BidirectionalAsyncStreamInterface { + return self.mockAsyncHalfDuplexCall + } + + @discardableResult + internal func `unimplementedCall`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { + completion(self.mockUnimplementedCall(request)) + return Connect.Cancelable {} + } + + internal func `unimplementedCall`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers = [:]) async -> ResponseMessage { + return self.mockAsyncUnimplementedCall(request) + } + + internal func `unimplementedStreamingOutputCall`(headers: Connect.Headers = [:], onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ServerOnlyStreamInterface { + self.mockUnimplementedStreamingOutputCall.$inputs.first { !$0.isEmpty }.sink { _ in self.mockUnimplementedStreamingOutputCall.outputs.forEach(onResult) }.store(in: &self.cancellables) + return self.mockUnimplementedStreamingOutputCall + } + + internal func `unimplementedStreamingOutputCall`(headers: Connect.Headers = [:]) -> any Connect.ServerOnlyAsyncStreamInterface { + return self.mockAsyncUnimplementedStreamingOutputCall + } +} + +/// Mock implementation of `Connectrpc_Conformance_V1_UnimplementedServiceClientInterface`. +/// +/// Production implementations can be substituted with instances of this +/// class, allowing for mocking RPC calls. Behavior can be customized +/// either through the properties on this class or by +/// subclassing the class and overriding its methods. +@available(iOS 13, *) +internal class Connectrpc_Conformance_V1_UnimplementedServiceClientMock: Connectrpc_Conformance_V1_UnimplementedServiceClientInterface { + private var cancellables = [Combine.AnyCancellable]() + + /// Mocked for calls to `unimplementedCall()`. + internal var mockUnimplementedCall = { (_: SwiftProtobuf.Google_Protobuf_Empty) -> ResponseMessage in .init(result: .success(.init())) } + /// Mocked for async calls to `unimplementedCall()`. + internal var mockAsyncUnimplementedCall = { (_: SwiftProtobuf.Google_Protobuf_Empty) -> ResponseMessage in .init(result: .success(.init())) } + /// Mocked for calls to `unimplementedStreamingOutputCall()`. + internal var mockUnimplementedStreamingOutputCall = MockServerOnlyStream() + /// Mocked for async calls to `unimplementedStreamingOutputCall()`. + internal var mockAsyncUnimplementedStreamingOutputCall = MockServerOnlyAsyncStream() + + internal init() {} + + @discardableResult + internal func `unimplementedCall`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { + completion(self.mockUnimplementedCall(request)) + return Connect.Cancelable {} + } + + internal func `unimplementedCall`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers = [:]) async -> ResponseMessage { + return self.mockAsyncUnimplementedCall(request) + } + + internal func `unimplementedStreamingOutputCall`(headers: Connect.Headers = [:], onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ServerOnlyStreamInterface { + self.mockUnimplementedStreamingOutputCall.$inputs.first { !$0.isEmpty }.sink { _ in self.mockUnimplementedStreamingOutputCall.outputs.forEach(onResult) }.store(in: &self.cancellables) + return self.mockUnimplementedStreamingOutputCall + } + + internal func `unimplementedStreamingOutputCall`(headers: Connect.Headers = [:]) -> any Connect.ServerOnlyAsyncStreamInterface { + return self.mockAsyncUnimplementedStreamingOutputCall + } +} + +/// Mock implementation of `Connectrpc_Conformance_V1_ReconnectServiceClientInterface`. +/// +/// Production implementations can be substituted with instances of this +/// class, allowing for mocking RPC calls. Behavior can be customized +/// either through the properties on this class or by +/// subclassing the class and overriding its methods. +@available(iOS 13, *) +internal class Connectrpc_Conformance_V1_ReconnectServiceClientMock: Connectrpc_Conformance_V1_ReconnectServiceClientInterface { + private var cancellables = [Combine.AnyCancellable]() + + /// Mocked for calls to `start()`. + internal var mockStart = { (_: Connectrpc_Conformance_V1_ReconnectParams) -> ResponseMessage in .init(result: .success(.init())) } + /// Mocked for async calls to `start()`. + internal var mockAsyncStart = { (_: Connectrpc_Conformance_V1_ReconnectParams) -> ResponseMessage in .init(result: .success(.init())) } + /// Mocked for calls to `stop()`. + internal var mockStop = { (_: SwiftProtobuf.Google_Protobuf_Empty) -> ResponseMessage in .init(result: .success(.init())) } + /// Mocked for async calls to `stop()`. + internal var mockAsyncStop = { (_: SwiftProtobuf.Google_Protobuf_Empty) -> ResponseMessage in .init(result: .success(.init())) } + + internal init() {} + + @discardableResult + internal func `start`(request: Connectrpc_Conformance_V1_ReconnectParams, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { + completion(self.mockStart(request)) + return Connect.Cancelable {} + } + + internal func `start`(request: Connectrpc_Conformance_V1_ReconnectParams, headers: Connect.Headers = [:]) async -> ResponseMessage { + return self.mockAsyncStart(request) + } + + @discardableResult + internal func `stop`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { + completion(self.mockStop(request)) + return Connect.Cancelable {} + } + + internal func `stop`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers = [:]) async -> ResponseMessage { + return self.mockAsyncStop(request) + } +} + +/// Mock implementation of `Connectrpc_Conformance_V1_LoadBalancerStatsServiceClientInterface`. +/// +/// Production implementations can be substituted with instances of this +/// class, allowing for mocking RPC calls. Behavior can be customized +/// either through the properties on this class or by +/// subclassing the class and overriding its methods. +@available(iOS 13, *) +internal class Connectrpc_Conformance_V1_LoadBalancerStatsServiceClientMock: Connectrpc_Conformance_V1_LoadBalancerStatsServiceClientInterface { + private var cancellables = [Combine.AnyCancellable]() + + /// Mocked for calls to `getClientStats()`. + internal var mockGetClientStats = { (_: Connectrpc_Conformance_V1_LoadBalancerStatsRequest) -> ResponseMessage in .init(result: .success(.init())) } + /// Mocked for async calls to `getClientStats()`. + internal var mockAsyncGetClientStats = { (_: Connectrpc_Conformance_V1_LoadBalancerStatsRequest) -> ResponseMessage in .init(result: .success(.init())) } + /// Mocked for calls to `getClientAccumulatedStats()`. + internal var mockGetClientAccumulatedStats = { (_: Connectrpc_Conformance_V1_LoadBalancerAccumulatedStatsRequest) -> ResponseMessage in .init(result: .success(.init())) } + /// Mocked for async calls to `getClientAccumulatedStats()`. + internal var mockAsyncGetClientAccumulatedStats = { (_: Connectrpc_Conformance_V1_LoadBalancerAccumulatedStatsRequest) -> ResponseMessage in .init(result: .success(.init())) } + + internal init() {} + + @discardableResult + internal func `getClientStats`(request: Connectrpc_Conformance_V1_LoadBalancerStatsRequest, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { + completion(self.mockGetClientStats(request)) + return Connect.Cancelable {} + } + + internal func `getClientStats`(request: Connectrpc_Conformance_V1_LoadBalancerStatsRequest, headers: Connect.Headers = [:]) async -> ResponseMessage { + return self.mockAsyncGetClientStats(request) + } + + @discardableResult + internal func `getClientAccumulatedStats`(request: Connectrpc_Conformance_V1_LoadBalancerAccumulatedStatsRequest, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { + completion(self.mockGetClientAccumulatedStats(request)) + return Connect.Cancelable {} + } + + internal func `getClientAccumulatedStats`(request: Connectrpc_Conformance_V1_LoadBalancerAccumulatedStatsRequest, headers: Connect.Headers = [:]) async -> ResponseMessage { + return self.mockAsyncGetClientAccumulatedStats(request) + } +} + +/// Mock implementation of `Connectrpc_Conformance_V1_XdsUpdateHealthServiceClientInterface`. +/// +/// Production implementations can be substituted with instances of this +/// class, allowing for mocking RPC calls. Behavior can be customized +/// either through the properties on this class or by +/// subclassing the class and overriding its methods. +@available(iOS 13, *) +internal class Connectrpc_Conformance_V1_XdsUpdateHealthServiceClientMock: Connectrpc_Conformance_V1_XdsUpdateHealthServiceClientInterface { + private var cancellables = [Combine.AnyCancellable]() + + /// Mocked for calls to `setServing()`. + internal var mockSetServing = { (_: SwiftProtobuf.Google_Protobuf_Empty) -> ResponseMessage in .init(result: .success(.init())) } + /// Mocked for async calls to `setServing()`. + internal var mockAsyncSetServing = { (_: SwiftProtobuf.Google_Protobuf_Empty) -> ResponseMessage in .init(result: .success(.init())) } + /// Mocked for calls to `setNotServing()`. + internal var mockSetNotServing = { (_: SwiftProtobuf.Google_Protobuf_Empty) -> ResponseMessage in .init(result: .success(.init())) } + /// Mocked for async calls to `setNotServing()`. + internal var mockAsyncSetNotServing = { (_: SwiftProtobuf.Google_Protobuf_Empty) -> ResponseMessage in .init(result: .success(.init())) } + + internal init() {} + + @discardableResult + internal func `setServing`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { + completion(self.mockSetServing(request)) + return Connect.Cancelable {} + } + + internal func `setServing`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers = [:]) async -> ResponseMessage { + return self.mockAsyncSetServing(request) + } + + @discardableResult + internal func `setNotServing`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { + completion(self.mockSetNotServing(request)) + return Connect.Cancelable {} + } + + internal func `setNotServing`(request: SwiftProtobuf.Google_Protobuf_Empty, headers: Connect.Headers = [:]) async -> ResponseMessage { + return self.mockAsyncSetNotServing(request) + } +} + +/// Mock implementation of `Connectrpc_Conformance_V1_XdsUpdateClientConfigureServiceClientInterface`. +/// +/// Production implementations can be substituted with instances of this +/// class, allowing for mocking RPC calls. Behavior can be customized +/// either through the properties on this class or by +/// subclassing the class and overriding its methods. +@available(iOS 13, *) +internal class Connectrpc_Conformance_V1_XdsUpdateClientConfigureServiceClientMock: Connectrpc_Conformance_V1_XdsUpdateClientConfigureServiceClientInterface { + private var cancellables = [Combine.AnyCancellable]() + + /// Mocked for calls to `configure()`. + internal var mockConfigure = { (_: Connectrpc_Conformance_V1_ClientConfigureRequest) -> ResponseMessage in .init(result: .success(.init())) } + /// Mocked for async calls to `configure()`. + internal var mockAsyncConfigure = { (_: Connectrpc_Conformance_V1_ClientConfigureRequest) -> ResponseMessage in .init(result: .success(.init())) } + + internal init() {} + + @discardableResult + internal func `configure`(request: Connectrpc_Conformance_V1_ClientConfigureRequest, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { + completion(self.mockConfigure(request)) + return Connect.Cancelable {} + } + + internal func `configure`(request: Connectrpc_Conformance_V1_ClientConfigureRequest, headers: Connect.Headers = [:]) async -> ResponseMessage { + return self.mockAsyncConfigure(request) + } +} diff --git a/Tests/ConnectLibraryTests/Generated/grpc/testing/test.pb.swift b/Tests/ConnectLibraryTests/Generated/connectrpc/conformance/v1/test.pb.swift similarity index 72% rename from Tests/ConnectLibraryTests/Generated/grpc/testing/test.pb.swift rename to Tests/ConnectLibraryTests/Generated/connectrpc/conformance/v1/test.pb.swift index f527e08e..12171131 100644 --- a/Tests/ConnectLibraryTests/Generated/grpc/testing/test.pb.swift +++ b/Tests/ConnectLibraryTests/Generated/connectrpc/conformance/v1/test.pb.swift @@ -2,11 +2,25 @@ // swift-format-ignore-file // // Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: grpc/testing/test.proto +// Source: connectrpc/conformance/v1/test.proto // // For information on using the generated types, please see the documentation: // https://github.com/apple/swift-protobuf/ +// Copyright 2022 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // This is copied from gRPC's testing Protobuf definitions: https://github.com/grpc/grpc/blob/master/src/proto/grpc/testing/test.proto // // The TestService has been extended to include the following RPCs: @@ -14,11 +28,11 @@ // call that always returns a readable non-ASCII error with error details. // FailStreamingOutputCall(StreamingOutputCallRequest) returns (stream StreamingOutputCallResponse): // this RPC is a server streaming call that always returns a readable non-ASCII error with error details. -// UnimplementedStreamingOutputCall(grpc.testing.Empty) returns (stream grpc.testing.Empty): this RPC +// UnimplementedStreamingOutputCall(google.protobuf.Empty) returns (stream google.protobuf.Empty): this RPC // is a server streaming call that will not be implemented. // // The UnimplementedService has been extended to include the following RPCs: -// UnimplementedStreamingOutputCall(grpc.testing.Empty) returns (stream grpc.testing.Empty): this RPC +// UnimplementedStreamingOutputCall(google.protobuf.Empty) returns (stream google.protobuf.Empty): this RPC // is a server streaming call that will not be implemented. // Copyright 2015-2016 gRPC authors. diff --git a/Tests/ConnectLibraryTests/Generated/grpc/testing/empty.pb.swift b/Tests/ConnectLibraryTests/Generated/grpc/testing/empty.pb.swift deleted file mode 100644 index 9244c547..00000000 --- a/Tests/ConnectLibraryTests/Generated/grpc/testing/empty.pb.swift +++ /dev/null @@ -1,81 +0,0 @@ -// DO NOT EDIT. -// swift-format-ignore-file -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: grpc/testing/empty.proto -// -// For information on using the generated types, please see the documentation: -// https://github.com/apple/swift-protobuf/ - -// This is copied from gRPC's testing Protobuf definitions: https://github.com/grpc/grpc/blob/master/src/proto/grpc/testing/empty.proto - -// Copyright 2015 gRPC authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import Foundation -import SwiftProtobuf - -// If the compiler emits an error on this type, it is because this file -// was generated by a version of the `protoc` Swift plug-in that is -// incompatible with the version of SwiftProtobuf to which you are linking. -// Please ensure that you are building against the same version of the API -// that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { - struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} - typealias Version = _2 -} - -/// An empty message that you can re-use to avoid defining duplicated empty -/// messages in your project. A typical example is to use it as argument or the -/// return value of a service API. For instance: -/// -/// service Foo { -/// rpc Bar (grpc.testing.Empty) returns (grpc.testing.Empty) { }; -/// }; -struct Grpc_Testing_Empty { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -#if swift(>=5.5) && canImport(_Concurrency) -extension Grpc_Testing_Empty: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - -// MARK: - Code below here is support for the SwiftProtobuf runtime. - -fileprivate let _protobuf_package = "grpc.testing" - -extension Grpc_Testing_Empty: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".Empty" - static let _protobuf_nameMap = SwiftProtobuf._NameMap() - - mutating func decodeMessage(decoder: inout D) throws { - while let _ = try decoder.nextFieldNumber() { - } - } - - func traverse(visitor: inout V) throws { - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Grpc_Testing_Empty, rhs: Grpc_Testing_Empty) -> Bool { - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} diff --git a/Tests/ConnectLibraryTests/Generated/grpc/testing/test.connect.swift b/Tests/ConnectLibraryTests/Generated/grpc/testing/test.connect.swift deleted file mode 100644 index 18a6df6a..00000000 --- a/Tests/ConnectLibraryTests/Generated/grpc/testing/test.connect.swift +++ /dev/null @@ -1,498 +0,0 @@ -// Code generated by protoc-gen-connect-swift. DO NOT EDIT. -// -// Source: grpc/testing/test.proto -// - -import Connect -import Foundation -import SwiftProtobuf - -/// A simple service to test the various types of RPCs and experiment with -/// performance with various types of payload. -internal protocol Grpc_Testing_TestServiceClientInterface { - - /// One empty request followed by one empty response. - @discardableResult - func `emptyCall`(request: Grpc_Testing_Empty, headers: Connect.Headers, completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable - - /// One empty request followed by one empty response. - @available(iOS 13, *) - func `emptyCall`(request: Grpc_Testing_Empty, headers: Connect.Headers) async -> ResponseMessage - - /// One request followed by one response. - @discardableResult - func `unaryCall`(request: Grpc_Testing_SimpleRequest, headers: Connect.Headers, completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable - - /// One request followed by one response. - @available(iOS 13, *) - func `unaryCall`(request: Grpc_Testing_SimpleRequest, headers: Connect.Headers) async -> ResponseMessage - - /// One request followed by one response. This RPC always fails. - @discardableResult - func `failUnaryCall`(request: Grpc_Testing_SimpleRequest, headers: Connect.Headers, completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable - - /// One request followed by one response. This RPC always fails. - @available(iOS 13, *) - func `failUnaryCall`(request: Grpc_Testing_SimpleRequest, headers: Connect.Headers) async -> ResponseMessage - - /// One request followed by one response. Response has cache control - /// headers set such that a caching HTTP proxy (such as GFE) can - /// satisfy subsequent requests. - @discardableResult - func `cacheableUnaryCall`(request: Grpc_Testing_SimpleRequest, headers: Connect.Headers, completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable - - /// One request followed by one response. Response has cache control - /// headers set such that a caching HTTP proxy (such as GFE) can - /// satisfy subsequent requests. - @available(iOS 13, *) - func `cacheableUnaryCall`(request: Grpc_Testing_SimpleRequest, headers: Connect.Headers) async -> ResponseMessage - - /// One request followed by a sequence of responses (streamed download). - /// The server returns the payload with client desired type and sizes. - func `streamingOutputCall`(headers: Connect.Headers, onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ServerOnlyStreamInterface - - /// One request followed by a sequence of responses (streamed download). - /// The server returns the payload with client desired type and sizes. - @available(iOS 13, *) - func `streamingOutputCall`(headers: Connect.Headers) -> any Connect.ServerOnlyAsyncStreamInterface - - /// One request followed by a sequence of responses (streamed download). This RPC always fails. - func `failStreamingOutputCall`(headers: Connect.Headers, onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ServerOnlyStreamInterface - - /// One request followed by a sequence of responses (streamed download). This RPC always fails. - @available(iOS 13, *) - func `failStreamingOutputCall`(headers: Connect.Headers) -> any Connect.ServerOnlyAsyncStreamInterface - - /// A sequence of requests followed by one response (streamed upload). - /// The server returns the aggregated size of client payload as the result. - func `streamingInputCall`(headers: Connect.Headers, onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ClientOnlyStreamInterface - - /// A sequence of requests followed by one response (streamed upload). - /// The server returns the aggregated size of client payload as the result. - @available(iOS 13, *) - func `streamingInputCall`(headers: Connect.Headers) -> any Connect.ClientOnlyAsyncStreamInterface - - /// A sequence of requests with each request served by the server immediately. - /// As one request could lead to multiple responses, this interface - /// demonstrates the idea of full duplexing. - func `fullDuplexCall`(headers: Connect.Headers, onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.BidirectionalStreamInterface - - /// A sequence of requests with each request served by the server immediately. - /// As one request could lead to multiple responses, this interface - /// demonstrates the idea of full duplexing. - @available(iOS 13, *) - func `fullDuplexCall`(headers: Connect.Headers) -> any Connect.BidirectionalAsyncStreamInterface - - /// A sequence of requests followed by a sequence of responses. - /// The server buffers all the client requests and then serves them in order. A - /// stream of responses are returned to the client when the server starts with - /// first request. - func `halfDuplexCall`(headers: Connect.Headers, onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.BidirectionalStreamInterface - - /// A sequence of requests followed by a sequence of responses. - /// The server buffers all the client requests and then serves them in order. A - /// stream of responses are returned to the client when the server starts with - /// first request. - @available(iOS 13, *) - func `halfDuplexCall`(headers: Connect.Headers) -> any Connect.BidirectionalAsyncStreamInterface - - /// The test server will not implement this method. It will be used - /// to test the behavior when clients call unimplemented methods. - @discardableResult - func `unimplementedCall`(request: Grpc_Testing_Empty, headers: Connect.Headers, completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable - - /// The test server will not implement this method. It will be used - /// to test the behavior when clients call unimplemented methods. - @available(iOS 13, *) - func `unimplementedCall`(request: Grpc_Testing_Empty, headers: Connect.Headers) async -> ResponseMessage - - /// The test server will not implement this method. It will be used - /// to test the behavior when clients call unimplemented streaming output methods. - func `unimplementedStreamingOutputCall`(headers: Connect.Headers, onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ServerOnlyStreamInterface - - /// The test server will not implement this method. It will be used - /// to test the behavior when clients call unimplemented streaming output methods. - @available(iOS 13, *) - func `unimplementedStreamingOutputCall`(headers: Connect.Headers) -> any Connect.ServerOnlyAsyncStreamInterface -} - -/// Concrete implementation of `Grpc_Testing_TestServiceClientInterface`. -internal final class Grpc_Testing_TestServiceClient: Grpc_Testing_TestServiceClientInterface { - private let client: Connect.ProtocolClientInterface - - internal init(client: Connect.ProtocolClientInterface) { - self.client = client - } - - @discardableResult - internal func `emptyCall`(request: Grpc_Testing_Empty, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { - return self.client.unary(path: "grpc.testing.TestService/EmptyCall", request: request, headers: headers, completion: completion) - } - - @available(iOS 13, *) - internal func `emptyCall`(request: Grpc_Testing_Empty, headers: Connect.Headers = [:]) async -> ResponseMessage { - return await self.client.unary(path: "grpc.testing.TestService/EmptyCall", request: request, headers: headers) - } - - @discardableResult - internal func `unaryCall`(request: Grpc_Testing_SimpleRequest, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { - return self.client.unary(path: "grpc.testing.TestService/UnaryCall", request: request, headers: headers, completion: completion) - } - - @available(iOS 13, *) - internal func `unaryCall`(request: Grpc_Testing_SimpleRequest, headers: Connect.Headers = [:]) async -> ResponseMessage { - return await self.client.unary(path: "grpc.testing.TestService/UnaryCall", request: request, headers: headers) - } - - @discardableResult - internal func `failUnaryCall`(request: Grpc_Testing_SimpleRequest, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { - return self.client.unary(path: "grpc.testing.TestService/FailUnaryCall", request: request, headers: headers, completion: completion) - } - - @available(iOS 13, *) - internal func `failUnaryCall`(request: Grpc_Testing_SimpleRequest, headers: Connect.Headers = [:]) async -> ResponseMessage { - return await self.client.unary(path: "grpc.testing.TestService/FailUnaryCall", request: request, headers: headers) - } - - @discardableResult - internal func `cacheableUnaryCall`(request: Grpc_Testing_SimpleRequest, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { - return self.client.unary(path: "grpc.testing.TestService/CacheableUnaryCall", request: request, headers: headers, completion: completion) - } - - @available(iOS 13, *) - internal func `cacheableUnaryCall`(request: Grpc_Testing_SimpleRequest, headers: Connect.Headers = [:]) async -> ResponseMessage { - return await self.client.unary(path: "grpc.testing.TestService/CacheableUnaryCall", request: request, headers: headers) - } - - internal func `streamingOutputCall`(headers: Connect.Headers = [:], onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ServerOnlyStreamInterface { - return self.client.serverOnlyStream(path: "grpc.testing.TestService/StreamingOutputCall", headers: headers, onResult: onResult) - } - - @available(iOS 13, *) - internal func `streamingOutputCall`(headers: Connect.Headers = [:]) -> any Connect.ServerOnlyAsyncStreamInterface { - return self.client.serverOnlyStream(path: "grpc.testing.TestService/StreamingOutputCall", headers: headers) - } - - internal func `failStreamingOutputCall`(headers: Connect.Headers = [:], onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ServerOnlyStreamInterface { - return self.client.serverOnlyStream(path: "grpc.testing.TestService/FailStreamingOutputCall", headers: headers, onResult: onResult) - } - - @available(iOS 13, *) - internal func `failStreamingOutputCall`(headers: Connect.Headers = [:]) -> any Connect.ServerOnlyAsyncStreamInterface { - return self.client.serverOnlyStream(path: "grpc.testing.TestService/FailStreamingOutputCall", headers: headers) - } - - internal func `streamingInputCall`(headers: Connect.Headers = [:], onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ClientOnlyStreamInterface { - return self.client.clientOnlyStream(path: "grpc.testing.TestService/StreamingInputCall", headers: headers, onResult: onResult) - } - - @available(iOS 13, *) - internal func `streamingInputCall`(headers: Connect.Headers = [:]) -> any Connect.ClientOnlyAsyncStreamInterface { - return self.client.clientOnlyStream(path: "grpc.testing.TestService/StreamingInputCall", headers: headers) - } - - internal func `fullDuplexCall`(headers: Connect.Headers = [:], onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.BidirectionalStreamInterface { - return self.client.bidirectionalStream(path: "grpc.testing.TestService/FullDuplexCall", headers: headers, onResult: onResult) - } - - @available(iOS 13, *) - internal func `fullDuplexCall`(headers: Connect.Headers = [:]) -> any Connect.BidirectionalAsyncStreamInterface { - return self.client.bidirectionalStream(path: "grpc.testing.TestService/FullDuplexCall", headers: headers) - } - - internal func `halfDuplexCall`(headers: Connect.Headers = [:], onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.BidirectionalStreamInterface { - return self.client.bidirectionalStream(path: "grpc.testing.TestService/HalfDuplexCall", headers: headers, onResult: onResult) - } - - @available(iOS 13, *) - internal func `halfDuplexCall`(headers: Connect.Headers = [:]) -> any Connect.BidirectionalAsyncStreamInterface { - return self.client.bidirectionalStream(path: "grpc.testing.TestService/HalfDuplexCall", headers: headers) - } - - @discardableResult - internal func `unimplementedCall`(request: Grpc_Testing_Empty, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { - return self.client.unary(path: "grpc.testing.TestService/UnimplementedCall", request: request, headers: headers, completion: completion) - } - - @available(iOS 13, *) - internal func `unimplementedCall`(request: Grpc_Testing_Empty, headers: Connect.Headers = [:]) async -> ResponseMessage { - return await self.client.unary(path: "grpc.testing.TestService/UnimplementedCall", request: request, headers: headers) - } - - internal func `unimplementedStreamingOutputCall`(headers: Connect.Headers = [:], onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ServerOnlyStreamInterface { - return self.client.serverOnlyStream(path: "grpc.testing.TestService/UnimplementedStreamingOutputCall", headers: headers, onResult: onResult) - } - - @available(iOS 13, *) - internal func `unimplementedStreamingOutputCall`(headers: Connect.Headers = [:]) -> any Connect.ServerOnlyAsyncStreamInterface { - return self.client.serverOnlyStream(path: "grpc.testing.TestService/UnimplementedStreamingOutputCall", headers: headers) - } - - internal enum Metadata { - internal enum Methods { - internal static let emptyCall = Connect.MethodSpec(name: "EmptyCall", service: "grpc.testing.TestService", type: .unary) - internal static let unaryCall = Connect.MethodSpec(name: "UnaryCall", service: "grpc.testing.TestService", type: .unary) - internal static let failUnaryCall = Connect.MethodSpec(name: "FailUnaryCall", service: "grpc.testing.TestService", type: .unary) - internal static let cacheableUnaryCall = Connect.MethodSpec(name: "CacheableUnaryCall", service: "grpc.testing.TestService", type: .unary) - internal static let streamingOutputCall = Connect.MethodSpec(name: "StreamingOutputCall", service: "grpc.testing.TestService", type: .serverStream) - internal static let failStreamingOutputCall = Connect.MethodSpec(name: "FailStreamingOutputCall", service: "grpc.testing.TestService", type: .serverStream) - internal static let streamingInputCall = Connect.MethodSpec(name: "StreamingInputCall", service: "grpc.testing.TestService", type: .clientStream) - internal static let fullDuplexCall = Connect.MethodSpec(name: "FullDuplexCall", service: "grpc.testing.TestService", type: .bidirectionalStream) - internal static let halfDuplexCall = Connect.MethodSpec(name: "HalfDuplexCall", service: "grpc.testing.TestService", type: .bidirectionalStream) - internal static let unimplementedCall = Connect.MethodSpec(name: "UnimplementedCall", service: "grpc.testing.TestService", type: .unary) - internal static let unimplementedStreamingOutputCall = Connect.MethodSpec(name: "UnimplementedStreamingOutputCall", service: "grpc.testing.TestService", type: .serverStream) - } - } -} - -/// A simple service NOT implemented at servers so clients can test for -/// that case. -internal protocol Grpc_Testing_UnimplementedServiceClientInterface { - - /// A call that no server should implement - @discardableResult - func `unimplementedCall`(request: Grpc_Testing_Empty, headers: Connect.Headers, completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable - - /// A call that no server should implement - @available(iOS 13, *) - func `unimplementedCall`(request: Grpc_Testing_Empty, headers: Connect.Headers) async -> ResponseMessage - - /// A call that no server should implement - func `unimplementedStreamingOutputCall`(headers: Connect.Headers, onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ServerOnlyStreamInterface - - /// A call that no server should implement - @available(iOS 13, *) - func `unimplementedStreamingOutputCall`(headers: Connect.Headers) -> any Connect.ServerOnlyAsyncStreamInterface -} - -/// Concrete implementation of `Grpc_Testing_UnimplementedServiceClientInterface`. -internal final class Grpc_Testing_UnimplementedServiceClient: Grpc_Testing_UnimplementedServiceClientInterface { - private let client: Connect.ProtocolClientInterface - - internal init(client: Connect.ProtocolClientInterface) { - self.client = client - } - - @discardableResult - internal func `unimplementedCall`(request: Grpc_Testing_Empty, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { - return self.client.unary(path: "grpc.testing.UnimplementedService/UnimplementedCall", request: request, headers: headers, completion: completion) - } - - @available(iOS 13, *) - internal func `unimplementedCall`(request: Grpc_Testing_Empty, headers: Connect.Headers = [:]) async -> ResponseMessage { - return await self.client.unary(path: "grpc.testing.UnimplementedService/UnimplementedCall", request: request, headers: headers) - } - - internal func `unimplementedStreamingOutputCall`(headers: Connect.Headers = [:], onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ServerOnlyStreamInterface { - return self.client.serverOnlyStream(path: "grpc.testing.UnimplementedService/UnimplementedStreamingOutputCall", headers: headers, onResult: onResult) - } - - @available(iOS 13, *) - internal func `unimplementedStreamingOutputCall`(headers: Connect.Headers = [:]) -> any Connect.ServerOnlyAsyncStreamInterface { - return self.client.serverOnlyStream(path: "grpc.testing.UnimplementedService/UnimplementedStreamingOutputCall", headers: headers) - } - - internal enum Metadata { - internal enum Methods { - internal static let unimplementedCall = Connect.MethodSpec(name: "UnimplementedCall", service: "grpc.testing.UnimplementedService", type: .unary) - internal static let unimplementedStreamingOutputCall = Connect.MethodSpec(name: "UnimplementedStreamingOutputCall", service: "grpc.testing.UnimplementedService", type: .serverStream) - } - } -} - -/// A service used to control reconnect server. -internal protocol Grpc_Testing_ReconnectServiceClientInterface { - - @discardableResult - func `start`(request: Grpc_Testing_ReconnectParams, headers: Connect.Headers, completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable - - @available(iOS 13, *) - func `start`(request: Grpc_Testing_ReconnectParams, headers: Connect.Headers) async -> ResponseMessage - - @discardableResult - func `stop`(request: Grpc_Testing_Empty, headers: Connect.Headers, completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable - - @available(iOS 13, *) - func `stop`(request: Grpc_Testing_Empty, headers: Connect.Headers) async -> ResponseMessage -} - -/// Concrete implementation of `Grpc_Testing_ReconnectServiceClientInterface`. -internal final class Grpc_Testing_ReconnectServiceClient: Grpc_Testing_ReconnectServiceClientInterface { - private let client: Connect.ProtocolClientInterface - - internal init(client: Connect.ProtocolClientInterface) { - self.client = client - } - - @discardableResult - internal func `start`(request: Grpc_Testing_ReconnectParams, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { - return self.client.unary(path: "grpc.testing.ReconnectService/Start", request: request, headers: headers, completion: completion) - } - - @available(iOS 13, *) - internal func `start`(request: Grpc_Testing_ReconnectParams, headers: Connect.Headers = [:]) async -> ResponseMessage { - return await self.client.unary(path: "grpc.testing.ReconnectService/Start", request: request, headers: headers) - } - - @discardableResult - internal func `stop`(request: Grpc_Testing_Empty, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { - return self.client.unary(path: "grpc.testing.ReconnectService/Stop", request: request, headers: headers, completion: completion) - } - - @available(iOS 13, *) - internal func `stop`(request: Grpc_Testing_Empty, headers: Connect.Headers = [:]) async -> ResponseMessage { - return await self.client.unary(path: "grpc.testing.ReconnectService/Stop", request: request, headers: headers) - } - - internal enum Metadata { - internal enum Methods { - internal static let start = Connect.MethodSpec(name: "Start", service: "grpc.testing.ReconnectService", type: .unary) - internal static let stop = Connect.MethodSpec(name: "Stop", service: "grpc.testing.ReconnectService", type: .unary) - } - } -} - -/// A service used to obtain stats for verifying LB behavior. -internal protocol Grpc_Testing_LoadBalancerStatsServiceClientInterface { - - /// Gets the backend distribution for RPCs sent by a test client. - @discardableResult - func `getClientStats`(request: Grpc_Testing_LoadBalancerStatsRequest, headers: Connect.Headers, completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable - - /// Gets the backend distribution for RPCs sent by a test client. - @available(iOS 13, *) - func `getClientStats`(request: Grpc_Testing_LoadBalancerStatsRequest, headers: Connect.Headers) async -> ResponseMessage - - /// Gets the accumulated stats for RPCs sent by a test client. - @discardableResult - func `getClientAccumulatedStats`(request: Grpc_Testing_LoadBalancerAccumulatedStatsRequest, headers: Connect.Headers, completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable - - /// Gets the accumulated stats for RPCs sent by a test client. - @available(iOS 13, *) - func `getClientAccumulatedStats`(request: Grpc_Testing_LoadBalancerAccumulatedStatsRequest, headers: Connect.Headers) async -> ResponseMessage -} - -/// Concrete implementation of `Grpc_Testing_LoadBalancerStatsServiceClientInterface`. -internal final class Grpc_Testing_LoadBalancerStatsServiceClient: Grpc_Testing_LoadBalancerStatsServiceClientInterface { - private let client: Connect.ProtocolClientInterface - - internal init(client: Connect.ProtocolClientInterface) { - self.client = client - } - - @discardableResult - internal func `getClientStats`(request: Grpc_Testing_LoadBalancerStatsRequest, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { - return self.client.unary(path: "grpc.testing.LoadBalancerStatsService/GetClientStats", request: request, headers: headers, completion: completion) - } - - @available(iOS 13, *) - internal func `getClientStats`(request: Grpc_Testing_LoadBalancerStatsRequest, headers: Connect.Headers = [:]) async -> ResponseMessage { - return await self.client.unary(path: "grpc.testing.LoadBalancerStatsService/GetClientStats", request: request, headers: headers) - } - - @discardableResult - internal func `getClientAccumulatedStats`(request: Grpc_Testing_LoadBalancerAccumulatedStatsRequest, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { - return self.client.unary(path: "grpc.testing.LoadBalancerStatsService/GetClientAccumulatedStats", request: request, headers: headers, completion: completion) - } - - @available(iOS 13, *) - internal func `getClientAccumulatedStats`(request: Grpc_Testing_LoadBalancerAccumulatedStatsRequest, headers: Connect.Headers = [:]) async -> ResponseMessage { - return await self.client.unary(path: "grpc.testing.LoadBalancerStatsService/GetClientAccumulatedStats", request: request, headers: headers) - } - - internal enum Metadata { - internal enum Methods { - internal static let getClientStats = Connect.MethodSpec(name: "GetClientStats", service: "grpc.testing.LoadBalancerStatsService", type: .unary) - internal static let getClientAccumulatedStats = Connect.MethodSpec(name: "GetClientAccumulatedStats", service: "grpc.testing.LoadBalancerStatsService", type: .unary) - } - } -} - -/// A service to remotely control health status of an xDS test server. -internal protocol Grpc_Testing_XdsUpdateHealthServiceClientInterface { - - @discardableResult - func `setServing`(request: Grpc_Testing_Empty, headers: Connect.Headers, completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable - - @available(iOS 13, *) - func `setServing`(request: Grpc_Testing_Empty, headers: Connect.Headers) async -> ResponseMessage - - @discardableResult - func `setNotServing`(request: Grpc_Testing_Empty, headers: Connect.Headers, completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable - - @available(iOS 13, *) - func `setNotServing`(request: Grpc_Testing_Empty, headers: Connect.Headers) async -> ResponseMessage -} - -/// Concrete implementation of `Grpc_Testing_XdsUpdateHealthServiceClientInterface`. -internal final class Grpc_Testing_XdsUpdateHealthServiceClient: Grpc_Testing_XdsUpdateHealthServiceClientInterface { - private let client: Connect.ProtocolClientInterface - - internal init(client: Connect.ProtocolClientInterface) { - self.client = client - } - - @discardableResult - internal func `setServing`(request: Grpc_Testing_Empty, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { - return self.client.unary(path: "grpc.testing.XdsUpdateHealthService/SetServing", request: request, headers: headers, completion: completion) - } - - @available(iOS 13, *) - internal func `setServing`(request: Grpc_Testing_Empty, headers: Connect.Headers = [:]) async -> ResponseMessage { - return await self.client.unary(path: "grpc.testing.XdsUpdateHealthService/SetServing", request: request, headers: headers) - } - - @discardableResult - internal func `setNotServing`(request: Grpc_Testing_Empty, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { - return self.client.unary(path: "grpc.testing.XdsUpdateHealthService/SetNotServing", request: request, headers: headers, completion: completion) - } - - @available(iOS 13, *) - internal func `setNotServing`(request: Grpc_Testing_Empty, headers: Connect.Headers = [:]) async -> ResponseMessage { - return await self.client.unary(path: "grpc.testing.XdsUpdateHealthService/SetNotServing", request: request, headers: headers) - } - - internal enum Metadata { - internal enum Methods { - internal static let setServing = Connect.MethodSpec(name: "SetServing", service: "grpc.testing.XdsUpdateHealthService", type: .unary) - internal static let setNotServing = Connect.MethodSpec(name: "SetNotServing", service: "grpc.testing.XdsUpdateHealthService", type: .unary) - } - } -} - -/// A service to dynamically update the configuration of an xDS test client. -internal protocol Grpc_Testing_XdsUpdateClientConfigureServiceClientInterface { - - /// Update the tes client's configuration. - @discardableResult - func `configure`(request: Grpc_Testing_ClientConfigureRequest, headers: Connect.Headers, completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable - - /// Update the tes client's configuration. - @available(iOS 13, *) - func `configure`(request: Grpc_Testing_ClientConfigureRequest, headers: Connect.Headers) async -> ResponseMessage -} - -/// Concrete implementation of `Grpc_Testing_XdsUpdateClientConfigureServiceClientInterface`. -internal final class Grpc_Testing_XdsUpdateClientConfigureServiceClient: Grpc_Testing_XdsUpdateClientConfigureServiceClientInterface { - private let client: Connect.ProtocolClientInterface - - internal init(client: Connect.ProtocolClientInterface) { - self.client = client - } - - @discardableResult - internal func `configure`(request: Grpc_Testing_ClientConfigureRequest, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { - return self.client.unary(path: "grpc.testing.XdsUpdateClientConfigureService/Configure", request: request, headers: headers, completion: completion) - } - - @available(iOS 13, *) - internal func `configure`(request: Grpc_Testing_ClientConfigureRequest, headers: Connect.Headers = [:]) async -> ResponseMessage { - return await self.client.unary(path: "grpc.testing.XdsUpdateClientConfigureService/Configure", request: request, headers: headers) - } - - internal enum Metadata { - internal enum Methods { - internal static let configure = Connect.MethodSpec(name: "Configure", service: "grpc.testing.XdsUpdateClientConfigureService", type: .unary) - } - } -} diff --git a/Tests/ConnectLibraryTests/Generated/grpc/testing/test.mock.swift b/Tests/ConnectLibraryTests/Generated/grpc/testing/test.mock.swift deleted file mode 100644 index d6eaca29..00000000 --- a/Tests/ConnectLibraryTests/Generated/grpc/testing/test.mock.swift +++ /dev/null @@ -1,367 +0,0 @@ -// Code generated by protoc-gen-connect-swift. DO NOT EDIT. -// -// Source: grpc/testing/test.proto -// - -import Combine -import Connect -import ConnectMocks -import Foundation -import SwiftProtobuf - -/// Mock implementation of `Grpc_Testing_TestServiceClientInterface`. -/// -/// Production implementations can be substituted with instances of this -/// class, allowing for mocking RPC calls. Behavior can be customized -/// either through the properties on this class or by -/// subclassing the class and overriding its methods. -@available(iOS 13, *) -internal class Grpc_Testing_TestServiceClientMock: Grpc_Testing_TestServiceClientInterface { - private var cancellables = [Combine.AnyCancellable]() - - /// Mocked for calls to `emptyCall()`. - internal var mockEmptyCall = { (_: Grpc_Testing_Empty) -> ResponseMessage in .init(result: .success(.init())) } - /// Mocked for async calls to `emptyCall()`. - internal var mockAsyncEmptyCall = { (_: Grpc_Testing_Empty) -> ResponseMessage in .init(result: .success(.init())) } - /// Mocked for calls to `unaryCall()`. - internal var mockUnaryCall = { (_: Grpc_Testing_SimpleRequest) -> ResponseMessage in .init(result: .success(.init())) } - /// Mocked for async calls to `unaryCall()`. - internal var mockAsyncUnaryCall = { (_: Grpc_Testing_SimpleRequest) -> ResponseMessage in .init(result: .success(.init())) } - /// Mocked for calls to `failUnaryCall()`. - internal var mockFailUnaryCall = { (_: Grpc_Testing_SimpleRequest) -> ResponseMessage in .init(result: .success(.init())) } - /// Mocked for async calls to `failUnaryCall()`. - internal var mockAsyncFailUnaryCall = { (_: Grpc_Testing_SimpleRequest) -> ResponseMessage in .init(result: .success(.init())) } - /// Mocked for calls to `cacheableUnaryCall()`. - internal var mockCacheableUnaryCall = { (_: Grpc_Testing_SimpleRequest) -> ResponseMessage in .init(result: .success(.init())) } - /// Mocked for async calls to `cacheableUnaryCall()`. - internal var mockAsyncCacheableUnaryCall = { (_: Grpc_Testing_SimpleRequest) -> ResponseMessage in .init(result: .success(.init())) } - /// Mocked for calls to `streamingOutputCall()`. - internal var mockStreamingOutputCall = MockServerOnlyStream() - /// Mocked for async calls to `streamingOutputCall()`. - internal var mockAsyncStreamingOutputCall = MockServerOnlyAsyncStream() - /// Mocked for calls to `failStreamingOutputCall()`. - internal var mockFailStreamingOutputCall = MockServerOnlyStream() - /// Mocked for async calls to `failStreamingOutputCall()`. - internal var mockAsyncFailStreamingOutputCall = MockServerOnlyAsyncStream() - /// Mocked for calls to `streamingInputCall()`. - internal var mockStreamingInputCall = MockClientOnlyStream() - /// Mocked for async calls to `streamingInputCall()`. - internal var mockAsyncStreamingInputCall = MockClientOnlyAsyncStream() - /// Mocked for calls to `fullDuplexCall()`. - internal var mockFullDuplexCall = MockBidirectionalStream() - /// Mocked for async calls to `fullDuplexCall()`. - internal var mockAsyncFullDuplexCall = MockBidirectionalAsyncStream() - /// Mocked for calls to `halfDuplexCall()`. - internal var mockHalfDuplexCall = MockBidirectionalStream() - /// Mocked for async calls to `halfDuplexCall()`. - internal var mockAsyncHalfDuplexCall = MockBidirectionalAsyncStream() - /// Mocked for calls to `unimplementedCall()`. - internal var mockUnimplementedCall = { (_: Grpc_Testing_Empty) -> ResponseMessage in .init(result: .success(.init())) } - /// Mocked for async calls to `unimplementedCall()`. - internal var mockAsyncUnimplementedCall = { (_: Grpc_Testing_Empty) -> ResponseMessage in .init(result: .success(.init())) } - /// Mocked for calls to `unimplementedStreamingOutputCall()`. - internal var mockUnimplementedStreamingOutputCall = MockServerOnlyStream() - /// Mocked for async calls to `unimplementedStreamingOutputCall()`. - internal var mockAsyncUnimplementedStreamingOutputCall = MockServerOnlyAsyncStream() - - internal init() {} - - @discardableResult - internal func `emptyCall`(request: Grpc_Testing_Empty, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { - completion(self.mockEmptyCall(request)) - return Connect.Cancelable {} - } - - internal func `emptyCall`(request: Grpc_Testing_Empty, headers: Connect.Headers = [:]) async -> ResponseMessage { - return self.mockAsyncEmptyCall(request) - } - - @discardableResult - internal func `unaryCall`(request: Grpc_Testing_SimpleRequest, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { - completion(self.mockUnaryCall(request)) - return Connect.Cancelable {} - } - - internal func `unaryCall`(request: Grpc_Testing_SimpleRequest, headers: Connect.Headers = [:]) async -> ResponseMessage { - return self.mockAsyncUnaryCall(request) - } - - @discardableResult - internal func `failUnaryCall`(request: Grpc_Testing_SimpleRequest, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { - completion(self.mockFailUnaryCall(request)) - return Connect.Cancelable {} - } - - internal func `failUnaryCall`(request: Grpc_Testing_SimpleRequest, headers: Connect.Headers = [:]) async -> ResponseMessage { - return self.mockAsyncFailUnaryCall(request) - } - - @discardableResult - internal func `cacheableUnaryCall`(request: Grpc_Testing_SimpleRequest, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { - completion(self.mockCacheableUnaryCall(request)) - return Connect.Cancelable {} - } - - internal func `cacheableUnaryCall`(request: Grpc_Testing_SimpleRequest, headers: Connect.Headers = [:]) async -> ResponseMessage { - return self.mockAsyncCacheableUnaryCall(request) - } - - internal func `streamingOutputCall`(headers: Connect.Headers = [:], onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ServerOnlyStreamInterface { - self.mockStreamingOutputCall.$inputs.first { !$0.isEmpty }.sink { _ in self.mockStreamingOutputCall.outputs.forEach(onResult) }.store(in: &self.cancellables) - return self.mockStreamingOutputCall - } - - internal func `streamingOutputCall`(headers: Connect.Headers = [:]) -> any Connect.ServerOnlyAsyncStreamInterface { - return self.mockAsyncStreamingOutputCall - } - - internal func `failStreamingOutputCall`(headers: Connect.Headers = [:], onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ServerOnlyStreamInterface { - self.mockFailStreamingOutputCall.$inputs.first { !$0.isEmpty }.sink { _ in self.mockFailStreamingOutputCall.outputs.forEach(onResult) }.store(in: &self.cancellables) - return self.mockFailStreamingOutputCall - } - - internal func `failStreamingOutputCall`(headers: Connect.Headers = [:]) -> any Connect.ServerOnlyAsyncStreamInterface { - return self.mockAsyncFailStreamingOutputCall - } - - internal func `streamingInputCall`(headers: Connect.Headers = [:], onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ClientOnlyStreamInterface { - self.mockStreamingInputCall.$inputs.first { !$0.isEmpty }.sink { _ in self.mockStreamingInputCall.outputs.forEach(onResult) }.store(in: &self.cancellables) - return self.mockStreamingInputCall - } - - internal func `streamingInputCall`(headers: Connect.Headers = [:]) -> any Connect.ClientOnlyAsyncStreamInterface { - return self.mockAsyncStreamingInputCall - } - - internal func `fullDuplexCall`(headers: Connect.Headers = [:], onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.BidirectionalStreamInterface { - self.mockFullDuplexCall.$inputs.first { !$0.isEmpty }.sink { _ in self.mockFullDuplexCall.outputs.forEach(onResult) }.store(in: &self.cancellables) - return self.mockFullDuplexCall - } - - internal func `fullDuplexCall`(headers: Connect.Headers = [:]) -> any Connect.BidirectionalAsyncStreamInterface { - return self.mockAsyncFullDuplexCall - } - - internal func `halfDuplexCall`(headers: Connect.Headers = [:], onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.BidirectionalStreamInterface { - self.mockHalfDuplexCall.$inputs.first { !$0.isEmpty }.sink { _ in self.mockHalfDuplexCall.outputs.forEach(onResult) }.store(in: &self.cancellables) - return self.mockHalfDuplexCall - } - - internal func `halfDuplexCall`(headers: Connect.Headers = [:]) -> any Connect.BidirectionalAsyncStreamInterface { - return self.mockAsyncHalfDuplexCall - } - - @discardableResult - internal func `unimplementedCall`(request: Grpc_Testing_Empty, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { - completion(self.mockUnimplementedCall(request)) - return Connect.Cancelable {} - } - - internal func `unimplementedCall`(request: Grpc_Testing_Empty, headers: Connect.Headers = [:]) async -> ResponseMessage { - return self.mockAsyncUnimplementedCall(request) - } - - internal func `unimplementedStreamingOutputCall`(headers: Connect.Headers = [:], onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ServerOnlyStreamInterface { - self.mockUnimplementedStreamingOutputCall.$inputs.first { !$0.isEmpty }.sink { _ in self.mockUnimplementedStreamingOutputCall.outputs.forEach(onResult) }.store(in: &self.cancellables) - return self.mockUnimplementedStreamingOutputCall - } - - internal func `unimplementedStreamingOutputCall`(headers: Connect.Headers = [:]) -> any Connect.ServerOnlyAsyncStreamInterface { - return self.mockAsyncUnimplementedStreamingOutputCall - } -} - -/// Mock implementation of `Grpc_Testing_UnimplementedServiceClientInterface`. -/// -/// Production implementations can be substituted with instances of this -/// class, allowing for mocking RPC calls. Behavior can be customized -/// either through the properties on this class or by -/// subclassing the class and overriding its methods. -@available(iOS 13, *) -internal class Grpc_Testing_UnimplementedServiceClientMock: Grpc_Testing_UnimplementedServiceClientInterface { - private var cancellables = [Combine.AnyCancellable]() - - /// Mocked for calls to `unimplementedCall()`. - internal var mockUnimplementedCall = { (_: Grpc_Testing_Empty) -> ResponseMessage in .init(result: .success(.init())) } - /// Mocked for async calls to `unimplementedCall()`. - internal var mockAsyncUnimplementedCall = { (_: Grpc_Testing_Empty) -> ResponseMessage in .init(result: .success(.init())) } - /// Mocked for calls to `unimplementedStreamingOutputCall()`. - internal var mockUnimplementedStreamingOutputCall = MockServerOnlyStream() - /// Mocked for async calls to `unimplementedStreamingOutputCall()`. - internal var mockAsyncUnimplementedStreamingOutputCall = MockServerOnlyAsyncStream() - - internal init() {} - - @discardableResult - internal func `unimplementedCall`(request: Grpc_Testing_Empty, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { - completion(self.mockUnimplementedCall(request)) - return Connect.Cancelable {} - } - - internal func `unimplementedCall`(request: Grpc_Testing_Empty, headers: Connect.Headers = [:]) async -> ResponseMessage { - return self.mockAsyncUnimplementedCall(request) - } - - internal func `unimplementedStreamingOutputCall`(headers: Connect.Headers = [:], onResult: @escaping (Connect.StreamResult) -> Void) -> any Connect.ServerOnlyStreamInterface { - self.mockUnimplementedStreamingOutputCall.$inputs.first { !$0.isEmpty }.sink { _ in self.mockUnimplementedStreamingOutputCall.outputs.forEach(onResult) }.store(in: &self.cancellables) - return self.mockUnimplementedStreamingOutputCall - } - - internal func `unimplementedStreamingOutputCall`(headers: Connect.Headers = [:]) -> any Connect.ServerOnlyAsyncStreamInterface { - return self.mockAsyncUnimplementedStreamingOutputCall - } -} - -/// Mock implementation of `Grpc_Testing_ReconnectServiceClientInterface`. -/// -/// Production implementations can be substituted with instances of this -/// class, allowing for mocking RPC calls. Behavior can be customized -/// either through the properties on this class or by -/// subclassing the class and overriding its methods. -@available(iOS 13, *) -internal class Grpc_Testing_ReconnectServiceClientMock: Grpc_Testing_ReconnectServiceClientInterface { - private var cancellables = [Combine.AnyCancellable]() - - /// Mocked for calls to `start()`. - internal var mockStart = { (_: Grpc_Testing_ReconnectParams) -> ResponseMessage in .init(result: .success(.init())) } - /// Mocked for async calls to `start()`. - internal var mockAsyncStart = { (_: Grpc_Testing_ReconnectParams) -> ResponseMessage in .init(result: .success(.init())) } - /// Mocked for calls to `stop()`. - internal var mockStop = { (_: Grpc_Testing_Empty) -> ResponseMessage in .init(result: .success(.init())) } - /// Mocked for async calls to `stop()`. - internal var mockAsyncStop = { (_: Grpc_Testing_Empty) -> ResponseMessage in .init(result: .success(.init())) } - - internal init() {} - - @discardableResult - internal func `start`(request: Grpc_Testing_ReconnectParams, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { - completion(self.mockStart(request)) - return Connect.Cancelable {} - } - - internal func `start`(request: Grpc_Testing_ReconnectParams, headers: Connect.Headers = [:]) async -> ResponseMessage { - return self.mockAsyncStart(request) - } - - @discardableResult - internal func `stop`(request: Grpc_Testing_Empty, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { - completion(self.mockStop(request)) - return Connect.Cancelable {} - } - - internal func `stop`(request: Grpc_Testing_Empty, headers: Connect.Headers = [:]) async -> ResponseMessage { - return self.mockAsyncStop(request) - } -} - -/// Mock implementation of `Grpc_Testing_LoadBalancerStatsServiceClientInterface`. -/// -/// Production implementations can be substituted with instances of this -/// class, allowing for mocking RPC calls. Behavior can be customized -/// either through the properties on this class or by -/// subclassing the class and overriding its methods. -@available(iOS 13, *) -internal class Grpc_Testing_LoadBalancerStatsServiceClientMock: Grpc_Testing_LoadBalancerStatsServiceClientInterface { - private var cancellables = [Combine.AnyCancellable]() - - /// Mocked for calls to `getClientStats()`. - internal var mockGetClientStats = { (_: Grpc_Testing_LoadBalancerStatsRequest) -> ResponseMessage in .init(result: .success(.init())) } - /// Mocked for async calls to `getClientStats()`. - internal var mockAsyncGetClientStats = { (_: Grpc_Testing_LoadBalancerStatsRequest) -> ResponseMessage in .init(result: .success(.init())) } - /// Mocked for calls to `getClientAccumulatedStats()`. - internal var mockGetClientAccumulatedStats = { (_: Grpc_Testing_LoadBalancerAccumulatedStatsRequest) -> ResponseMessage in .init(result: .success(.init())) } - /// Mocked for async calls to `getClientAccumulatedStats()`. - internal var mockAsyncGetClientAccumulatedStats = { (_: Grpc_Testing_LoadBalancerAccumulatedStatsRequest) -> ResponseMessage in .init(result: .success(.init())) } - - internal init() {} - - @discardableResult - internal func `getClientStats`(request: Grpc_Testing_LoadBalancerStatsRequest, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { - completion(self.mockGetClientStats(request)) - return Connect.Cancelable {} - } - - internal func `getClientStats`(request: Grpc_Testing_LoadBalancerStatsRequest, headers: Connect.Headers = [:]) async -> ResponseMessage { - return self.mockAsyncGetClientStats(request) - } - - @discardableResult - internal func `getClientAccumulatedStats`(request: Grpc_Testing_LoadBalancerAccumulatedStatsRequest, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { - completion(self.mockGetClientAccumulatedStats(request)) - return Connect.Cancelable {} - } - - internal func `getClientAccumulatedStats`(request: Grpc_Testing_LoadBalancerAccumulatedStatsRequest, headers: Connect.Headers = [:]) async -> ResponseMessage { - return self.mockAsyncGetClientAccumulatedStats(request) - } -} - -/// Mock implementation of `Grpc_Testing_XdsUpdateHealthServiceClientInterface`. -/// -/// Production implementations can be substituted with instances of this -/// class, allowing for mocking RPC calls. Behavior can be customized -/// either through the properties on this class or by -/// subclassing the class and overriding its methods. -@available(iOS 13, *) -internal class Grpc_Testing_XdsUpdateHealthServiceClientMock: Grpc_Testing_XdsUpdateHealthServiceClientInterface { - private var cancellables = [Combine.AnyCancellable]() - - /// Mocked for calls to `setServing()`. - internal var mockSetServing = { (_: Grpc_Testing_Empty) -> ResponseMessage in .init(result: .success(.init())) } - /// Mocked for async calls to `setServing()`. - internal var mockAsyncSetServing = { (_: Grpc_Testing_Empty) -> ResponseMessage in .init(result: .success(.init())) } - /// Mocked for calls to `setNotServing()`. - internal var mockSetNotServing = { (_: Grpc_Testing_Empty) -> ResponseMessage in .init(result: .success(.init())) } - /// Mocked for async calls to `setNotServing()`. - internal var mockAsyncSetNotServing = { (_: Grpc_Testing_Empty) -> ResponseMessage in .init(result: .success(.init())) } - - internal init() {} - - @discardableResult - internal func `setServing`(request: Grpc_Testing_Empty, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { - completion(self.mockSetServing(request)) - return Connect.Cancelable {} - } - - internal func `setServing`(request: Grpc_Testing_Empty, headers: Connect.Headers = [:]) async -> ResponseMessage { - return self.mockAsyncSetServing(request) - } - - @discardableResult - internal func `setNotServing`(request: Grpc_Testing_Empty, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { - completion(self.mockSetNotServing(request)) - return Connect.Cancelable {} - } - - internal func `setNotServing`(request: Grpc_Testing_Empty, headers: Connect.Headers = [:]) async -> ResponseMessage { - return self.mockAsyncSetNotServing(request) - } -} - -/// Mock implementation of `Grpc_Testing_XdsUpdateClientConfigureServiceClientInterface`. -/// -/// Production implementations can be substituted with instances of this -/// class, allowing for mocking RPC calls. Behavior can be customized -/// either through the properties on this class or by -/// subclassing the class and overriding its methods. -@available(iOS 13, *) -internal class Grpc_Testing_XdsUpdateClientConfigureServiceClientMock: Grpc_Testing_XdsUpdateClientConfigureServiceClientInterface { - private var cancellables = [Combine.AnyCancellable]() - - /// Mocked for calls to `configure()`. - internal var mockConfigure = { (_: Grpc_Testing_ClientConfigureRequest) -> ResponseMessage in .init(result: .success(.init())) } - /// Mocked for async calls to `configure()`. - internal var mockAsyncConfigure = { (_: Grpc_Testing_ClientConfigureRequest) -> ResponseMessage in .init(result: .success(.init())) } - - internal init() {} - - @discardableResult - internal func `configure`(request: Grpc_Testing_ClientConfigureRequest, headers: Connect.Headers = [:], completion: @escaping (ResponseMessage) -> Void) -> Connect.Cancelable { - completion(self.mockConfigure(request)) - return Connect.Cancelable {} - } - - internal func `configure`(request: Grpc_Testing_ClientConfigureRequest, headers: Connect.Headers = [:]) async -> ResponseMessage { - return self.mockAsyncConfigure(request) - } -} diff --git a/Tests/ConnectLibraryTests/Generated/server/v1/server.pb.swift b/Tests/ConnectLibraryTests/Generated/server/v1/server.pb.swift index 2619cd94..4ccdc44c 100644 --- a/Tests/ConnectLibraryTests/Generated/server/v1/server.pb.swift +++ b/Tests/ConnectLibraryTests/Generated/server/v1/server.pb.swift @@ -7,7 +7,7 @@ // For information on using the generated types, please see the documentation: // https://github.com/apple/swift-protobuf/ -// Copyright 2022-2023 Buf Technologies, Inc. +// Copyright 2022 Buf Technologies, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -69,7 +69,7 @@ enum Server_V1_Protocol: SwiftProtobuf.Enum { extension Server_V1_Protocol: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Server_V1_Protocol] = [ + static let allCases: [Server_V1_Protocol] = [ .unspecified, .grpc, .grpcWeb, diff --git a/Tests/ConnectLibraryTests/buf.work.yaml b/Tests/ConnectLibraryTests/buf.work.yaml deleted file mode 100644 index 1878b341..00000000 --- a/Tests/ConnectLibraryTests/buf.work.yaml +++ /dev/null @@ -1,3 +0,0 @@ -version: v1 -directories: - - proto diff --git a/Tests/ConnectLibraryTests/proto/README.md b/Tests/ConnectLibraryTests/proto/README.md deleted file mode 100644 index fcc6cc73..00000000 --- a/Tests/ConnectLibraryTests/proto/README.md +++ /dev/null @@ -1,2 +0,0 @@ -This directory contains `.proto` files that are used to communicate -with the conformance server when running tests. diff --git a/Tests/ConnectLibraryTests/proto/buf.yaml b/Tests/ConnectLibraryTests/proto/buf.yaml deleted file mode 100644 index 5efec8cf..00000000 --- a/Tests/ConnectLibraryTests/proto/buf.yaml +++ /dev/null @@ -1,12 +0,0 @@ -version: v1 -lint: - use: - - DEFAULT - ignore: - # We don't control these definitions, so we ignore lint errors. - - grpc/testing/empty.proto - - grpc/testing/messages.proto - - grpc/testing/test.proto -breaking: - use: - - WIRE_JSON diff --git a/Tests/ConnectLibraryTests/proto/grpc/testing/empty.proto b/Tests/ConnectLibraryTests/proto/grpc/testing/empty.proto deleted file mode 100644 index 4253b711..00000000 --- a/Tests/ConnectLibraryTests/proto/grpc/testing/empty.proto +++ /dev/null @@ -1,29 +0,0 @@ -// This is copied from gRPC's testing Protobuf definitions: https://github.com/grpc/grpc/blob/master/src/proto/grpc/testing/empty.proto - -// Copyright 2015 gRPC authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package grpc.testing; - -// An empty message that you can re-use to avoid defining duplicated empty -// messages in your project. A typical example is to use it as argument or the -// return value of a service API. For instance: -// -// service Foo { -// rpc Bar (grpc.testing.Empty) returns (grpc.testing.Empty) { }; -// }; -// -message Empty {} diff --git a/Tests/ConnectLibraryTests/proto/grpc/testing/messages.proto b/Tests/ConnectLibraryTests/proto/grpc/testing/messages.proto deleted file mode 100644 index 2b03b5ba..00000000 --- a/Tests/ConnectLibraryTests/proto/grpc/testing/messages.proto +++ /dev/null @@ -1,284 +0,0 @@ -// This is copied from gRPC's testing Protobuf definitions: https://github.com/grpc/grpc/blob/master/src/proto/grpc/testing/messages.proto - -// Copyright 2015-2016 gRPC authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Message definitions to be used by integration test service definitions. - -syntax = "proto3"; - -package grpc.testing; - -import "google/protobuf/any.proto"; - -// TODO(dgq): Go back to using well-known types once -// https://github.com/grpc/grpc/issues/6980 has been fixed. -// import "google/protobuf/wrappers.proto"; -message BoolValue { - // The bool value. - bool value = 1; -} - -// The type of payload that should be returned. -enum PayloadType { - // Compressable text format. - COMPRESSABLE = 0; -} - -// A block of data, to simply increase gRPC message size. -message Payload { - // The type of data in body. - PayloadType type = 1; - // Primary contents of payload. - bytes body = 2; -} - -// A protobuf representation for grpc status. This is used by test -// clients to specify a status that the server should attempt to return. -message EchoStatus { - int32 code = 1; - string message = 2; -} - -// The type of route that a client took to reach a server w.r.t. gRPCLB. -// The server must fill in "fallback" if it detects that the RPC reached -// the server via the "gRPCLB fallback" path, and "backend" if it detects -// that the RPC reached the server via "gRPCLB backend" path (i.e. if it got -// the address of this server from the gRPCLB server BalanceLoad RPC). Exactly -// how this detection is done is context and server dependent. -enum GrpclbRouteType { - // Server didn't detect the route that a client took to reach it. - GRPCLB_ROUTE_TYPE_UNKNOWN = 0; - // Indicates that a client reached a server via gRPCLB fallback. - GRPCLB_ROUTE_TYPE_FALLBACK = 1; - // Indicates that a client reached a server as a gRPCLB-given backend. - GRPCLB_ROUTE_TYPE_BACKEND = 2; -} - -// Unary request. -message SimpleRequest { - // Desired payload type in the response from the server. - // If response_type is RANDOM, server randomly chooses one from other formats. - PayloadType response_type = 1; - - // Desired payload size in the response from the server. - int32 response_size = 2; - - // Optional input payload sent along with the request. - Payload payload = 3; - - // Whether SimpleResponse should include username. - bool fill_username = 4; - - // Whether SimpleResponse should include OAuth scope. - bool fill_oauth_scope = 5; - - // Whether to request the server to compress the response. This field is - // "nullable" in order to interoperate seamlessly with clients not able to - // implement the full compression tests by introspecting the call to verify - // the response's compression status. - BoolValue response_compressed = 6; - - // Whether server should return a given status - EchoStatus response_status = 7; - - // Whether the server should expect this request to be compressed. - BoolValue expect_compressed = 8; - - // Whether SimpleResponse should include server_id. - bool fill_server_id = 9; - - // Whether SimpleResponse should include grpclb_route_type. - bool fill_grpclb_route_type = 10; -} - -// Unary response, as configured by the request. -message SimpleResponse { - // Payload to increase message size. - Payload payload = 1; - // The user the request came from, for verifying authentication was - // successful when the client expected it. - string username = 2; - // OAuth scope. - string oauth_scope = 3; - - // Server ID. This must be unique among different server instances, - // but the same across all RPC's made to a particular server instance. - string server_id = 4; - // gRPCLB Path. - GrpclbRouteType grpclb_route_type = 5; - - // Server hostname. - string hostname = 6; -} - -// Client-streaming request. -message StreamingInputCallRequest { - // Optional input payload sent along with the request. - Payload payload = 1; - - // Whether the server should expect this request to be compressed. This field - // is "nullable" in order to interoperate seamlessly with servers not able to - // implement the full compression tests by introspecting the call to verify - // the request's compression status. - BoolValue expect_compressed = 2; - - // Not expecting any payload from the response. -} - -// Client-streaming response. -message StreamingInputCallResponse { - // Aggregated size of payloads received from the client. - int32 aggregated_payload_size = 1; -} - -// Configuration for a particular response. -message ResponseParameters { - // Desired payload sizes in responses from the server. - int32 size = 1; - - // Desired interval between consecutive responses in the response stream in - // microseconds. - int32 interval_us = 2; - - // Whether to request the server to compress the response. This field is - // "nullable" in order to interoperate seamlessly with clients not able to - // implement the full compression tests by introspecting the call to verify - // the response's compression status. - BoolValue compressed = 3; -} - -// Server-streaming request. -message StreamingOutputCallRequest { - // Desired payload type in the response from the server. - // If response_type is RANDOM, the payload from each response in the stream - // might be of different types. This is to simulate a mixed type of payload - // stream. - PayloadType response_type = 1; - - // Configuration for each expected response message. - repeated ResponseParameters response_parameters = 2; - - // Optional input payload sent along with the request. - Payload payload = 3; - - // Whether server should return a given status - EchoStatus response_status = 7; -} - -// Server-streaming response, as configured by the request and parameters. -message StreamingOutputCallResponse { - // Payload to increase response size. - Payload payload = 1; -} - -// For reconnect interop test only. -// Client tells server what reconnection parameters it used. -message ReconnectParams { - int32 max_reconnect_backoff_ms = 1; -} - -// For reconnect interop test only. -// Server tells client whether its reconnects are following the spec and the -// reconnect backoffs it saw. -message ReconnectInfo { - bool passed = 1; - repeated int32 backoff_ms = 2; -} - -message LoadBalancerStatsRequest { - // Request stats for the next num_rpcs sent by client. - int32 num_rpcs = 1; - // If num_rpcs have not completed within timeout_sec, return partial results. - int32 timeout_sec = 2; -} - -message LoadBalancerStatsResponse { - message RpcsByPeer { - // The number of completed RPCs for each peer. - map rpcs_by_peer = 1; - } - // The number of completed RPCs for each peer. - map rpcs_by_peer = 1; - // The number of RPCs that failed to record a remote peer. - int32 num_failures = 2; - map rpcs_by_method = 3; -} - -// Request for retrieving a test client's accumulated stats. -message LoadBalancerAccumulatedStatsRequest {} - -// Accumulated stats for RPCs sent by a test client. -message LoadBalancerAccumulatedStatsResponse { - // The total number of RPCs have ever issued for each type. - // Deprecated: use stats_per_method.rpcs_started instead. - map num_rpcs_started_by_method = 1 [deprecated = true]; - // The total number of RPCs have ever completed successfully for each type. - // Deprecated: use stats_per_method.result instead. - map num_rpcs_succeeded_by_method = 2 [deprecated = true]; - // The total number of RPCs have ever failed for each type. - // Deprecated: use stats_per_method.result instead. - map num_rpcs_failed_by_method = 3 [deprecated = true]; - - message MethodStats { - // The number of RPCs that were started for this method. - int32 rpcs_started = 1; - - // The number of RPCs that completed with each status for this method. The - // key is the integral value of a google.rpc.Code; the value is the count. - map result = 2; - } - - // Per-method RPC statistics. The key is the RpcType in string form; e.g. - // 'EMPTY_CALL' or 'UNARY_CALL' - map stats_per_method = 4; -} - -// Configurations for a test client. -message ClientConfigureRequest { - // Type of RPCs to send. - enum RpcType { - EMPTY_CALL = 0; - UNARY_CALL = 1; - } - - // Metadata to be attached for the given type of RPCs. - message Metadata { - RpcType type = 1; - string key = 2; - string value = 3; - } - - // The types of RPCs the client sends. - repeated RpcType types = 1; - // The collection of custom metadata to be attached to RPCs sent by the client. - repeated Metadata metadata = 2; - // The deadline to use, in seconds, for all RPCs. If unset or zero, the - // client will use the default from the command-line. - int32 timeout_sec = 3; -} - -// Response for updating a test client's configuration. -message ClientConfigureResponse {} - -message ErrorDetail { - string reason = 1; - string domain = 2; -} - -message ErrorStatus { - int32 code = 1; - string message = 2; - repeated google.protobuf.Any details = 3; -} diff --git a/Tests/ConnectLibraryTests/proto/grpc/testing/test.proto b/Tests/ConnectLibraryTests/proto/grpc/testing/test.proto deleted file mode 100644 index 038d28f8..00000000 --- a/Tests/ConnectLibraryTests/proto/grpc/testing/test.proto +++ /dev/null @@ -1,122 +0,0 @@ -// This is copied from gRPC's testing Protobuf definitions: https://github.com/grpc/grpc/blob/master/src/proto/grpc/testing/test.proto -// -// The TestService has been extended to include the following RPCs: -// FailUnaryCall(SimpleRequest) returns (SimpleResponse): this RPC is a unary -// call that always returns a readable non-ASCII error with error details. -// FailStreamingOutputCall(StreamingOutputCallRequest) returns (stream StreamingOutputCallResponse): -// this RPC is a server streaming call that always returns a readable non-ASCII error with error details. -// UnimplementedStreamingOutputCall(grpc.testing.Empty) returns (stream grpc.testing.Empty): this RPC -// is a server streaming call that will not be implemented. -// -// The UnimplementedService has been extended to include the following RPCs: -// UnimplementedStreamingOutputCall(grpc.testing.Empty) returns (stream grpc.testing.Empty): this RPC -// is a server streaming call that will not be implemented. - -// Copyright 2015-2016 gRPC authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// An integration test service that covers all the method signature permutations -// of unary/streaming requests/responses. - -syntax = "proto3"; - -package grpc.testing; - -import "grpc/testing/empty.proto"; -import "grpc/testing/messages.proto"; - -// A simple service to test the various types of RPCs and experiment with -// performance with various types of payload. -service TestService { - // One empty request followed by one empty response. - rpc EmptyCall(grpc.testing.Empty) returns (grpc.testing.Empty); - - // One request followed by one response. - rpc UnaryCall(SimpleRequest) returns (SimpleResponse); - - // One request followed by one response. This RPC always fails. - rpc FailUnaryCall(SimpleRequest) returns (SimpleResponse); - - // One request followed by one response. Response has cache control - // headers set such that a caching HTTP proxy (such as GFE) can - // satisfy subsequent requests. - rpc CacheableUnaryCall(SimpleRequest) returns (SimpleResponse); - - // One request followed by a sequence of responses (streamed download). - // The server returns the payload with client desired type and sizes. - rpc StreamingOutputCall(StreamingOutputCallRequest) returns (stream StreamingOutputCallResponse); - - // One request followed by a sequence of responses (streamed download). This RPC always fails. - rpc FailStreamingOutputCall(StreamingOutputCallRequest) returns (stream StreamingOutputCallResponse); - - // A sequence of requests followed by one response (streamed upload). - // The server returns the aggregated size of client payload as the result. - rpc StreamingInputCall(stream StreamingInputCallRequest) returns (StreamingInputCallResponse); - - // A sequence of requests with each request served by the server immediately. - // As one request could lead to multiple responses, this interface - // demonstrates the idea of full duplexing. - rpc FullDuplexCall(stream StreamingOutputCallRequest) returns (stream StreamingOutputCallResponse); - - // A sequence of requests followed by a sequence of responses. - // The server buffers all the client requests and then serves them in order. A - // stream of responses are returned to the client when the server starts with - // first request. - rpc HalfDuplexCall(stream StreamingOutputCallRequest) returns (stream StreamingOutputCallResponse); - - // The test server will not implement this method. It will be used - // to test the behavior when clients call unimplemented methods. - rpc UnimplementedCall(grpc.testing.Empty) returns (grpc.testing.Empty); - - // The test server will not implement this method. It will be used - // to test the behavior when clients call unimplemented streaming output methods. - rpc UnimplementedStreamingOutputCall(grpc.testing.Empty) returns (stream grpc.testing.Empty); -} - -// A simple service NOT implemented at servers so clients can test for -// that case. -service UnimplementedService { - // A call that no server should implement - rpc UnimplementedCall(grpc.testing.Empty) returns (grpc.testing.Empty); - - // A call that no server should implement - rpc UnimplementedStreamingOutputCall(grpc.testing.Empty) returns (stream grpc.testing.Empty); -} - -// A service used to control reconnect server. -service ReconnectService { - rpc Start(grpc.testing.ReconnectParams) returns (grpc.testing.Empty); - rpc Stop(grpc.testing.Empty) returns (grpc.testing.ReconnectInfo); -} - -// A service used to obtain stats for verifying LB behavior. -service LoadBalancerStatsService { - // Gets the backend distribution for RPCs sent by a test client. - rpc GetClientStats(LoadBalancerStatsRequest) returns (LoadBalancerStatsResponse) {} - - // Gets the accumulated stats for RPCs sent by a test client. - rpc GetClientAccumulatedStats(LoadBalancerAccumulatedStatsRequest) returns (LoadBalancerAccumulatedStatsResponse) {} -} - -// A service to remotely control health status of an xDS test server. -service XdsUpdateHealthService { - rpc SetServing(grpc.testing.Empty) returns (grpc.testing.Empty); - rpc SetNotServing(grpc.testing.Empty) returns (grpc.testing.Empty); -} - -// A service to dynamically update the configuration of an xDS test client. -service XdsUpdateClientConfigureService { - // Update the tes client's configuration. - rpc Configure(ClientConfigureRequest) returns (ClientConfigureResponse); -} diff --git a/Tests/ConnectLibraryTests/proto/server/v1/server.proto b/Tests/ConnectLibraryTests/proto/server/v1/server.proto deleted file mode 100644 index 0367e1d0..00000000 --- a/Tests/ConnectLibraryTests/proto/server/v1/server.proto +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2022-2023 Buf Technologies, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package server.v1; - -// ServerMetadata is the metadata returned from the server started by the server binary. -message ServerMetadata { - string host = 1; - repeated ProtocolSupport protocols = 2; -} - -enum Protocol { - PROTOCOL_UNSPECIFIED = 0; - PROTOCOL_GRPC = 1; - PROTOCOL_GRPC_WEB = 2; -} - -message ProtocolSupport { - Protocol protocol = 1; - repeated HTTPVersion http_versions = 2; - string port = 3; -} - -message HTTPVersion { - int32 major = 1; - int32 minor = 2; -} From 677204bdd3a3d48643388276e4e6ec51887324da Mon Sep 17 00:00:00 2001 From: Steve Ayers Date: Wed, 6 Sep 2023 13:09:11 -0400 Subject: [PATCH 3/9] Lint and tests --- .../AsyncAwaitConformance.swift | 16 +++++++++++----- .../ConnectConformance/CallbackConformance.swift | 13 +++++++------ .../ConnectMocksTests/ConnectMocksTests.swift | 13 +++++++++---- .../ConnectTests/ConnectErrorTests.swift | 8 ++++++-- .../ConnectTests/ServiceMetadataTests.swift | 16 ++++++++-------- 5 files changed, 41 insertions(+), 25 deletions(-) diff --git a/Tests/ConnectLibraryTests/ConnectConformance/AsyncAwaitConformance.swift b/Tests/ConnectLibraryTests/ConnectConformance/AsyncAwaitConformance.swift index 6def78f2..6f610df7 100644 --- a/Tests/ConnectLibraryTests/ConnectConformance/AsyncAwaitConformance.swift +++ b/Tests/ConnectLibraryTests/ConnectConformance/AsyncAwaitConformance.swift @@ -274,11 +274,13 @@ final class AsyncAwaitConformance: XCTestCase { func testUnimplementedMethod() async { await self.executeTestWithClients { client in - let response = await client.unimplementedCall(request: SwiftProtobuf.Google_Protobuf_Empty()) + let response = await client.unimplementedCall( + request: SwiftProtobuf.Google_Protobuf_Empty() + ) XCTAssertEqual(response.code, .unimplemented) XCTAssertEqual( response.error?.message, - "grpc.testing.TestService.UnimplementedCall is not implemented" + "connectrpc.conformance.v1.TestService.UnimplementedCall is not implemented" ) } } @@ -298,7 +300,7 @@ final class AsyncAwaitConformance: XCTestCase { XCTAssertEqual( (error as? ConnectError)?.message, """ - grpc.testing.TestService.UnimplementedStreamingOutputCall is not implemented + connectrpc.conformance.v1.TestService.UnimplementedStreamingOutputCall is not implemented """ ) expectation.fulfill() @@ -311,7 +313,9 @@ final class AsyncAwaitConformance: XCTestCase { func testUnimplementedService() async { await self.executeTestWithUnimplementedClients { client in - let response = await client.unimplementedCall(request: SwiftProtobuf.Google_Protobuf_Empty()) + let response = await client.unimplementedCall( + request: SwiftProtobuf.Google_Protobuf_Empty() + ) XCTAssertEqual(response.code, .unimplemented) XCTAssertNotNil(response.error) } @@ -346,7 +350,9 @@ final class AsyncAwaitConformance: XCTestCase { proto.reason = "soirée 🎉" proto.domain = "connect-conformance" } - let response = await client.failUnaryCall(request: Connectrpc_Conformance_V1_SimpleRequest()) + let response = await client.failUnaryCall( + request: Connectrpc_Conformance_V1_SimpleRequest() + ) XCTAssertEqual(response.error?.code, .resourceExhausted) XCTAssertEqual(response.error?.message, "soirée 🎉") XCTAssertEqual(response.error?.unpackedDetails(), [expectedErrorDetail]) diff --git a/Tests/ConnectLibraryTests/ConnectConformance/CallbackConformance.swift b/Tests/ConnectLibraryTests/ConnectConformance/CallbackConformance.swift index 3fbe4073..4e779e81 100644 --- a/Tests/ConnectLibraryTests/ConnectConformance/CallbackConformance.swift +++ b/Tests/ConnectLibraryTests/ConnectConformance/CallbackConformance.swift @@ -305,7 +305,7 @@ final class CallbackConformance: XCTestCase { XCTAssertEqual(response.code, .unimplemented) XCTAssertEqual( response.error?.message, - "grpc.testing.TestService.UnimplementedCall is not implemented" + "connectrpc.conformance.v1.TestService.UnimplementedCall is not implemented" ) expectation.fulfill() } @@ -327,7 +327,7 @@ final class CallbackConformance: XCTestCase { XCTAssertEqual( (error as? ConnectError)?.message, """ - grpc.testing.TestService.UnimplementedStreamingOutputCall is not implemented + connectrpc.conformance.v1.TestService.UnimplementedStreamingOutputCall is not implemented """ ) expectation.fulfill() @@ -439,10 +439,11 @@ final class CallbackConformance: XCTestCase { func testCancelingUnary() { self.executeTestWithClients { client in let expectation = self.expectation(description: "Receives canceled response") - let cancelable = client.emptyCall(request: SwiftProtobuf.Google_Protobuf_Empty()) { response in - XCTAssertEqual(response.code, .canceled) - XCTAssertEqual(response.error?.code, .canceled) - expectation.fulfill() + let cancelable = client.emptyCall( + request: SwiftProtobuf.Google_Protobuf_Empty()) { response in + XCTAssertEqual(response.code, .canceled) + XCTAssertEqual(response.error?.code, .canceled) + expectation.fulfill() } cancelable.cancel() XCTAssertEqual(XCTWaiter().wait(for: [expectation], timeout: kTimeout), .completed) diff --git a/Tests/ConnectLibraryTests/ConnectMocksTests/ConnectMocksTests.swift b/Tests/ConnectLibraryTests/ConnectMocksTests/ConnectMocksTests.swift index 864cb4c3..b2605045 100644 --- a/Tests/ConnectLibraryTests/ConnectMocksTests/ConnectMocksTests.swift +++ b/Tests/ConnectLibraryTests/ConnectMocksTests/ConnectMocksTests.swift @@ -55,7 +55,8 @@ final class ConnectMocksTests: XCTestCase { .with { $0.responseParameters = [.with { $0.size = 123 }] }, .with { $0.responseParameters = [.with { $0.size = 456 }] }, ] - let expectedResults: [StreamResult] = [ + let expectedResults: [StreamResult] = + [ .headers(["x-header": ["123"]]), .message(.with { $0.payload.body = Data(repeating: 0, count: 123) }), .message(.with { $0.payload.body = Data(repeating: 0, count: 456) }), @@ -69,7 +70,9 @@ final class ConnectMocksTests: XCTestCase { client.mockFullDuplexCall.onClose = { closeCalled = true } client.mockFullDuplexCall.outputs = Array(expectedResults) - var receivedResults = [StreamResult]() + var receivedResults = [ + StreamResult + ]() let stream = client.fullDuplexCall { receivedResults.append($0) } try stream.send(expectedInputs[0]) try stream.send(expectedInputs[1]) @@ -88,7 +91,8 @@ final class ConnectMocksTests: XCTestCase { .with { $0.responseParameters = [.with { $0.size = 123 }] }, .with { $0.responseParameters = [.with { $0.size = 456 }] }, ] - var expectedResults: [StreamResult] = [ + var expectedResults: [StreamResult] = + [ .headers(["x-header": ["123"]]), .message(.with { $0.payload.body = Data(repeating: 0, count: 123) }), .message(.with { $0.payload.body = Data(repeating: 0, count: 456) }), @@ -148,7 +152,8 @@ final class ConnectMocksTests: XCTestCase { let expectedInput = Connectrpc_Conformance_V1_StreamingOutputCallRequest.with { request in request.responseParameters = [.with { $0.size = 123 }] } - var expectedResults: [StreamResult] = [ + var expectedResults: [StreamResult] = + [ .headers(["x-header": ["123"]]), .message(.with { $0.payload.body = Data(repeating: 0, count: 123) }), .message(.with { $0.payload.body = Data(repeating: 0, count: 456) }), diff --git a/Tests/ConnectLibraryTests/ConnectTests/ConnectErrorTests.swift b/Tests/ConnectLibraryTests/ConnectTests/ConnectErrorTests.swift index 8343c97e..d6dc7a47 100644 --- a/Tests/ConnectLibraryTests/ConnectTests/ConnectErrorTests.swift +++ b/Tests/ConnectLibraryTests/ConnectTests/ConnectErrorTests.swift @@ -19,7 +19,9 @@ import XCTest final class ConnectErrorTests: XCTestCase { func testDeserializingFullErrorAndUnpackingDetails() throws { - let expectedDetails = Connectrpc_Conformance_V1_SimpleResponse.with { $0.hostname = "foobar" } + let expectedDetails = Connectrpc_Conformance_V1_SimpleResponse.with { + $0.hostname = "foobar" + } let errorData = try self.errorData(expectedDetails: [expectedDetails]) let error = try JSONDecoder().decode(ConnectError.self, from: errorData) XCTAssertEqual(error.code, .unavailable) @@ -44,7 +46,9 @@ final class ConnectErrorTests: XCTestCase { } func testDeserializingErrorUsingHelperFunctionLowercasesHeaderKeys() throws { - let expectedDetails = Connectrpc_Conformance_V1_SimpleResponse.with { $0.hostname = "foobar" } + let expectedDetails = Connectrpc_Conformance_V1_SimpleResponse.with { + $0.hostname = "foobar" + } let errorData = try self.errorData(expectedDetails: [expectedDetails]) let error = ConnectError.from( code: .aborted, diff --git a/Tests/ConnectLibraryTests/ConnectTests/ServiceMetadataTests.swift b/Tests/ConnectLibraryTests/ConnectTests/ServiceMetadataTests.swift index 2a63436a..c6955d8e 100644 --- a/Tests/ConnectLibraryTests/ConnectTests/ServiceMetadataTests.swift +++ b/Tests/ConnectLibraryTests/ConnectTests/ServiceMetadataTests.swift @@ -21,49 +21,49 @@ final class ServiceMetadataTests: XCTestCase { Connectrpc_Conformance_V1_TestServiceClient.Metadata.Methods.unaryCall, MethodSpec( name: "UnaryCall", - service: "grpc.testing.TestService", + service: "connectrpc.conformance.v1.TestService", type: .unary ) ) XCTAssertEqual( Connectrpc_Conformance_V1_TestServiceClient.Metadata.Methods.unaryCall.path, - "grpc.testing.TestService/UnaryCall" + "connectrpc.conformance.v1.TestService/UnaryCall" ) XCTAssertEqual( Connectrpc_Conformance_V1_TestServiceClient.Metadata.Methods.streamingOutputCall, MethodSpec( name: "StreamingOutputCall", - service: "grpc.testing.TestService", + service: "connectrpc.conformance.v1.TestService", type: .serverStream ) ) XCTAssertEqual( Connectrpc_Conformance_V1_TestServiceClient.Metadata.Methods.streamingOutputCall.path, - "grpc.testing.TestService/StreamingOutputCall" + "connectrpc.conformance.v1.TestService/StreamingOutputCall" ) XCTAssertEqual( Connectrpc_Conformance_V1_TestServiceClient.Metadata.Methods.streamingInputCall, MethodSpec( name: "StreamingInputCall", - service: "grpc.testing.TestService", + service: "connectrpc.conformance.v1.TestService", type: .clientStream ) ) XCTAssertEqual( Connectrpc_Conformance_V1_TestServiceClient.Metadata.Methods.streamingInputCall.path, - "grpc.testing.TestService/StreamingInputCall" + "connectrpc.conformance.v1.TestService/StreamingInputCall" ) XCTAssertEqual( Connectrpc_Conformance_V1_TestServiceClient.Metadata.Methods.fullDuplexCall, MethodSpec( name: "FullDuplexCall", - service: "grpc.testing.TestService", + service: "connectrpc.conformance.v1.TestService", type: .bidirectionalStream ) ) XCTAssertEqual( Connectrpc_Conformance_V1_TestServiceClient.Metadata.Methods.fullDuplexCall.path, - "grpc.testing.TestService/FullDuplexCall" + "connectrpc.conformance.v1.TestService/FullDuplexCall" ) } } From 58593d0402ae3f90b9b0069bd7eee36da48ce85c Mon Sep 17 00:00:00 2001 From: Steve Ayers Date: Wed, 6 Sep 2023 14:15:21 -0400 Subject: [PATCH 4/9] Tests --- Makefile | 3 ++- .../ConnectConformance/AsyncAwaitConformance.swift | 4 ---- .../ConnectConformance/CallbackConformance.swift | 3 ++- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 5770d670..a2873e96 100644 --- a/Makefile +++ b/Makefile @@ -78,6 +78,7 @@ $(BIN)/license-headers: Makefile GOBIN=$(abspath $(BIN)) go install github.com/bufbuild/buf/private/pkg/licenseheader/cmd/license-header@$(LICENSE_HEADER_VERSION) .PHONY: test -test: conformanceserverrun ## Run all tests +test: + $(MAKE) conformanceserverrun swift test $(MAKE) conformanceserverstop diff --git a/Tests/ConnectLibraryTests/ConnectConformance/AsyncAwaitConformance.swift b/Tests/ConnectLibraryTests/ConnectConformance/AsyncAwaitConformance.swift index 6f610df7..11c9be44 100644 --- a/Tests/ConnectLibraryTests/ConnectConformance/AsyncAwaitConformance.swift +++ b/Tests/ConnectLibraryTests/ConnectConformance/AsyncAwaitConformance.swift @@ -105,7 +105,6 @@ final class AsyncAwaitConformance: XCTestCase { expectation.fulfill() } } - XCTAssertEqual(XCTWaiter().wait(for: [expectation], timeout: kTimeout), .completed) XCTAssertEqual(responseCount, 4) } @@ -306,7 +305,6 @@ final class AsyncAwaitConformance: XCTestCase { expectation.fulfill() } } - XCTAssertEqual(XCTWaiter().wait(for: [expectation], timeout: kTimeout), .completed) } } @@ -339,7 +337,6 @@ final class AsyncAwaitConformance: XCTestCase { expectation.fulfill() } } - XCTAssertEqual(XCTWaiter().wait(for: [expectation], timeout: kTimeout), .completed) } } @@ -397,7 +394,6 @@ final class AsyncAwaitConformance: XCTestCase { expectation.fulfill() } } - XCTAssertEqual(XCTWaiter().wait(for: [expectation], timeout: kTimeout), .completed) } } diff --git a/Tests/ConnectLibraryTests/ConnectConformance/CallbackConformance.swift b/Tests/ConnectLibraryTests/ConnectConformance/CallbackConformance.swift index 4e779e81..18668e38 100644 --- a/Tests/ConnectLibraryTests/ConnectConformance/CallbackConformance.swift +++ b/Tests/ConnectLibraryTests/ConnectConformance/CallbackConformance.swift @@ -327,7 +327,8 @@ final class CallbackConformance: XCTestCase { XCTAssertEqual( (error as? ConnectError)?.message, """ - connectrpc.conformance.v1.TestService.UnimplementedStreamingOutputCall is not implemented + connectrpc.conformance.v1.TestService.UnimplementedStreamingOutputCall is + not implemented """ ) expectation.fulfill() From fd427e7d8dc7bfc8c737a78b496e53e30b5e0b2d Mon Sep 17 00:00:00 2001 From: Michael Rebello Date: Wed, 6 Sep 2023 14:30:14 -0700 Subject: [PATCH 5/9] Update SwiftProtobuf to 1.23.0 (#160) This also pins the SwiftProtobuf plugins in `buf.gen.yaml` files so that they don't change from under CI when a new update is released upstream. --- .github/CONTRIBUTING.md | 2 ++ Connect-Swift-Mocks.podspec | 2 +- Connect-Swift.podspec | 2 +- Examples/ElizaCocoaPodsApp/Podfile.lock | 8 ++++---- .../xcshareddata/swiftpm/Package.resolved | 4 ++-- Examples/buf.gen.yaml | 2 +- Libraries/Connect/buf.gen.yaml | 2 +- Package.resolved | 4 ++-- Package.swift | 2 +- .../Generated/grpc/testing/messages.pb.swift | 6 +++--- .../Generated/server/v1/server.pb.swift | 2 +- Tests/ConnectLibraryTests/buf.gen.yaml | 2 +- 12 files changed, 20 insertions(+), 18 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 982e4277..676012f0 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -154,6 +154,8 @@ To update dependencies such as `SwiftProtobuf` in this repository: [`Connect-Swift-Mocks.podspec`](../Connect-Swift-Mocks.podspec) files. 4. Open the [Swift package example app](../Examples/ElizaSwiftPackageApp) to ensure its `Package.resolved` file gets updated. 5. Run `pod update` in the [CocoaPods example app's directory](../Examples/ElizaCocoaPodsApp). +6. Update remote plugin entries (such as `buf.build/apple/swift`) in all `buf.gen.yaml` files to be in sync with their respective runtime libraries. +7. Run `make generate` to apply any generated diffs from the newly updated plugins. ## Releasing diff --git a/Connect-Swift-Mocks.podspec b/Connect-Swift-Mocks.podspec index 30abab3d..d5f89a27 100644 --- a/Connect-Swift-Mocks.podspec +++ b/Connect-Swift-Mocks.podspec @@ -13,7 +13,7 @@ Pod::Spec.new do |spec| spec.tvos.deployment_target = '13.0' spec.dependency 'Connect-Swift', "#{spec.version.to_s}" - spec.dependency 'SwiftProtobuf', '~> 1.22.0' + spec.dependency 'SwiftProtobuf', '~> 1.23.0' spec.source_files = 'Libraries/ConnectMocks/**/*.swift' diff --git a/Connect-Swift.podspec b/Connect-Swift.podspec index 80011935..fd32be7d 100644 --- a/Connect-Swift.podspec +++ b/Connect-Swift.podspec @@ -12,7 +12,7 @@ Pod::Spec.new do |spec| spec.osx.deployment_target = '10.15' spec.tvos.deployment_target = '13.0' - spec.dependency 'SwiftProtobuf', '~> 1.22.0' + spec.dependency 'SwiftProtobuf', '~> 1.23.0' spec.source_files = 'Libraries/Connect/**/*.swift' diff --git a/Examples/ElizaCocoaPodsApp/Podfile.lock b/Examples/ElizaCocoaPodsApp/Podfile.lock index ac1ce56b..6fef236b 100644 --- a/Examples/ElizaCocoaPodsApp/Podfile.lock +++ b/Examples/ElizaCocoaPodsApp/Podfile.lock @@ -1,7 +1,7 @@ PODS: - Connect-Swift (0.6.0): - - SwiftProtobuf (~> 1.22.0) - - SwiftProtobuf (1.22.0) + - SwiftProtobuf (~> 1.23.0) + - SwiftProtobuf (1.23.0) DEPENDENCIES: - Connect-Swift (from `../..`) @@ -15,8 +15,8 @@ EXTERNAL SOURCES: :path: "../.." SPEC CHECKSUMS: - Connect-Swift: ba76bc64b2153cacce4f7985a21d4d81473dac90 - SwiftProtobuf: 40bd808372cb8706108f22d28f8ab4a6b9bc6989 + Connect-Swift: ca072ef1a95341460bcc08074fc5d46ecc055fb9 + SwiftProtobuf: b70d65f419fbfe61a2d58003456ca5da58e337d6 PODFILE CHECKSUM: b598f373a6ab5add976b09c2ac79029bf2200d48 diff --git a/Examples/ElizaSwiftPackageApp/ElizaSwiftPackageApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Examples/ElizaSwiftPackageApp/ElizaSwiftPackageApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 3787a2c3..eb2d8d76 100644 --- a/Examples/ElizaSwiftPackageApp/ElizaSwiftPackageApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Examples/ElizaSwiftPackageApp/ElizaSwiftPackageApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -50,8 +50,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-protobuf.git", "state" : { - "revision" : "f25867a208f459d3c5a06935dceb9083b11cd539", - "version" : "1.22.0" + "revision" : "cf62cdaea48b77f1a631e5cb3aeda6047c2cba1d", + "version" : "1.23.0" } } ], diff --git a/Examples/buf.gen.yaml b/Examples/buf.gen.yaml index f537384d..36284fe2 100644 --- a/Examples/buf.gen.yaml +++ b/Examples/buf.gen.yaml @@ -1,6 +1,6 @@ version: v1 plugins: - - plugin: buf.build/apple/swift + - plugin: buf.build/apple/swift:v1.23.0 opt: Visibility=Internal out: ./ElizaSharedSources/GeneratedSources - name: connect-swift diff --git a/Libraries/Connect/buf.gen.yaml b/Libraries/Connect/buf.gen.yaml index 9e0ad27d..7c994a5c 100644 --- a/Libraries/Connect/buf.gen.yaml +++ b/Libraries/Connect/buf.gen.yaml @@ -1,5 +1,5 @@ version: v1 plugins: - - plugin: buf.build/apple/swift + - plugin: buf.build/apple/swift:v1.23.0 opt: Visibility=Internal out: ./Implementation/Generated diff --git a/Package.resolved b/Package.resolved index 461d3f99..0d2ff5fc 100644 --- a/Package.resolved +++ b/Package.resolved @@ -50,8 +50,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-protobuf.git", "state" : { - "revision" : "f25867a208f459d3c5a06935dceb9083b11cd539", - "version" : "1.22.0" + "revision" : "cf62cdaea48b77f1a631e5cb3aeda6047c2cba1d", + "version" : "1.23.0" } } ], diff --git a/Package.swift b/Package.swift index f373803e..f7425026 100644 --- a/Package.swift +++ b/Package.swift @@ -60,7 +60,7 @@ let package = Package( ), .package( url: "https://github.com/apple/swift-protobuf.git", - from: "1.22.0" + from: "1.23.0" ), ], targets: [ diff --git a/Tests/ConnectLibraryTests/Generated/grpc/testing/messages.pb.swift b/Tests/ConnectLibraryTests/Generated/grpc/testing/messages.pb.swift index 2e6e0fb4..ccc3fd4e 100644 --- a/Tests/ConnectLibraryTests/Generated/grpc/testing/messages.pb.swift +++ b/Tests/ConnectLibraryTests/Generated/grpc/testing/messages.pb.swift @@ -70,7 +70,7 @@ enum Grpc_Testing_PayloadType: SwiftProtobuf.Enum { extension Grpc_Testing_PayloadType: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Grpc_Testing_PayloadType] = [ + static let allCases: [Grpc_Testing_PayloadType] = [ .compressable, ] } @@ -124,7 +124,7 @@ enum Grpc_Testing_GrpclbRouteType: SwiftProtobuf.Enum { extension Grpc_Testing_GrpclbRouteType: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Grpc_Testing_GrpclbRouteType] = [ + static let allCases: [Grpc_Testing_GrpclbRouteType] = [ .unknown, .fallback, .backend, @@ -654,7 +654,7 @@ struct Grpc_Testing_ClientConfigureRequest { extension Grpc_Testing_ClientConfigureRequest.RpcType: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Grpc_Testing_ClientConfigureRequest.RpcType] = [ + static let allCases: [Grpc_Testing_ClientConfigureRequest.RpcType] = [ .emptyCall, .unaryCall, ] diff --git a/Tests/ConnectLibraryTests/Generated/server/v1/server.pb.swift b/Tests/ConnectLibraryTests/Generated/server/v1/server.pb.swift index 2619cd94..408026de 100644 --- a/Tests/ConnectLibraryTests/Generated/server/v1/server.pb.swift +++ b/Tests/ConnectLibraryTests/Generated/server/v1/server.pb.swift @@ -69,7 +69,7 @@ enum Server_V1_Protocol: SwiftProtobuf.Enum { extension Server_V1_Protocol: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Server_V1_Protocol] = [ + static let allCases: [Server_V1_Protocol] = [ .unspecified, .grpc, .grpcWeb, diff --git a/Tests/ConnectLibraryTests/buf.gen.yaml b/Tests/ConnectLibraryTests/buf.gen.yaml index 297b6ab0..a4f9eb92 100644 --- a/Tests/ConnectLibraryTests/buf.gen.yaml +++ b/Tests/ConnectLibraryTests/buf.gen.yaml @@ -1,6 +1,6 @@ version: v1 plugins: - - plugin: buf.build/apple/swift + - plugin: buf.build/apple/swift:v1.23.0 opt: Visibility=Internal out: ./Generated - name: connect-swift From 61b79789c5a3179c6cd06b62f41a22e91bceea87 Mon Sep 17 00:00:00 2001 From: Michael Rebello Date: Wed, 6 Sep 2023 15:31:16 -0700 Subject: [PATCH 6/9] Fix runtime warning with URLSession streaming on Xcode 15 beta (#159) Fixes https://github.com/bufbuild/connect-swift/issues/148. --- .../Implementation/Streaming/URLSessionStream.swift | 10 ++++++---- .../Connect/Implementation/URLSessionHTTPClient.swift | 9 +++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Libraries/Connect/Implementation/Streaming/URLSessionStream.swift b/Libraries/Connect/Implementation/Streaming/URLSessionStream.swift index 58642c1b..58f30d73 100644 --- a/Libraries/Connect/Implementation/Streaming/URLSessionStream.swift +++ b/Libraries/Connect/Implementation/Streaming/URLSessionStream.swift @@ -17,6 +17,7 @@ import Foundation /// Stream implementation that wraps a `URLSession` stream. final class URLSessionStream: NSObject { private var closedByServer = false + private let readStream: Foundation.InputStream private let responseCallbacks: ResponseCallbacks private let task: URLSessionUploadTask private let writeStream: Foundation.OutputStream @@ -26,6 +27,10 @@ final class URLSessionStream: NSObject { case unableToWriteData } + var requestBodyStream: Foundation.InputStream { + return self.readStream + } + var taskID: Int { return self.task.taskIdentifier } @@ -44,11 +49,8 @@ final class URLSessionStream: NSObject { ) self.responseCallbacks = responseCallbacks + self.readStream = readStream self.writeStream = writeStream - - var request = request - request.httpBodyStream = readStream - self.task = session.uploadTask(withStreamedRequest: request) super.init() diff --git a/Libraries/Connect/Implementation/URLSessionHTTPClient.swift b/Libraries/Connect/Implementation/URLSessionHTTPClient.swift index 7312eec6..e1f64c35 100644 --- a/Libraries/Connect/Implementation/URLSessionHTTPClient.swift +++ b/Libraries/Connect/Implementation/URLSessionHTTPClient.swift @@ -140,6 +140,15 @@ extension URLSessionHTTPClient: URLSessionDataDelegate { let stream = self.lock.perform { self.streams[dataTask.taskIdentifier] } stream?.handleResponseData(data) } + + open func urlSession( + _ session: URLSession, task: URLSessionTask, + needNewBodyStream completionHandler: @escaping (InputStream?) -> Void + ) { + completionHandler( + self.lock.perform { self.streams[task.taskIdentifier]?.requestBodyStream } + ) + } } extension URLSessionHTTPClient: URLSessionTaskDelegate { From 45ed447aca6414103339655a9b6ee9de48c4ee41 Mon Sep 17 00:00:00 2001 From: Steve Ayers Date: Thu, 7 Sep 2023 10:34:00 -0400 Subject: [PATCH 7/9] Fix ignores --- Package.swift | 2 -- 1 file changed, 2 deletions(-) diff --git a/Package.swift b/Package.swift index f373803e..bf55abfd 100644 --- a/Package.swift +++ b/Package.swift @@ -89,8 +89,6 @@ let package = Package( path: "Tests/ConnectLibraryTests", exclude: [ "buf.gen.yaml", - "buf.work.yaml", - "proto", ], resources: [ .copy("TestResources"), From 5383a512bbd73efcf4c1408c34b747d2117680e9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 7 Sep 2023 14:58:53 +0000 Subject: [PATCH 8/9] Bump bufbuild/buf-setup-action from 1.22.0 to 1.26.1 (#154) --- .github/workflows/ci.yaml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d353045a..1252dea5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -44,7 +44,7 @@ jobs: runs-on: macos-12 steps: - uses: actions/checkout@v3 - - uses: bufbuild/buf-setup-action@v1.22.0 + - uses: bufbuild/buf-setup-action@v1.26.1 with: github_token: ${{ github.token }} - name: Build plugins diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c789ad78..775bbd73 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,7 @@ jobs: runs-on: macos-12 steps: - uses: actions/checkout@v3 - - uses: bufbuild/buf-setup-action@v1.22.0 + - uses: bufbuild/buf-setup-action@v1.26.1 with: github_token: ${{ github.token }} - name: Build plugins From 06b34cdc1defc73eda2541eebd2a9bbe7da338c3 Mon Sep 17 00:00:00 2001 From: Steve Ayers Date: Thu, 7 Sep 2023 11:14:54 -0400 Subject: [PATCH 9/9] Latest --- Makefile | 2 +- .../AsyncAwaitConformance.swift | 31 ++++++++++--------- .../CallbackConformance.swift | 2 +- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index a2873e96..5120cd5e 100644 --- a/Makefile +++ b/Makefile @@ -78,7 +78,7 @@ $(BIN)/license-headers: Makefile GOBIN=$(abspath $(BIN)) go install github.com/bufbuild/buf/private/pkg/licenseheader/cmd/license-header@$(LICENSE_HEADER_VERSION) .PHONY: test -test: +test: conformanceserverrun ## Run all tests $(MAKE) conformanceserverrun swift test $(MAKE) conformanceserverstop diff --git a/Tests/ConnectLibraryTests/ConnectConformance/AsyncAwaitConformance.swift b/Tests/ConnectLibraryTests/ConnectConformance/AsyncAwaitConformance.swift index 11c9be44..7313f3c0 100644 --- a/Tests/ConnectLibraryTests/ConnectConformance/AsyncAwaitConformance.swift +++ b/Tests/ConnectLibraryTests/ConnectConformance/AsyncAwaitConformance.swift @@ -299,7 +299,8 @@ final class AsyncAwaitConformance: XCTestCase { XCTAssertEqual( (error as? ConnectError)?.message, """ - connectrpc.conformance.v1.TestService.UnimplementedStreamingOutputCall is not implemented + connectrpc.conformance.v1.TestService.UnimplementedStreamingOutputCall is \ + not implemented """ ) expectation.fulfill() @@ -341,20 +342,20 @@ final class AsyncAwaitConformance: XCTestCase { } } - func testFailUnary() async { - await self.executeTestWithClients { client in - let expectedErrorDetail = Connectrpc_Conformance_V1_ErrorDetail.with { proto in - proto.reason = "soirée 🎉" - proto.domain = "connect-conformance" - } - let response = await client.failUnaryCall( - request: Connectrpc_Conformance_V1_SimpleRequest() - ) - XCTAssertEqual(response.error?.code, .resourceExhausted) - XCTAssertEqual(response.error?.message, "soirée 🎉") - XCTAssertEqual(response.error?.unpackedDetails(), [expectedErrorDetail]) - } - } + func testFailUnary() async { + await self.executeTestWithClients { client in + let expectedErrorDetail = Connectrpc_Conformance_V1_ErrorDetail.with { proto in + proto.reason = "soirée 🎉" + proto.domain = "connect-conformance" + } + let response = await client.failUnaryCall( + request: Connectrpc_Conformance_V1_SimpleRequest() + ) + XCTAssertEqual(response.error?.code, .resourceExhausted) + XCTAssertEqual(response.error?.message, "soirée 🎉") + XCTAssertEqual(response.error?.unpackedDetails(), [expectedErrorDetail]) + } + } func testFailServerStreaming() async throws { try await self.executeTestWithClients { client in diff --git a/Tests/ConnectLibraryTests/ConnectConformance/CallbackConformance.swift b/Tests/ConnectLibraryTests/ConnectConformance/CallbackConformance.swift index 18668e38..be3517cd 100644 --- a/Tests/ConnectLibraryTests/ConnectConformance/CallbackConformance.swift +++ b/Tests/ConnectLibraryTests/ConnectConformance/CallbackConformance.swift @@ -327,7 +327,7 @@ final class CallbackConformance: XCTestCase { XCTAssertEqual( (error as? ConnectError)?.message, """ - connectrpc.conformance.v1.TestService.UnimplementedStreamingOutputCall is + connectrpc.conformance.v1.TestService.UnimplementedStreamingOutputCall is \ not implemented """ )