Skip to content

Use Swift testing for InvocationTests #362

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
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 @@ -12,27 +12,26 @@
//
//===----------------------------------------------------------------------===//

import Foundation
import NIOHTTP1
import XCTest
import Testing

@testable import AWSLambdaRuntimeCore

class InvocationTest: XCTestCase {
@Suite
struct InvocationTest {
@Test
func testInvocationTraceID() throws {
let headers = HTTPHeaders([
(AmazonHeaders.requestID, "test"),
(AmazonHeaders.deadline, String(Date(timeIntervalSinceNow: 60).millisSinceEpoch)),
(AmazonHeaders.invokedFunctionARN, "arn:aws:lambda:us-east-1:123456789012:function:custom-runtime"),
])

var invocation: InvocationMetadata?
var maybeInvocation: InvocationMetadata?

XCTAssertNoThrow(invocation = try InvocationMetadata(headers: headers))
XCTAssertNotNil(invocation)

guard !invocation!.traceID.isEmpty else {
XCTFail("Invocation traceID is empty")
return
}
#expect(throws: Never.self) { maybeInvocation = try InvocationMetadata(headers: headers) }
let invocation = try #require(maybeInvocation)
#expect(!invocation.traceID.isEmpty)
}
}
Loading