Skip to content

Commit 0dcb143

Browse files
authored
Use Swift Testing for InvocationTests (#362)
1 parent 757815b commit 0dcb143

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

Tests/AWSLambdaRuntimeCoreTests/ControlPlaneRequestTests.swift renamed to Tests/AWSLambdaRuntimeCoreTests/InvocationTests.swift

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,26 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
import Foundation
1516
import NIOHTTP1
16-
import XCTest
17+
import Testing
1718

1819
@testable import AWSLambdaRuntimeCore
1920

20-
class InvocationTest: XCTestCase {
21+
@Suite
22+
struct InvocationTest {
23+
@Test
2124
func testInvocationTraceID() throws {
2225
let headers = HTTPHeaders([
2326
(AmazonHeaders.requestID, "test"),
2427
(AmazonHeaders.deadline, String(Date(timeIntervalSinceNow: 60).millisSinceEpoch)),
2528
(AmazonHeaders.invokedFunctionARN, "arn:aws:lambda:us-east-1:123456789012:function:custom-runtime"),
2629
])
2730

28-
var invocation: InvocationMetadata?
31+
var maybeInvocation: InvocationMetadata?
2932

30-
XCTAssertNoThrow(invocation = try InvocationMetadata(headers: headers))
31-
XCTAssertNotNil(invocation)
32-
33-
guard !invocation!.traceID.isEmpty else {
34-
XCTFail("Invocation traceID is empty")
35-
return
36-
}
33+
#expect(throws: Never.self) { maybeInvocation = try InvocationMetadata(headers: headers) }
34+
let invocation = try #require(maybeInvocation)
35+
#expect(!invocation.traceID.isEmpty)
3736
}
3837
}

0 commit comments

Comments
 (0)