forked from swift-server/swift-aws-lambda-runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathControlPlaneRequestTests.swift
38 lines (32 loc) · 1.25 KB
/
ControlPlaneRequestTests.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//===----------------------------------------------------------------------===//
//
// This source file is part of the SwiftAWSLambdaRuntime open source project
//
// Copyright (c) 2022 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 NIOHTTP1
import XCTest
@testable import AWSLambdaRuntimeCore
class InvocationTest: XCTestCase {
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?
XCTAssertNoThrow(invocation = try InvocationMetadata(headers: headers))
XCTAssertNotNil(invocation)
guard !invocation!.traceID.isEmpty else {
XCTFail("Invocation traceID is empty")
return
}
}
}