Skip to content

[tests] minor changes, mostly syntaxic #530

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

Merged
merged 4 commits into from
Jul 12, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,24 @@ struct JSONTests {
let result = await writer.output
#expect(result == ByteBuffer(string: #"{"bar":"baz"}"#))
}
}

final actor MockLambdaWriter: LambdaResponseStreamWriter {
private var _buffer: ByteBuffer?
final actor MockLambdaWriter: LambdaResponseStreamWriter {
private var _buffer: ByteBuffer?

var output: ByteBuffer? {
self._buffer
}
var output: ByteBuffer? {
self._buffer
}

func writeAndFinish(_ buffer: ByteBuffer) async throws {
self._buffer = buffer
}
func writeAndFinish(_ buffer: ByteBuffer) async throws {
self._buffer = buffer
}

func write(_ buffer: ByteBuffer) async throws {
fatalError("Unexpected call")
}
func write(_ buffer: ByteBuffer) async throws {
fatalError("Unexpected call")
}

func finish() async throws {
fatalError("Unexpected call")
func finish() async throws {
fatalError("Unexpected call")
}
}
}
2 changes: 1 addition & 1 deletion Tests/AWSLambdaRuntimeTests/LambdaRunLoopTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct LambdaRunLoopTests {
}
}

let mockClient = LambdaMockClient()
let mockClient = MockLambdaClient()
let mockEchoHandler = MockEchoHandler()
let failingHandler = FailingHandler()

Expand Down
4 changes: 2 additions & 2 deletions Tests/AWSLambdaRuntimeTests/LambdaRuntimeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct LambdaRuntimeTests {
}

// wait a small amount to ensure runtime1 task is started
try await Task.sleep(for: .seconds(1))
try await Task.sleep(for: .seconds(0.5))

// Running the second runtime should trigger LambdaRuntimeError
await #expect(throws: LambdaRuntimeError.self) {
Expand All @@ -71,7 +71,7 @@ struct LambdaRuntimeTests {
}

// Set timeout and cancel the runtime 2
try await Task.sleep(for: .seconds(2))
try await Task.sleep(for: .seconds(1))
taskGroup.cancelAll()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import FoundationEssentials
import Foundation
#endif

struct LambdaMockWriter: LambdaRuntimeClientResponseStreamWriter {
var underlying: LambdaMockClient
struct MockLambdaWriter: LambdaRuntimeClientResponseStreamWriter {
var underlying: MockLambdaClient

init(underlying: LambdaMockClient) {
init(underlying: MockLambdaClient) {
self.underlying = underlying
}

Expand Down Expand Up @@ -55,8 +55,8 @@ enum LambdaError: Error, Equatable {
case handlerError
}

final actor LambdaMockClient: LambdaRuntimeClientProtocol {
typealias Writer = LambdaMockWriter
final actor MockLambdaClient: LambdaRuntimeClientProtocol {
typealias Writer = MockLambdaWriter

private struct StateMachine {
private enum State {
Expand Down