Skip to content
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