From ad5c428966d298fbcd73a6f1b619ad5bf2948385 Mon Sep 17 00:00:00 2001 From: Sebastien Stormacq Date: Mon, 1 Sep 2025 21:56:16 +0200 Subject: [PATCH 1/8] add support for LOCAL_LAMBDA_PORT --- .../AWSLambdaRuntime/Lambda+LocalServer.swift | 5 +- Sources/AWSLambdaRuntime/LambdaRuntime.swift | 7 +- .../LambdaLocalServerTests.swift | 95 +++++++++++++++++++ readme.md | 12 +++ 4 files changed, 117 insertions(+), 2 deletions(-) create mode 100644 Tests/AWSLambdaRuntimeTests/LambdaLocalServerTests.swift diff --git a/Sources/AWSLambdaRuntime/Lambda+LocalServer.swift b/Sources/AWSLambdaRuntime/Lambda+LocalServer.swift index 322bce1a..0d4f4264 100644 --- a/Sources/AWSLambdaRuntime/Lambda+LocalServer.swift +++ b/Sources/AWSLambdaRuntime/Lambda+LocalServer.swift @@ -42,18 +42,21 @@ extension Lambda { /// /// - parameters: /// - invocationEndpoint: The endpoint to post events to. + /// - port: the TCP port to listen to /// - body: Code to run within the context of the mock server. Typically this would be a Lambda.run function call. /// /// - note: This API is designed strictly for local testing and is behind a DEBUG flag @usableFromInline static func withLocalServer( invocationEndpoint: String? = nil, + port: Int, logger: Logger, _ body: sending @escaping () async throws -> Void ) async throws { do { try await LambdaHTTPServer.withLocalServer( invocationEndpoint: invocationEndpoint, + port: port, logger: logger ) { try await body() @@ -112,7 +115,7 @@ internal struct LambdaHTTPServer { static func withLocalServer( invocationEndpoint: String?, host: String = "127.0.0.1", - port: Int = 7000, + port: Int, eventLoopGroup: MultiThreadedEventLoopGroup = .singleton, logger: Logger, _ closure: sending @escaping () async throws -> Result diff --git a/Sources/AWSLambdaRuntime/LambdaRuntime.swift b/Sources/AWSLambdaRuntime/LambdaRuntime.swift index a639ac31..35a8769f 100644 --- a/Sources/AWSLambdaRuntime/LambdaRuntime.swift +++ b/Sources/AWSLambdaRuntime/LambdaRuntime.swift @@ -122,15 +122,20 @@ public final class LambdaRuntime: Sendable where Handler: StreamingLamb } else { #if LocalServerSupport + // we're not running on Lambda and we're compiled in DEBUG mode, // let's start a local server for testing + + let port = Lambda.env("LOCAL_LAMBDA_PORT").flatMap(Int.init) ?? 7000 + try await Lambda.withLocalServer( invocationEndpoint: Lambda.env("LOCAL_LAMBDA_SERVER_INVOCATION_ENDPOINT"), + port: port, logger: self.logger ) { try await LambdaRuntimeClient.withRuntimeClient( - configuration: .init(ip: "127.0.0.1", port: 7000), + configuration: .init(ip: "127.0.0.1", port: port), eventLoop: self.eventLoop, logger: self.logger ) { runtimeClient in diff --git a/Tests/AWSLambdaRuntimeTests/LambdaLocalServerTests.swift b/Tests/AWSLambdaRuntimeTests/LambdaLocalServerTests.swift new file mode 100644 index 00000000..99aa151b --- /dev/null +++ b/Tests/AWSLambdaRuntimeTests/LambdaLocalServerTests.swift @@ -0,0 +1,95 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the SwiftAWSLambdaRuntime open source project +// +// Copyright (c) 2024 Apple Inc. and the SwiftAWSLambdaRuntime project authors +// Licensed under Apache License v2.0 +// +// See LICENSE.txt for license information +// See CONTRIBUTORS.txt for the list of SwiftAWSLambdaRuntime project authors +// +// SPDX-License-Identifier: Apache-2.0 +// +//===----------------------------------------------------------------------===// + +import Logging +import NIOCore +import NIOPosix +import Testing + +@testable import AWSLambdaRuntime + +@Suite("Lambda Local Server Tests") +struct LambdaLocalServerTests { + + @Test("Local server respects LOCAL_LAMBDA_PORT environment variable") + func testLocalServerCustomPort() async throws { + let customPort = 8080 + + // Set environment variable + setenv("LOCAL_LAMBDA_PORT", "\(customPort)", 1) + defer { unsetenv("LOCAL_LAMBDA_PORT") } + + let result = try? await withThrowingTaskGroup(of: Bool.self) { group in + + // start a local lambda + local server on custom port + group.addTask { + // Create a simple handler + struct TestHandler: StreamingLambdaHandler { + func handle( + _ event: ByteBuffer, + responseWriter: some LambdaResponseStreamWriter, + context: LambdaContext + ) async throws { + try await responseWriter.write(ByteBuffer(string: "test")) + try await responseWriter.finish() + } + } + + // create the Lambda Runtime + let runtime = LambdaRuntime( + handler: TestHandler(), + logger: Logger(label: "test", factory: { _ in SwiftLogNoOpLogHandler() }) + ) + + // Start runtime + try await runtime._run() + + // we reach this line when the group is cancelled + return false + } + + // start a client to check if tsomething responds on the custom port + group.addTask { + // Give server time to start + try await Task.sleep(for: .milliseconds(100)) + + // Verify server is listening on custom port + return try await isPortResponding(host: "127.0.0.1", port: customPort) + } + + let first = try await group.next() + group.cancelAll() + return first ?? false + + } + + #expect(result == true) + } + + private func isPortResponding(host: String, port: Int) async throws -> Bool { + let group = MultiThreadedEventLoopGroup(numberOfThreads: 1) + + let bootstrap = ClientBootstrap(group: group) + + do { + let channel = try await bootstrap.connect(host: host, port: port).get() + try await channel.close().get() + try await group.shutdownGracefully() + return true + } catch { + try await group.shutdownGracefully() + return false + } + } +} diff --git a/readme.md b/readme.md index 2366b53e..6dde916b 100644 --- a/readme.md +++ b/readme.md @@ -476,6 +476,18 @@ Example: LOCAL_LAMBDA_SERVER_INVOCATION_ENDPOINT=/2015-03-31/functions/function/invocations swift run ``` +## Modifying the local port + +By default, when using the local Lambda server, it listens on TCP port 7000. + +On macOS, this port might be used by AirPlay under some configurations. You can use the `LOCAL_LAMBDA_PORT` environment variable to configure the runtime to listen on a different TCP port. + +Example: + +```sh +LOCAL_LAMBDA_PORT=7777 swift run +``` + ## Deploying your Swift Lambda functions There is a full deployment guide available in [the documentation](https://swiftpackageindex.com/swift-server/swift-aws-lambda-runtime/main/documentation/awslambdaruntime/deployment). From 7defd27576ca77b9c01429a70275c8fb72b0542d Mon Sep 17 00:00:00 2001 From: Sebastien Stormacq Date: Mon, 1 Sep 2025 22:01:27 +0200 Subject: [PATCH 2/8] change (c) year --- Tests/AWSLambdaRuntimeTests/LambdaLocalServerTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/AWSLambdaRuntimeTests/LambdaLocalServerTests.swift b/Tests/AWSLambdaRuntimeTests/LambdaLocalServerTests.swift index 99aa151b..db96e75f 100644 --- a/Tests/AWSLambdaRuntimeTests/LambdaLocalServerTests.swift +++ b/Tests/AWSLambdaRuntimeTests/LambdaLocalServerTests.swift @@ -2,7 +2,7 @@ // // This source file is part of the SwiftAWSLambdaRuntime open source project // -// Copyright (c) 2024 Apple Inc. and the SwiftAWSLambdaRuntime project authors +// Copyright (c) 2025 Apple Inc. and the SwiftAWSLambdaRuntime project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information From fcd7951c777fbd32066a1babc611abe143b437b8 Mon Sep 17 00:00:00 2001 From: Sebastien Stormacq Date: Mon, 1 Sep 2025 22:10:14 +0200 Subject: [PATCH 3/8] fix typo --- Tests/AWSLambdaRuntimeTests/LambdaLocalServerTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/AWSLambdaRuntimeTests/LambdaLocalServerTests.swift b/Tests/AWSLambdaRuntimeTests/LambdaLocalServerTests.swift index db96e75f..d681457f 100644 --- a/Tests/AWSLambdaRuntimeTests/LambdaLocalServerTests.swift +++ b/Tests/AWSLambdaRuntimeTests/LambdaLocalServerTests.swift @@ -59,7 +59,7 @@ struct LambdaLocalServerTests { return false } - // start a client to check if tsomething responds on the custom port + // start a client to check if something responds on the custom port group.addTask { // Give server time to start try await Task.sleep(for: .milliseconds(100)) From 44a1258ac1473430de97e92653b92676b75ab0dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Stormacq?= Date: Tue, 2 Sep 2025 08:52:41 +0200 Subject: [PATCH 4/8] add an env variable for host to be consistent --- .../AWSLambdaRuntime/Lambda+LocalServer.swift | 17 ++++++++------ Sources/AWSLambdaRuntime/LambdaRuntime.swift | 9 +++++--- readme.md | 22 +++++++------------ 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Sources/AWSLambdaRuntime/Lambda+LocalServer.swift b/Sources/AWSLambdaRuntime/Lambda+LocalServer.swift index 0d4f4264..7e37a9bc 100644 --- a/Sources/AWSLambdaRuntime/Lambda+LocalServer.swift +++ b/Sources/AWSLambdaRuntime/Lambda+LocalServer.swift @@ -21,7 +21,7 @@ import NIOHTTP1 import NIOPosix import Synchronization -// This functionality is designed for local testing hence being a #if DEBUG flag. +// This functionality is designed for local testing when the LocalServerSupport trait is enabled. // For example: // try Lambda.withLocalServer { @@ -41,22 +41,25 @@ extension Lambda { /// Execute code in the context of a mock Lambda server. /// /// - parameters: - /// - invocationEndpoint: The endpoint to post events to. + /// - host: the hostname or IP address to listen on /// - port: the TCP port to listen to + /// - invocationEndpoint: The endpoint to post events to. /// - body: Code to run within the context of the mock server. Typically this would be a Lambda.run function call. /// - /// - note: This API is designed strictly for local testing and is behind a DEBUG flag + /// - note: This API is designed strictly for local testing when the LocalServerSupport trait is enabled. @usableFromInline static func withLocalServer( - invocationEndpoint: String? = nil, + host: String, port: Int, + invocationEndpoint: String? = nil, logger: Logger, _ body: sending @escaping () async throws -> Void ) async throws { do { try await LambdaHTTPServer.withLocalServer( - invocationEndpoint: invocationEndpoint, + host: host, port: port, + invocationEndpoint: invocationEndpoint, logger: logger ) { try await body() @@ -113,9 +116,9 @@ internal struct LambdaHTTPServer { } static func withLocalServer( - invocationEndpoint: String?, - host: String = "127.0.0.1", + host: String, port: Int, + invocationEndpoint: String?, eventLoopGroup: MultiThreadedEventLoopGroup = .singleton, logger: Logger, _ closure: sending @escaping () async throws -> Result diff --git a/Sources/AWSLambdaRuntime/LambdaRuntime.swift b/Sources/AWSLambdaRuntime/LambdaRuntime.swift index 35a8769f..8d5905c7 100644 --- a/Sources/AWSLambdaRuntime/LambdaRuntime.swift +++ b/Sources/AWSLambdaRuntime/LambdaRuntime.swift @@ -126,16 +126,19 @@ public final class LambdaRuntime: Sendable where Handler: StreamingLamb // we're not running on Lambda and we're compiled in DEBUG mode, // let's start a local server for testing + let host = Lambda.env("LOCAL_LAMBDA_HOST") ?? "127.0.0.1" let port = Lambda.env("LOCAL_LAMBDA_PORT").flatMap(Int.init) ?? 7000 + let endpoint = Lambda.env("LOCAL_LAMBDA_INVOCATION_ENDPOINT") try await Lambda.withLocalServer( - invocationEndpoint: Lambda.env("LOCAL_LAMBDA_SERVER_INVOCATION_ENDPOINT"), + host: host, port: port, + invocationEndpoint: endpoint, logger: self.logger ) { try await LambdaRuntimeClient.withRuntimeClient( - configuration: .init(ip: "127.0.0.1", port: port), + configuration: .init(ip: host, port: port), eventLoop: self.eventLoop, logger: self.logger ) { runtimeClient in @@ -147,7 +150,7 @@ public final class LambdaRuntime: Sendable where Handler: StreamingLamb } } #else - // in release mode, we can't start a local server because the local server code is not compiled. + // When the LocalServerSupport trait is disabled, we can't start a local server because the local server code is not compiled. throw LambdaRuntimeError(code: .missingLambdaRuntimeAPIEnvironmentVariable) #endif } diff --git a/readme.md b/readme.md index 6dde916b..75e17bcb 100644 --- a/readme.md +++ b/readme.md @@ -464,28 +464,22 @@ curl -v --header "Content-Type:\ application/json" --data @events/create-session * Connection #0 to host 127.0.0.1 left intact {"statusCode":200,"isBase64Encoded":false,"body":"...","headers":{"Access-Control-Allow-Origin":"*","Content-Type":"application\/json; charset=utf-8","Access-Control-Allow-Headers":"*"}} ``` -### Modifying the local endpoint +### Modifying the local server URI -By default, when using the local Lambda server, it listens on the `/invoke` endpoint. +By default, when using the local Lambda server during your tests, it listens on `http://127.0.0.1:7000/invoke`. -Some testing tools, such as the [AWS Lambda runtime interface emulator](https://docs.aws.amazon.com/lambda/latest/dg/images-test.html), require a different endpoint. In that case, you can use the `LOCAL_LAMBDA_SERVER_INVOCATION_ENDPOINT` environment variable to force the runtime to listen on a different endpoint. +Some testing tools, such as the [AWS Lambda runtime interface emulator](https://docs.aws.amazon.com/lambda/latest/dg/images-test.html), require a different endpoint, the port might be used, or you may want to bind a specific IP address. -Example: - -```sh -LOCAL_LAMBDA_SERVER_INVOCATION_ENDPOINT=/2015-03-31/functions/function/invocations swift run -``` - -## Modifying the local port - -By default, when using the local Lambda server, it listens on TCP port 7000. +In these cases, you can use three environment variables to control the local server: -On macOS, this port might be used by AirPlay under some configurations. You can use the `LOCAL_LAMBDA_PORT` environment variable to configure the runtime to listen on a different TCP port. +- Set `LOCAL_LAMBDA_HOST` to configure the local server to listen on a different TCP address. +- Set `LOCAL_LAMBDA_PORT` to configure the local server to listen on a different TCP port. +- Set `LOCAL_LAMBDA_INVOCATION_ENDPOINT` to force the local server to listen on a different endpoint. Example: ```sh -LOCAL_LAMBDA_PORT=7777 swift run +LOCAL_LAMBDA_PORT=8080 LOCAL_LAMBDA_INVOCATION_ENDPOINT=/2015-03-31/functions/function/invocations swift run ``` ## Deploying your Swift Lambda functions From c6c1f91bc6758cdd4c9d620f9d7db7dd43180182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Stormacq?= Date: Tue, 2 Sep 2025 10:35:33 +0200 Subject: [PATCH 5/8] Ensure all tests using the Runtime or RuntimeClient are serialized --- Tests/AWSLambdaRuntimeTests/LambdaLocalServerTests.swift | 2 +- Tests/AWSLambdaRuntimeTests/LambdaRunLoopTests.swift | 2 +- .../AWSLambdaRuntimeTests/LambdaRuntime+ServiceLifeCycle.swift | 2 +- Tests/AWSLambdaRuntimeTests/LambdaRuntimeClientTests.swift | 2 +- Tests/AWSLambdaRuntimeTests/LambdaRuntimeTests.swift | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Tests/AWSLambdaRuntimeTests/LambdaLocalServerTests.swift b/Tests/AWSLambdaRuntimeTests/LambdaLocalServerTests.swift index d681457f..a88b006f 100644 --- a/Tests/AWSLambdaRuntimeTests/LambdaLocalServerTests.swift +++ b/Tests/AWSLambdaRuntimeTests/LambdaLocalServerTests.swift @@ -19,7 +19,7 @@ import Testing @testable import AWSLambdaRuntime -@Suite("Lambda Local Server Tests") +@Suite("Lambda Local Server Tests", .serialized) struct LambdaLocalServerTests { @Test("Local server respects LOCAL_LAMBDA_PORT environment variable") diff --git a/Tests/AWSLambdaRuntimeTests/LambdaRunLoopTests.swift b/Tests/AWSLambdaRuntimeTests/LambdaRunLoopTests.swift index ec1c9265..43e7bce4 100644 --- a/Tests/AWSLambdaRuntimeTests/LambdaRunLoopTests.swift +++ b/Tests/AWSLambdaRuntimeTests/LambdaRunLoopTests.swift @@ -24,7 +24,7 @@ import FoundationEssentials import Foundation #endif -@Suite +@Suite(.serialized) struct LambdaRunLoopTests { struct MockEchoHandler: StreamingLambdaHandler { func handle( diff --git a/Tests/AWSLambdaRuntimeTests/LambdaRuntime+ServiceLifeCycle.swift b/Tests/AWSLambdaRuntimeTests/LambdaRuntime+ServiceLifeCycle.swift index 7103ea8d..651df44a 100644 --- a/Tests/AWSLambdaRuntimeTests/LambdaRuntime+ServiceLifeCycle.swift +++ b/Tests/AWSLambdaRuntimeTests/LambdaRuntime+ServiceLifeCycle.swift @@ -18,7 +18,7 @@ import ServiceLifecycle import Testing import Logging -@Suite +@Suite(.serialized) struct LambdaRuntimeServiceLifecycleTests { @Test func testLambdaRuntimeGracefulShutdown() async throws { diff --git a/Tests/AWSLambdaRuntimeTests/LambdaRuntimeClientTests.swift b/Tests/AWSLambdaRuntimeTests/LambdaRuntimeClientTests.swift index f10026f9..cf4624ad 100644 --- a/Tests/AWSLambdaRuntimeTests/LambdaRuntimeClientTests.swift +++ b/Tests/AWSLambdaRuntimeTests/LambdaRuntimeClientTests.swift @@ -22,7 +22,7 @@ import struct Foundation.UUID @testable import AWSLambdaRuntime -@Suite +@Suite(.serialized) struct LambdaRuntimeClientTests { let logger = { diff --git a/Tests/AWSLambdaRuntimeTests/LambdaRuntimeTests.swift b/Tests/AWSLambdaRuntimeTests/LambdaRuntimeTests.swift index 6c159dc8..c5c0051f 100644 --- a/Tests/AWSLambdaRuntimeTests/LambdaRuntimeTests.swift +++ b/Tests/AWSLambdaRuntimeTests/LambdaRuntimeTests.swift @@ -20,7 +20,7 @@ import Testing @testable import AWSLambdaRuntime -@Suite("LambdaRuntimeTests") +@Suite("LambdaRuntimeTests", .serialized) struct LambdaRuntimeTests { @Test("LambdaRuntime can only be run once") From c88eff0745c36161d2f594609fe90e4f68dd57cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Stormacq?= Date: Tue, 2 Sep 2025 14:29:33 +0200 Subject: [PATCH 6/8] set mock server on port 0 --- Tests/AWSLambdaRuntimeTests/MockLambdaServer.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/AWSLambdaRuntimeTests/MockLambdaServer.swift b/Tests/AWSLambdaRuntimeTests/MockLambdaServer.swift index d5ad8876..c2fdcb4c 100644 --- a/Tests/AWSLambdaRuntimeTests/MockLambdaServer.swift +++ b/Tests/AWSLambdaRuntimeTests/MockLambdaServer.swift @@ -60,7 +60,7 @@ final class MockLambdaServer { init( behavior: Behavior, host: String = "127.0.0.1", - port: Int = 7000, + port: Int = 0, keepAlive: Bool = true, eventLoopGroup: MultiThreadedEventLoopGroup ) { From 48b1571efb5ef1c3ccec8a6fcf0be988cbc5796d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Stormacq?= Date: Tue, 2 Sep 2025 14:29:49 +0200 Subject: [PATCH 7/8] remove .serialized when not needed --- Tests/AWSLambdaRuntimeTests/LambdaRunLoopTests.swift | 2 +- .../AWSLambdaRuntimeTests/LambdaRuntime+ServiceLifeCycle.swift | 2 +- Tests/AWSLambdaRuntimeTests/LambdaRuntimeClientTests.swift | 2 +- Tests/AWSLambdaRuntimeTests/LambdaRuntimeTests.swift | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Tests/AWSLambdaRuntimeTests/LambdaRunLoopTests.swift b/Tests/AWSLambdaRuntimeTests/LambdaRunLoopTests.swift index 43e7bce4..ec1c9265 100644 --- a/Tests/AWSLambdaRuntimeTests/LambdaRunLoopTests.swift +++ b/Tests/AWSLambdaRuntimeTests/LambdaRunLoopTests.swift @@ -24,7 +24,7 @@ import FoundationEssentials import Foundation #endif -@Suite(.serialized) +@Suite struct LambdaRunLoopTests { struct MockEchoHandler: StreamingLambdaHandler { func handle( diff --git a/Tests/AWSLambdaRuntimeTests/LambdaRuntime+ServiceLifeCycle.swift b/Tests/AWSLambdaRuntimeTests/LambdaRuntime+ServiceLifeCycle.swift index 651df44a..7103ea8d 100644 --- a/Tests/AWSLambdaRuntimeTests/LambdaRuntime+ServiceLifeCycle.swift +++ b/Tests/AWSLambdaRuntimeTests/LambdaRuntime+ServiceLifeCycle.swift @@ -18,7 +18,7 @@ import ServiceLifecycle import Testing import Logging -@Suite(.serialized) +@Suite struct LambdaRuntimeServiceLifecycleTests { @Test func testLambdaRuntimeGracefulShutdown() async throws { diff --git a/Tests/AWSLambdaRuntimeTests/LambdaRuntimeClientTests.swift b/Tests/AWSLambdaRuntimeTests/LambdaRuntimeClientTests.swift index cf4624ad..f10026f9 100644 --- a/Tests/AWSLambdaRuntimeTests/LambdaRuntimeClientTests.swift +++ b/Tests/AWSLambdaRuntimeTests/LambdaRuntimeClientTests.swift @@ -22,7 +22,7 @@ import struct Foundation.UUID @testable import AWSLambdaRuntime -@Suite(.serialized) +@Suite struct LambdaRuntimeClientTests { let logger = { diff --git a/Tests/AWSLambdaRuntimeTests/LambdaRuntimeTests.swift b/Tests/AWSLambdaRuntimeTests/LambdaRuntimeTests.swift index c5c0051f..daf79ed8 100644 --- a/Tests/AWSLambdaRuntimeTests/LambdaRuntimeTests.swift +++ b/Tests/AWSLambdaRuntimeTests/LambdaRuntimeTests.swift @@ -20,7 +20,7 @@ import Testing @testable import AWSLambdaRuntime -@Suite("LambdaRuntimeTests", .serialized) +@Suite struct LambdaRuntimeTests { @Test("LambdaRuntime can only be run once") From 2216a5cf9bd2a317832ebef29ce8f3bd99c73118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Stormacq?= Date: Wed, 3 Sep 2025 10:31:14 +0200 Subject: [PATCH 8/8] Group tests using `LambdaRuntime.run()` in teh same `.serialized` suite --- Tests/AWSLambdaRuntimeTests/LambdaLocalServerTests.swift | 3 +-- .../AWSLambdaRuntimeTests/LambdaRuntime+ServiceLifeCycle.swift | 3 +-- Tests/AWSLambdaRuntimeTests/LambdaRuntimeTests.swift | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Tests/AWSLambdaRuntimeTests/LambdaLocalServerTests.swift b/Tests/AWSLambdaRuntimeTests/LambdaLocalServerTests.swift index a88b006f..1004d919 100644 --- a/Tests/AWSLambdaRuntimeTests/LambdaLocalServerTests.swift +++ b/Tests/AWSLambdaRuntimeTests/LambdaLocalServerTests.swift @@ -19,8 +19,7 @@ import Testing @testable import AWSLambdaRuntime -@Suite("Lambda Local Server Tests", .serialized) -struct LambdaLocalServerTests { +extension LambdaRuntimeTests { @Test("Local server respects LOCAL_LAMBDA_PORT environment variable") func testLocalServerCustomPort() async throws { diff --git a/Tests/AWSLambdaRuntimeTests/LambdaRuntime+ServiceLifeCycle.swift b/Tests/AWSLambdaRuntimeTests/LambdaRuntime+ServiceLifeCycle.swift index 7103ea8d..1edf3bfc 100644 --- a/Tests/AWSLambdaRuntimeTests/LambdaRuntime+ServiceLifeCycle.swift +++ b/Tests/AWSLambdaRuntimeTests/LambdaRuntime+ServiceLifeCycle.swift @@ -18,8 +18,7 @@ import ServiceLifecycle import Testing import Logging -@Suite -struct LambdaRuntimeServiceLifecycleTests { +extension LambdaRuntimeTests { @Test func testLambdaRuntimeGracefulShutdown() async throws { let runtime = LambdaRuntime { diff --git a/Tests/AWSLambdaRuntimeTests/LambdaRuntimeTests.swift b/Tests/AWSLambdaRuntimeTests/LambdaRuntimeTests.swift index daf79ed8..402a0459 100644 --- a/Tests/AWSLambdaRuntimeTests/LambdaRuntimeTests.swift +++ b/Tests/AWSLambdaRuntimeTests/LambdaRuntimeTests.swift @@ -20,7 +20,7 @@ import Testing @testable import AWSLambdaRuntime -@Suite +@Suite(.serialized) struct LambdaRuntimeTests { @Test("LambdaRuntime can only be run once")