Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update crosstest reference text #163

Merged
merged 5 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Outputted code will be available in the `out` directories specified by
## Running Tests

A test server is used to run
[crosstests](../Tests/ConnectLibraryTests/ConnectCrosstests) -
[conformance](../Tests/ConnectLibraryTests/ConnectConformance) -
integration tests which validate the behavior of the `Connect` library with
various protocols. **Starting the server requires Docker,
so ensure that you have Docker installed before proceeding.**
Expand All @@ -96,7 +96,7 @@ make test
If you prefer to run the tests using Xcode, you can manually start the server:

```sh
make crosstestserverrun
make conformanceserverrun
```

## Linting
Expand Down
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ MAKEFLAGS += --no-builtin-rules
MAKEFLAGS += --no-print-directory
BIN := .tmp/bin
LICENSE_HEADER_YEAR_RANGE := 2022-2023
CROSSTEST_VERSION := 4f4e96d8fea3ed9473b90a964a5ba429e7ea5649
CONFORMANCE_VERSION := 4f4e96d8fea3ed9473b90a964a5ba429e7ea5649
LICENSE_HEADER_VERSION := v1.12.0
LICENSE_IGNORE := -e Package.swift \
-e $(BIN)\/ \
Expand Down Expand Up @@ -40,17 +40,17 @@ cleangenerated: ## Delete all generated outputs
rm -rf ./Libraries/Connect/Implementation/Generated/*
rm -rf ./Tests/ConnectLibraryTests/Generated/*

.PHONY: crosstestserverstop
crosstestserverstop: ## Stop the crosstest server
.PHONY: conformanceserverstop
conformanceserverstop: ## Stop the conformance server
-docker container stop serverconnect servergrpc

.PHONY: crosstestserverrun
crosstestserverrun: crosstestserverstop ## Start the crosstest server
.PHONY: conformanceserverrun
conformanceserverrun: conformanceserverstop ## Start the conformance server
docker run --rm --name serverconnect -p 8080:8080 -p 8081:8081 -d \
bufbuild/connect-crosstest:$(CROSSTEST_VERSION) \
bufbuild/connect-crosstest:$(CONFORMANCE_VERSION) \
/usr/local/bin/serverconnect --h1port "8080" --h2port "8081" --cert "cert/localhost.crt" --key "cert/localhost.key"
docker run --rm --name servergrpc -p 8083:8083 -d \
bufbuild/connect-crosstest:$(CROSSTEST_VERSION) \
bufbuild/connect-crosstest:$(CONFORMANCE_VERSION) \
/usr/local/bin/servergrpc --port "8083" --cert "cert/localhost.crt" --key "cert/localhost.key"

.PHONY: generate
Expand Down Expand Up @@ -78,6 +78,6 @@ $(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: crosstestserverrun ## Run all tests
test: conformanceserverrun ## Run all tests
swift test
$(MAKE) crosstestserverstop
$(MAKE) conformanceserverstop
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ for details.

- [connect-kotlin][connect-kotlin]: Idiomatic gRPC & Connect RPCs for Kotlin
- [connect-go][connect-go]: Go service stubs for servers
- [connect-web][connect-web]: TypeScript clients for web browsers
- [connect-es][connect-es]: Type-safe APIs with Protobuf and TypeScript
- [Buf Studio][buf-studio]: Web UI for ad-hoc RPCs
- [connect-crosstest][connect-crosstest]: Connect, gRPC, and gRPC-Web
- [connect-conformance][connect-conformance]: Connect, gRPC, and gRPC-Web
interoperability tests

## Status
Expand All @@ -171,11 +171,11 @@ Offered under the [Apache 2 license](./LICENSE).

[blog]: https://buf.build/blog/announcing-connect-swift
[buf-studio]: https://buf.build/studio
[connect-crosstest]: https://github.com/bufbuild/connect-crosstest
[connect-conformance]: https://github.com/connectrpc/conformance
[connect-go]: https://github.com/bufbuild/connect-go
[connect-kotlin]: https://github.com/bufbuild/connect-kotlin
[connect-protocol]: https://connectrpc.com/docs/protocol
[connect-web]: https://www.npmjs.com/package/@bufbuild/connect-web
[connect-es]: https://github.com/connectrpc/connect-es
[error-handling]: https://connectrpc.com/docs/swift/errors
[getting-started]: https://connectrpc.com/docs/swift/getting-started
[grpc-protocol]: https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ private typealias TestServiceClient = Grpc_Testing_TestServiceClient
private typealias UnimplementedServiceClient = Grpc_Testing_UnimplementedServiceClient

/// This test suite runs against multiple protocols and serialization formats.
/// Tests are based on https://github.com/bufbuild/connect-crosstest
/// Tests are based on https://github.com/connectrpc/conformance
///
/// Tests are written using async/await APIs.
@available(iOS 13, *)
final class AsyncAwaitCrosstests: XCTestCase {
final class AsyncAwaitConformance: XCTestCase {
private func executeTestWithClients(
function: Selector = #function,
timeout: TimeInterval = 60,
runTestsWithClient: (TestServiceClient) async throws -> Void
) async rethrows {
let configurations = CrosstestConfiguration.all(timeout: timeout)
let configurations = ConformanceConfiguration.all(timeout: timeout)
for configuration in configurations {
try await runTestsWithClient(TestServiceClient(client: configuration.protocolClient))
print("Ran \(function) with \(configuration.description)")
Expand All @@ -43,7 +43,7 @@ final class AsyncAwaitCrosstests: XCTestCase {
function: Selector = #function,
runTestsWithClient: (UnimplementedServiceClient) async throws -> Void
) async rethrows {
let configurations = CrosstestConfiguration.all(timeout: 60)
let configurations = ConformanceConfiguration.all(timeout: 60)
for configuration in configurations {
try await runTestsWithClient(
UnimplementedServiceClient(client: configuration.protocolClient)
Expand All @@ -52,7 +52,7 @@ final class AsyncAwaitCrosstests: XCTestCase {
}
}

// MARK: - Crosstest cases
// MARK: - Conformance cases

func testEmptyUnary() async {
await self.executeTestWithClients { client in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ private typealias TestServiceClient = Grpc_Testing_TestServiceClient
private typealias UnimplementedServiceClient = Grpc_Testing_UnimplementedServiceClient

/// This test suite runs against multiple protocols and serialization formats.
/// Tests are based on https://github.com/bufbuild/connect-crosstest
/// Tests are based on https://github.com/connectrpc/conformance
///
/// Tests are written using callback APIs.
final class CallbackCrosstests: XCTestCase {
final class CallbackConformance: XCTestCase {
private func executeTestWithClients(
function: Selector = #function,
timeout: TimeInterval = 60,
runTestsWithClient: (TestServiceClient) throws -> Void
) rethrows {
let configurations = CrosstestConfiguration.all(timeout: timeout)
let configurations = ConformanceConfiguration.all(timeout: timeout)
for configuration in configurations {
try runTestsWithClient(TestServiceClient(client: configuration.protocolClient))
print("Ran \(function) with \(configuration.description)")
Expand All @@ -44,14 +44,14 @@ final class CallbackCrosstests: XCTestCase {
function: Selector = #function,
runTestsWithClient: (UnimplementedServiceClient) throws -> Void
) rethrows {
let configurations = CrosstestConfiguration.all(timeout: 60)
let configurations = ConformanceConfiguration.all(timeout: 60)
for configuration in configurations {
try runTestsWithClient(UnimplementedServiceClient(client: configuration.protocolClient))
print("Ran \(function) with \(configuration.description)")
}
}

// MARK: - Crosstest cases
// MARK: - Conformance cases

func testEmptyUnary() {
self.executeTestWithClients { client in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import Connect
import ConnectNIO
import Foundation

/// Represents a specific configuration with which to run a suite of crosstests.
final class CrosstestConfiguration {
/// Represents a specific configuration with which to run a suite of conformance tests.
final class ConformanceConfiguration {
let description: String
let protocolClient: ProtocolClient

Expand All @@ -27,14 +27,14 @@ final class CrosstestConfiguration {
}

/// Configures a list of configurations that can be used to run a comprehensive
/// suite of crosstests.
/// suite of conformance tests.
///
/// - parameter timeout: Timeout to apply to the client.
///
/// - returns: A list of configurations to use for crosstests.
static func all(timeout: TimeInterval) -> [CrosstestConfiguration] {
let urlSessionClient = CrosstestURLSessionHTTPClient(timeout: timeout)
let nioClient = CrosstestNIOHTTPClient(
/// - returns: A list of configurations to use for conformance tests.
static func all(timeout: TimeInterval) -> [ConformanceConfiguration] {
let urlSessionClient = ConformanceURLSessionHTTPClient(timeout: timeout)
let nioClient = ConformanceNIOHTTPClient(
// swiftlint:disable:next number_separator
host: "https://localhost", port: 8081, timeout: timeout
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import ConnectNIO
import Foundation
import NIOSSL

/// HTTP client backed by NIO and used by crosstests in order to handle SSL challenges
/// with the crosstest server.
final class CrosstestNIOHTTPClient: ConnectNIO.NIOHTTPClient {
/// HTTP client backed by NIO and used by conformance tests in order to handle SSL challenges
/// with the conformance server.
final class ConformanceNIOHTTPClient: ConnectNIO.NIOHTTPClient {
init(host: String, port: Int, timeout: TimeInterval) {
super.init(host: host, port: port, timeout: timeout)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
import Connect
import Foundation

/// HTTP client backed by URLSession and used by crosstests in order to handle SSL challenges
/// with the crosstest server.
final class CrosstestURLSessionHTTPClient: URLSessionHTTPClient {
/// HTTP client backed by URLSession and used by conformance tests in order to handle SSL challenges
/// with the conformance server.
final class ConformanceURLSessionHTTPClient: URLSessionHTTPClient {
init(timeout: TimeInterval) {
let configuration = URLSessionConfiguration.default
configuration.timeoutIntervalForRequest = timeout
Expand All @@ -29,7 +29,7 @@ final class CrosstestURLSessionHTTPClient: URLSessionHTTPClient {
_ session: URLSession, didReceive challenge: URLAuthenticationChallenge,
completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void
) {
// This codepath is executed when using HTTPS with the crosstest server.
// This codepath is executed when using HTTPS with the conformance server.
let protectionSpace = challenge.protectionSpace
if protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust,
let serverTrust = protectionSpace.serverTrust
Expand Down
2 changes: 1 addition & 1 deletion Tests/ConnectLibraryTests/proto/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
This directory contains `.proto` files that are used to communicate
with the crosstest server when running tests.
with the conformance server when running tests.
Loading