diff --git a/.github/workflows/api-breakage.yml b/.github/workflows/api-breakage.yml index dd4bcb408..8177fbd24 100644 --- a/.github/workflows/api-breakage.yml +++ b/.github/workflows/api-breakage.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 15 container: - image: swift:5.9 + image: swift:5.10 steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 443480946..b316072a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: timeout-minutes: 15 strategy: matrix: - image: ["swift:5.9", "swift:5.10", "swiftlang/swift:nightly-jammy"] + image: ["swift:5.9", "swift:5.10", "swiftlang/swift:nightly-6.0-jammy"] container: image: ${{ matrix.image }} diff --git a/Sources/HummingbirdTesting/ApplicationTester.swift b/Sources/HummingbirdTesting/ApplicationTester.swift index 2abc2cd6e..2678edf0e 100644 --- a/Sources/HummingbirdTesting/ApplicationTester.swift +++ b/Sources/HummingbirdTesting/ApplicationTester.swift @@ -61,6 +61,8 @@ public protocol TestClientProtocol: Sendable { headers: HTTPFields, body: ByteBuffer? ) async throws -> TestResponse + // Port to connect to if test client is connecting to a live server + var port: Int? { get } } extension TestClientProtocol { diff --git a/Sources/HummingbirdTesting/AsyncHTTPClientTestFramework.swift b/Sources/HummingbirdTesting/AsyncHTTPClientTestFramework.swift index 2c891edb8..2b214406a 100644 --- a/Sources/HummingbirdTesting/AsyncHTTPClientTestFramework.swift +++ b/Sources/HummingbirdTesting/AsyncHTTPClientTestFramework.swift @@ -29,6 +29,7 @@ final class AsyncHTTPClientTestFramework: ApplicationT struct Client: TestClientProtocol { let client: HTTPClient let urlPrefix: String + let port: Int? let timeout: TimeAmount /// Send request and call test callback on the response returned @@ -75,7 +76,7 @@ final class AsyncHTTPClientTestFramework: ApplicationT eventLoopGroupProvider: .singleton, configuration: .init(tlsConfiguration: tlsConfiguration) ) - let client = Client(client: httpClient, urlPrefix: "\(self.scheme)://localhost:\(port)", timeout: self.timeout) + let client = Client(client: httpClient, urlPrefix: "\(self.scheme)://localhost:\(port)", port: port, timeout: self.timeout) do { let value = try await test(client) await serviceGroup.triggerGracefulShutdown() diff --git a/Sources/HummingbirdTesting/LiveTestFramework.swift b/Sources/HummingbirdTesting/LiveTestFramework.swift index b21aa2462..a0d80acef 100644 --- a/Sources/HummingbirdTesting/LiveTestFramework.swift +++ b/Sources/HummingbirdTesting/LiveTestFramework.swift @@ -40,6 +40,8 @@ final class LiveTestFramework: ApplicationTestFramewor let response = try await client.execute(request) return .init(head: response.head, body: response.body ?? ByteBuffer(), trailerHeaders: response.trailerHeaders) } + + var port: Int? { self.client.port } } init(app: App) { diff --git a/Sources/HummingbirdTesting/RouterTestFramework.swift b/Sources/HummingbirdTesting/RouterTestFramework.swift index 5f39f70e3..2e40a88b4 100644 --- a/Sources/HummingbirdTesting/RouterTestFramework.swift +++ b/Sources/HummingbirdTesting/RouterTestFramework.swift @@ -133,6 +133,8 @@ struct RouterTestFramework: ApplicationTestFramework w return try await group.next()! } } + + var port: Int? { nil } } final class RouterResponseWriter: ResponseBodyWriter {