Skip to content

Commit

Permalink
Merge branch 'main' into day/initial-response-rpc-support
Browse files Browse the repository at this point in the history
  • Loading branch information
dayaffe authored Oct 11, 2023
2 parents d6c52bf + 3dede8d commit 7a3aa9c
Show file tree
Hide file tree
Showing 18 changed files with 129 additions and 247 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.5
// swift-tools-version:5.7

//
// Copyright Amazon.com Inc. or its affiliates.
Expand Down Expand Up @@ -68,18 +68,18 @@ func addClientRuntimeDependency(_ version: Version) {
]
case (false, true):
package.dependencies += [
.package(url: smithySwiftURL, .branch("main"))
.package(url: smithySwiftURL, branch: "main")
]
case (false, false):
package.dependencies += [
.package(url: smithySwiftURL, .exact(version))
.package(url: smithySwiftURL, exact: version)
]
}
}

func addCRTDependency(_ version: Version) {
package.dependencies += [
.package(url: "https://github.com/awslabs/aws-crt-swift", .exact(version))
.package(url: "https://github.com/awslabs/aws-crt-swift", exact: version)
]
}

Expand Down
116 changes: 0 additions & 116 deletions Docker/5.5.3/ubuntu/20.04/Dockerfile

This file was deleted.

10 changes: 5 additions & 5 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.5
// swift-tools-version:5.7

//
// Copyright Amazon.com Inc. or its affiliates.
Expand Down Expand Up @@ -68,18 +68,18 @@ func addClientRuntimeDependency(_ version: Version) {
]
case (false, true):
package.dependencies += [
.package(url: smithySwiftURL, .branch("main"))
.package(url: smithySwiftURL, branch: "main")
]
case (false, false):
package.dependencies += [
.package(url: smithySwiftURL, .exact(version))
.package(url: smithySwiftURL, exact: version)
]
}
}

func addCRTDependency(_ version: Version) {
package.dependencies += [
.package(url: "https://github.com/awslabs/aws-crt-swift", .exact(version))
.package(url: "https://github.com/awslabs/aws-crt-swift", exact: version)
]
}

Expand Down Expand Up @@ -555,4 +555,4 @@ let servicesWithIntegrationTests: [String] = [
servicesWithIntegrationTests.forEach(addIntegrationTestTarget)

// Uncomment this line to enable protocol tests
// addProtocolTests()
addProtocolTests()
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ $ swift package init --type executable

2. Edit your new package's `Package.swift` file to read:
```
// swift-tools-version: 5.5
// swift-tools-version: 5.7
import PackageDescription
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,34 @@ import XCTest
@_spi(FileBasedConfig) @testable import AWSClientRuntime

class CachedCredentialsProviderTests: XCTestCase {

func testGetCredentials() async throws {
var counter: Int = 0
let accessKey = UUID().uuidString
let secret = UUID().uuidString
let coreProvider = MockCredentialsProvider {
counter += 1
return .init(accessKey: "some_access_key", secret: "some_secret")
return .init(accessKey: accessKey, secret: secret)
}

let subject = try CachedCredentialsProvider(
source: coreProvider,
refreshTime: 1
refreshTime: 0.01
)

_ = try await subject.getCredentials()
_ = try await subject.getCredentials()
_ = try await subject.getCredentials()
_ = try await subject.getCredentials()


// Counter is 1 because the last three accesses use cached credentials
XCTAssertEqual(counter, 1)
try! await Task.sleep(nanoseconds: 1 * 1_000_000_000)

let credentials = try! await subject.getCredentials()


try! await Task.sleep(nanoseconds: 1_000_000_000 / 100) // 0.01 seconds
let credentials = try await subject.getCredentials()

// Counter is 2 because we slept long enough for cache to expire
XCTAssertEqual(counter, 2)
XCTAssertEqual(credentials.accessKey, "some_access_key")
XCTAssertEqual(credentials.secret, "some_secret")
XCTAssertEqual(credentials.accessKey, accessKey)
XCTAssertEqual(credentials.secret, secret)
}
}
7 changes: 1 addition & 6 deletions codegen/Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.5.0
// swift-tools-version:5.7

/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
Expand All @@ -7,7 +7,6 @@

import PackageDescription
import class Foundation.ProcessInfo
import class Foundation.FileManager

let baseDir = "./protocol-test-codegen/build/smithyprojections/protocol-test-codegen"
let baseDirLocal = "./protocol-test-codegen-local/build/smithyprojections/protocol-test-codegen-local"
Expand Down Expand Up @@ -87,11 +86,7 @@ func appendLibTarget(name: String, path: String) {

func appendTstTarget(name: String, path: String, dependency: String) {
var dependencies: [Target.Dependency] = [.product(name: "SmithyTestUtil", package: "smithy-swift")]
#if swift(>=5.7)
dependencies.append(.byNameItem(name: dependency, condition: nil))
#else
dependencies.append(._byNameItem(name: dependency, condition: nil))
#endif
package.targets.append(.testTarget(name: name,
dependencies: dependencies,
path: "\(path)/swift-codegen/\(name)")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ErrorTypeMatcherTests: XCTestCase {
}

func test_errorType_doesNotMatchWhenResultIsSuccess() async throws {
let response = GetWidgetOutputResponse()
let response = GetWidgetOutput()
let subject = try WaitersClient.errorTypeMatcherWaiterConfig().acceptors[0]
let match = subject.evaluate(input: anInput, result: .success(response))
XCTAssertNil(match)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class InputOutputMatcherTests: XCTestCase {
func test_inputOutput_acceptorMatchesWhenInputAndOutputPropertiesMatch() async throws {
let value = UUID().uuidString
let input = GetWidgetInput(stringProperty: value)
let output = GetWidgetOutputResponse(stringProperty: value)
let output = GetWidgetOutput(stringProperty: value)
let subject = try WaitersClient.inputOutputPropertyMatcherWaiterConfig().acceptors[0]
let match = subject.evaluate(input: input, result: .success(output))
XCTAssertEqual(match, .success(.success(output)))
Expand All @@ -30,7 +30,7 @@ class InputOutputMatcherTests: XCTestCase {
func test_inputOutput_acceptorFailsToMatchWhenInputAndOutputPropertiesDontMatch() async throws {
let value = UUID().uuidString
let input = GetWidgetInput(stringProperty: value)
let output = GetWidgetOutputResponse(stringProperty: value + "xxx")
let output = GetWidgetOutput(stringProperty: value + "xxx")
let subject = try WaitersClient.inputOutputPropertyMatcherWaiterConfig().acceptors[0]
let match = subject.evaluate(input: input, result: .success(output))
XCTAssertNil(match)
Expand Down
Loading

0 comments on commit 7a3aa9c

Please sign in to comment.