From 7c2471086e0ff2b44925038c0cef07e246ece124 Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Thu, 5 Oct 2023 15:39:17 -0400 Subject: [PATCH 01/14] fix: predictions integration test assertion on label count --- .../CoreMLPredictionsPluginIntegrationTest.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AmplifyPlugins/Predictions/Tests/PredictionsHostApp/CoreMLPredictionsPluginIntegrationTests/CoreMLPredictionsPluginIntegrationTest.swift b/AmplifyPlugins/Predictions/Tests/PredictionsHostApp/CoreMLPredictionsPluginIntegrationTests/CoreMLPredictionsPluginIntegrationTest.swift index 6a744d5d4e..ff1f8d1a55 100644 --- a/AmplifyPlugins/Predictions/Tests/PredictionsHostApp/CoreMLPredictionsPluginIntegrationTests/CoreMLPredictionsPluginIntegrationTest.swift +++ b/AmplifyPlugins/Predictions/Tests/PredictionsHostApp/CoreMLPredictionsPluginIntegrationTests/CoreMLPredictionsPluginIntegrationTest.swift @@ -21,7 +21,7 @@ class CoreMLPredictionsPluginIntegrationTest: AWSPredictionsPluginTestBase { in: url ) - XCTAssertEqual(result.labels.count, 0, String(describing: result)) + XCTAssertEqual(result.labels.count, 2, String(describing: result)) XCTAssertNil(result.unsafeContent, String(describing: result)) } From 78d3d03cbdd80c0fef24826063590f7e21a18e3b Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Thu, 5 Oct 2023 16:58:44 -0400 Subject: [PATCH 02/14] update authhostapp package.resolved --- .../xcshareddata/swiftpm/Package.resolved | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthHostApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthHostApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index a8b70a2420..574dbfb6b0 100644 --- a/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthHostApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthHostApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -23,8 +23,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/awslabs/aws-crt-swift.git", "state" : { - "revision" : "6feec6c3787877807aa9a00fad09591b96752376", - "version" : "0.6.1" + "revision" : "997904873945e074aaf5c51ea968d9a84684525a", + "version" : "0.13.0" } }, { @@ -32,8 +32,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/awslabs/aws-sdk-swift.git", "state" : { - "revision" : "24bae88a2391fe75da8a940a544d1ef6441f5321", - "version" : "0.13.0" + "revision" : "ace826dbfe96e7e3103fe7f45f815b8a590bcf21", + "version" : "0.26.0" } }, { @@ -57,10 +57,10 @@ { "identity" : "smithy-swift", "kind" : "remoteSourceControl", - "location" : "https://github.com/awslabs/smithy-swift.git", + "location" : "https://github.com/smithy-lang/smithy-swift", "state" : { - "revision" : "7b28da158d92cd06a3549140d43b8fbcf64a94a6", - "version" : "0.15.0" + "revision" : "eed3f3d8e5aa704fcd60bb227b0fc89bf3328c42", + "version" : "0.30.0" } }, { @@ -104,8 +104,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/MaxDesiatov/XMLCoder.git", "state" : { - "revision" : "c438dad94f6a243b411b70a4b4bac54595064808", - "version" : "0.15.0" + "revision" : "80b4a1646399b8e4e0ce80711653476a85bd5e37", + "version" : "0.17.0" } } ], From 6931b7c7e788aa195001f3e3ab6c29a5dcd4822d Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Mon, 9 Oct 2023 10:37:58 -0400 Subject: [PATCH 03/14] account for limitExceeded exceptions in a handful of auth integration tests --- .../AuthDeleteUserTests.swift | 22 ++++++++++++------- .../SignInTests/AuthSRPSignInTests.swift | 19 +++++++++++----- .../AuthResendSignUpCodeTests.swift | 19 +++++++++++----- 3 files changed, 40 insertions(+), 20 deletions(-) diff --git a/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/AuthDeleteUserTests/AuthDeleteUserTests.swift b/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/AuthDeleteUserTests/AuthDeleteUserTests.swift index a77f580fa9..5304a5b5e1 100644 --- a/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/AuthDeleteUserTests/AuthDeleteUserTests.swift +++ b/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/AuthDeleteUserTests/AuthDeleteUserTests.swift @@ -48,15 +48,21 @@ class AuthDeleteUserTests: AWSAuthBaseTest { do { _ = try await AuthSignInHelper.signInUser(username: username, password: password) XCTFail("signIn after account deletion should fail") - } catch { - guard case AuthError.service(_, _, let underlyingError) = error else { - XCTFail("Should produce service error instead of \(String(describing: error))") - return - } - guard case .userNotFound = (underlyingError as? AWSCognitoAuthError) else { - XCTFail("Underlying error should be userNotFound instead of \(String(describing: error))") - return + } catch let error as AuthError { + switch error { + case .service(_, _, let underlying): + XCTAssert( + [.userNotFound, .limitExceeded].contains(underlying as? AWSCognitoAuthError) + ) + default: + XCTFail(""" + Should produce .service error with underlyingError of .userNotFound || .limitExceed + Received: \(error) + """) + } + } catch { + XCTFail("Expected AuthError - received: \(error)") } // Check if the auth session is signed out diff --git a/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/SignInTests/AuthSRPSignInTests.swift b/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/SignInTests/AuthSRPSignInTests.swift index 0c35eca521..3728939c28 100644 --- a/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/SignInTests/AuthSRPSignInTests.swift +++ b/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/SignInTests/AuthSRPSignInTests.swift @@ -159,13 +159,20 @@ class AuthSRPSignInTests: AWSAuthBaseTest { do { _ = try await Amplify.Auth.signIn(username: "username-doesnot-exist", password: "password") XCTFail("SignIn with unknown user should not succeed") + } catch let error as AuthError { + let underlyingError = error.underlyingError as? AWSCognitoAuthError + switch underlyingError { + case .userNotFound, .limitExceeded: break + default: + XCTFail( + """ + Expected AWSCognitoAuthError.userNotFound || AWSCognitoAuthError.limitExceed + Recevied: \(error) + """ + ) + } } catch { - guard let authError = error as? AuthError, let cognitoError = authError.underlyingError as? AWSCognitoAuthError, - case .userNotFound = cognitoError - else { - XCTFail("Should return userNotFound error") - return - } + XCTFail("Expected `AuthError` - received: \(error)") } } diff --git a/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/SignUpTests/AuthResendSignUpCodeTests.swift b/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/SignUpTests/AuthResendSignUpCodeTests.swift index 53e6865176..05f8161581 100644 --- a/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/SignUpTests/AuthResendSignUpCodeTests.swift +++ b/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/SignUpTests/AuthResendSignUpCodeTests.swift @@ -23,13 +23,20 @@ class AuthResendSignUpCodeTests: AWSAuthBaseTest { do { _ = try await Amplify.Auth.resendSignUpCode(for: "user-non-exists") XCTFail("resendSignUpCode with non existing user should not return result") - } catch { - guard let authError = error as? AuthError, let cognitoError = authError.underlyingError as? AWSCognitoAuthError, - case .userNotFound = cognitoError else { - print(error) - XCTFail("Should return userNotFound") - return + } catch let error as AuthError { + let underlyingError = error.underlyingError as? AWSCognitoAuthError + switch underlyingError { + case .userNotFound, .limitExceeded: break + default: + XCTFail( + """ + Expected AWSCognitoAuthError.userNotFound || AWSCognitoAuthError.limitExceed + Recevied: \(error) + """ + ) } + } catch { + XCTFail("Expected `AuthError` - received: \(error)") } } } From 1022f14972367a28b723706fd2dd5b0a27fbde3b Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Mon, 9 Oct 2023 10:38:17 -0400 Subject: [PATCH 04/14] use fulfillment API on flaky auth integration test --- .../DeviceTests/AuthForgetDeviceTests.swift | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/DeviceTests/AuthForgetDeviceTests.swift b/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/DeviceTests/AuthForgetDeviceTests.swift index 3a2527539a..b1df2d456a 100644 --- a/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/DeviceTests/AuthForgetDeviceTests.swift +++ b/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/DeviceTests/AuthForgetDeviceTests.swift @@ -38,14 +38,12 @@ class AuthForgetDeviceTests: AWSAuthBaseTest { let username = "integTest\(UUID().uuidString)" let password = "P123@\(UUID().uuidString)" - let signInExpectation = asyncExpectation(description: "SignIn event should be fired") + let signInExpectation = expectation(description: "SignIn event should be fired") unsubscribeToken = Amplify.Hub.listen(to: .auth) { payload in switch payload.eventName { case HubPayload.EventName.Auth.signedIn: - Task { - await signInExpectation.fulfill() - } + signInExpectation.fulfill() default: break } @@ -55,7 +53,7 @@ class AuthForgetDeviceTests: AWSAuthBaseTest { username: username, password: password, email: defaultTestEmail) - await waitForExpectations([signInExpectation], timeout: networkTimeout) + await fulfillment(of: [signInExpectation], timeout: networkTimeout) _ = try await Amplify.Auth.rememberDevice() _ = try await Amplify.Auth.forgetDevice() From 5dc4bc119908cded083461daf4d96a22e634d998 Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Mon, 9 Oct 2023 10:51:25 -0400 Subject: [PATCH 05/14] use Xcode 14.3 for Predictions iOS integration tests --- .github/workflows/integ_test_predictions.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/integ_test_predictions.yml b/.github/workflows/integ_test_predictions.yml index d0a9b8ac3d..b20923664c 100644 --- a/.github/workflows/integ_test_predictions.yml +++ b/.github/workflows/integ_test_predictions.yml @@ -37,6 +37,8 @@ jobs: with: project_path: ./AmplifyPlugins/Predictions/Tests/PredictionsHostApp scheme: AWSPredictionsPluginIntegrationTests + destination: 'platform=iOS Simulator,name=iPhone 14,OS=latest' + xcode_path: '/Applications/Xcode_14.3.app' predictions-integration-test-tvOS: continue-on-error: true From 91f72a92c9c8959cbb501abe2d4526deb13b0743 Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Mon, 9 Oct 2023 10:53:19 -0400 Subject: [PATCH 06/14] use Xcode 14.3 for Auth integration tests target iOS --- .github/workflows/integ_test_auth.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/integ_test_auth.yml b/.github/workflows/integ_test_auth.yml index 1a76717c21..548ba73952 100644 --- a/.github/workflows/integ_test_auth.yml +++ b/.github/workflows/integ_test_auth.yml @@ -32,6 +32,8 @@ jobs: with: project_path: ./AmplifyPlugins/Auth/Tests/AuthHostApp/ scheme: AuthIntegrationTests + destination: 'platform=iOS Simulator,name=iPhone 14,OS=latest' + xcode_path: '/Applications/Xcode_14.3.app' auth-integration-test-tvOS: runs-on: macos-13 @@ -113,3 +115,5 @@ jobs: with: project_path: ./AmplifyPlugins/Auth/Tests/AuthHostedUIApp/ scheme: AuthHostedUIApp + destination: 'platform=iOS Simulator,name=iPhone 14,OS=latest' + xcode_path: '/Applications/Xcode_14.3.app' From 49fc32d6314afe505592f14bf9821a2c77eab9d9 Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Mon, 9 Oct 2023 10:56:14 -0400 Subject: [PATCH 07/14] use macos-13 runner for Xcode 14.3 tests --- .github/workflows/integ_test_auth.yml | 4 ++-- .github/workflows/integ_test_predictions.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integ_test_auth.yml b/.github/workflows/integ_test_auth.yml index 548ba73952..b628e68abe 100644 --- a/.github/workflows/integ_test_auth.yml +++ b/.github/workflows/integ_test_auth.yml @@ -9,7 +9,7 @@ permissions: jobs: auth-integration-test-iOS: - runs-on: macos-12 + runs-on: macos-13 environment: IntegrationTest steps: - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b @@ -92,7 +92,7 @@ jobs: xcode_path: '/Applications/Xcode_14.3.app' auth-ui-integration-test-iOS: - runs-on: macos-12 + runs-on: macos-13 environment: IntegrationTest steps: - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b diff --git a/.github/workflows/integ_test_predictions.yml b/.github/workflows/integ_test_predictions.yml index b20923664c..58be80d7e8 100644 --- a/.github/workflows/integ_test_predictions.yml +++ b/.github/workflows/integ_test_predictions.yml @@ -11,7 +11,7 @@ jobs: predictions-integration-test-iOS: continue-on-error: true timeout-minutes: 30 - runs-on: macos-12 + runs-on: macos-13 environment: IntegrationTest steps: - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b From 177956142de84a0dde35ea62f0856e178ccd61a0 Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Mon, 9 Oct 2023 11:35:00 -0400 Subject: [PATCH 08/14] include os in Foundation only Storage requests --- .../AmplifyAWSServiceConfiguration.swift | 2 ++ .../Service/Storage/AWSS3StorageService.swift | 2 +- ...SS3StoragePluginBasicIntegrationTests.swift | 2 +- .../AWSS3StoragePluginTestBase.swift | 1 + .../xcshareddata/swiftpm/Package.resolved | 18 +++++++++--------- .../xcschemes/StorageHostApp.xcscheme | 2 +- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/AmplifyPlugins/Core/AWSPluginsCore/ServiceConfiguration/AmplifyAWSServiceConfiguration.swift b/AmplifyPlugins/Core/AWSPluginsCore/ServiceConfiguration/AmplifyAWSServiceConfiguration.swift index aa3acc070c..34b0ef3d85 100644 --- a/AmplifyPlugins/Core/AWSPluginsCore/ServiceConfiguration/AmplifyAWSServiceConfiguration.swift +++ b/AmplifyPlugins/Core/AWSPluginsCore/ServiceConfiguration/AmplifyAWSServiceConfiguration.swift @@ -21,4 +21,6 @@ public class AmplifyAWSServiceConfiguration { public static let platformName = "amplify-swift" public static let userAgentLib: String = "lib/\(platformName)#\(amplifyVersion)" + + public static let userAgentOS: String = "os/\(DeviceInfo.current.operatingSystem.name)#\(DeviceInfo.current.operatingSystem.version)" } diff --git a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Service/Storage/AWSS3StorageService.swift b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Service/Storage/AWSS3StorageService.swift index 1daf10edd6..c26fbc2c79 100644 --- a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Service/Storage/AWSS3StorageService.swift +++ b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Service/Storage/AWSS3StorageService.swift @@ -130,7 +130,7 @@ class AWSS3StorageService: AWSS3StorageServiceBehavior, StorageServiceProxy { self.preSignedURLBuilder = preSignedURLBuilder self.awsS3 = awsS3 self.bucket = bucket - self.userAgent = AmplifyAWSServiceConfiguration.userAgentLib + self.userAgent = "\(AmplifyAWSServiceConfiguration.userAgentLib) \(AmplifyAWSServiceConfiguration.userAgentOS)" StorageBackgroundEventsRegistry.register(identifier: identifier) diff --git a/AmplifyPlugins/Storage/Tests/StorageHostApp/AWSS3StoragePluginIntegrationTests/AWSS3StoragePluginBasicIntegrationTests.swift b/AmplifyPlugins/Storage/Tests/StorageHostApp/AWSS3StoragePluginIntegrationTests/AWSS3StoragePluginBasicIntegrationTests.swift index 52af5bfcf8..af09dc6470 100644 --- a/AmplifyPlugins/Storage/Tests/StorageHostApp/AWSS3StoragePluginIntegrationTests/AWSS3StoragePluginBasicIntegrationTests.swift +++ b/AmplifyPlugins/Storage/Tests/StorageHostApp/AWSS3StoragePluginIntegrationTests/AWSS3StoragePluginBasicIntegrationTests.swift @@ -67,7 +67,7 @@ class AWSS3StoragePluginBasicIntegrationTests: AWSS3StoragePluginTestBase { _ = try await Amplify.Storage.remove(key: key) // Only the remove operation results in an SDK request - XCTAssertEqual(requestRecorder.sdkRequests.map { $0.method} , [.delete]) + XCTAssertEqual(requestRecorder.sdkRequests.map { $0.method } , [.delete]) try assertUserAgentComponents(sdkRequests: requestRecorder.sdkRequests) XCTAssertEqual(requestRecorder.urlRequests.map { $0.httpMethod }, ["PUT"]) diff --git a/AmplifyPlugins/Storage/Tests/StorageHostApp/AWSS3StoragePluginIntegrationTests/AWSS3StoragePluginTestBase.swift b/AmplifyPlugins/Storage/Tests/StorageHostApp/AWSS3StoragePluginIntegrationTests/AWSS3StoragePluginTestBase.swift index abe61747cd..ca1ce1ac98 100644 --- a/AmplifyPlugins/Storage/Tests/StorageHostApp/AWSS3StoragePluginIntegrationTests/AWSS3StoragePluginTestBase.swift +++ b/AmplifyPlugins/Storage/Tests/StorageHostApp/AWSS3StoragePluginIntegrationTests/AWSS3StoragePluginTestBase.swift @@ -12,6 +12,7 @@ import XCTest import AWSCognitoAuthPlugin import AWSPluginsCore +@_spi(PluginHTTPClientEngine) import AWSPluginsCore class AWSS3StoragePluginTestBase: XCTestCase { static let logger = Amplify.Logging.logger(forCategory: "Storage", logLevel: .verbose) diff --git a/AmplifyPlugins/Storage/Tests/StorageHostApp/StorageHostApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/AmplifyPlugins/Storage/Tests/StorageHostApp/StorageHostApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index f284cdc5c9..603f949096 100644 --- a/AmplifyPlugins/Storage/Tests/StorageHostApp/StorageHostApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/AmplifyPlugins/Storage/Tests/StorageHostApp/StorageHostApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -23,8 +23,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/awslabs/aws-crt-swift.git", "state" : { - "revision" : "6feec6c3787877807aa9a00fad09591b96752376", - "version" : "0.6.1" + "revision" : "997904873945e074aaf5c51ea968d9a84684525a", + "version" : "0.13.0" } }, { @@ -32,8 +32,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/awslabs/aws-sdk-swift.git", "state" : { - "revision" : "24bae88a2391fe75da8a940a544d1ef6441f5321", - "version" : "0.13.0" + "revision" : "ace826dbfe96e7e3103fe7f45f815b8a590bcf21", + "version" : "0.26.0" } }, { @@ -57,10 +57,10 @@ { "identity" : "smithy-swift", "kind" : "remoteSourceControl", - "location" : "https://github.com/awslabs/smithy-swift.git", + "location" : "https://github.com/smithy-lang/smithy-swift", "state" : { - "revision" : "7b28da158d92cd06a3549140d43b8fbcf64a94a6", - "version" : "0.15.0" + "revision" : "eed3f3d8e5aa704fcd60bb227b0fc89bf3328c42", + "version" : "0.30.0" } }, { @@ -104,8 +104,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/MaxDesiatov/XMLCoder.git", "state" : { - "revision" : "b1e944cbd0ef33787b13f639a5418d55b3bed501", - "version" : "0.17.1" + "revision" : "80b4a1646399b8e4e0ce80711653476a85bd5e37", + "version" : "0.17.0" } } ], diff --git a/AmplifyPlugins/Storage/Tests/StorageHostApp/StorageHostApp.xcodeproj/xcshareddata/xcschemes/StorageHostApp.xcscheme b/AmplifyPlugins/Storage/Tests/StorageHostApp/StorageHostApp.xcodeproj/xcshareddata/xcschemes/StorageHostApp.xcscheme index 432789d9ad..dbaee112f9 100644 --- a/AmplifyPlugins/Storage/Tests/StorageHostApp/StorageHostApp.xcodeproj/xcshareddata/xcschemes/StorageHostApp.xcscheme +++ b/AmplifyPlugins/Storage/Tests/StorageHostApp/StorageHostApp.xcodeproj/xcshareddata/xcschemes/StorageHostApp.xcscheme @@ -43,7 +43,7 @@ parallelizable = "YES"> From 89700fd16e61692106b9ac83f206cf9da6678986 Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Mon, 9 Oct 2023 11:48:33 -0400 Subject: [PATCH 09/14] use fulfillment and increase timeout in multiple signup auth integration test --- .../AuthIntegrationTests/SignUpTests/AuthSignUpTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/SignUpTests/AuthSignUpTests.swift b/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/SignUpTests/AuthSignUpTests.swift index e637b596c9..7bbfce132d 100644 --- a/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/SignUpTests/AuthSignUpTests.swift +++ b/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/SignUpTests/AuthSignUpTests.swift @@ -54,7 +54,7 @@ class AuthSignUpTests: AWSAuthBaseTest { signUpExpectation.fulfill() } } - await waitForExpectations(timeout: 2) + await fulfillment(of: signUpExpectation, timeout: 5, enforceOrder: false) } // /// Test if user registration is successful. From 3fc003959c221c39af27c46feaf8a1436428b806 Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Mon, 9 Oct 2023 12:20:15 -0400 Subject: [PATCH 10/14] storage integration test - assert on all requests --- .../AWSS3StoragePluginBasicIntegrationTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AmplifyPlugins/Storage/Tests/StorageHostApp/AWSS3StoragePluginIntegrationTests/AWSS3StoragePluginBasicIntegrationTests.swift b/AmplifyPlugins/Storage/Tests/StorageHostApp/AWSS3StoragePluginIntegrationTests/AWSS3StoragePluginBasicIntegrationTests.swift index af09dc6470..70f2dfccc3 100644 --- a/AmplifyPlugins/Storage/Tests/StorageHostApp/AWSS3StoragePluginIntegrationTests/AWSS3StoragePluginBasicIntegrationTests.swift +++ b/AmplifyPlugins/Storage/Tests/StorageHostApp/AWSS3StoragePluginIntegrationTests/AWSS3StoragePluginBasicIntegrationTests.swift @@ -244,7 +244,7 @@ class AWSS3StoragePluginBasicIntegrationTests: AWSS3StoragePluginTestBase { } // A S3 HeadObject call is expected - XCTAssertEqual(requestRecorder.sdkRequests.map { $0.method} , [.head]) + XCTAssert(requestRecorder.sdkRequests.map(\.method).allSatisfy { $0 == .head }) try assertUserAgentComponents(sdkRequests: requestRecorder.sdkRequests) XCTAssertEqual(requestRecorder.urlRequests.map { $0.httpMethod }, []) From f8f758a46e9adb654578dd1ddc72c26fd185dadf Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Mon, 9 Oct 2023 13:22:55 -0400 Subject: [PATCH 11/14] auth test: fix typo in fulfillment call --- .../AuthIntegrationTests/SignUpTests/AuthSignUpTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/SignUpTests/AuthSignUpTests.swift b/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/SignUpTests/AuthSignUpTests.swift index 7bbfce132d..7f694195d5 100644 --- a/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/SignUpTests/AuthSignUpTests.swift +++ b/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/SignUpTests/AuthSignUpTests.swift @@ -54,7 +54,7 @@ class AuthSignUpTests: AWSAuthBaseTest { signUpExpectation.fulfill() } } - await fulfillment(of: signUpExpectation, timeout: 5, enforceOrder: false) + await fulfillment(of: [signUpExpectation], timeout: 5, enforceOrder: false) } // /// Test if user registration is successful. From 80d53343240ab279e1adefb8dcde2eac21c63927 Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Mon, 9 Oct 2023 13:31:26 -0400 Subject: [PATCH 12/14] update package.resolved for AnalyticsHostApp --- .../xcshareddata/swiftpm/Package.resolved | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/AmplifyPlugins/Analytics/Tests/AnalyticsHostApp/AnalyticsHostApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/AmplifyPlugins/Analytics/Tests/AnalyticsHostApp/AnalyticsHostApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 2ef4d7901c..6203f7a6b6 100644 --- a/AmplifyPlugins/Analytics/Tests/AnalyticsHostApp/AnalyticsHostApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/AmplifyPlugins/Analytics/Tests/AnalyticsHostApp/AnalyticsHostApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -23,8 +23,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/awslabs/aws-crt-swift", "state" : { - "revision" : "6feec6c3787877807aa9a00fad09591b96752376", - "version" : "0.6.1" + "revision" : "997904873945e074aaf5c51ea968d9a84684525a", + "version" : "0.13.0" } }, { @@ -32,8 +32,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/awslabs/aws-sdk-swift.git", "state" : { - "revision" : "24bae88a2391fe75da8a940a544d1ef6441f5321", - "version" : "0.13.0" + "revision" : "ace826dbfe96e7e3103fe7f45f815b8a590bcf21", + "version" : "0.26.0" } }, { @@ -57,10 +57,10 @@ { "identity" : "smithy-swift", "kind" : "remoteSourceControl", - "location" : "https://github.com/awslabs/smithy-swift", + "location" : "https://github.com/smithy-lang/smithy-swift", "state" : { - "revision" : "7b28da158d92cd06a3549140d43b8fbcf64a94a6", - "version" : "0.15.0" + "revision" : "eed3f3d8e5aa704fcd60bb227b0fc89bf3328c42", + "version" : "0.30.0" } }, { @@ -104,8 +104,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/MaxDesiatov/XMLCoder.git", "state" : { - "revision" : "b1e944cbd0ef33787b13f639a5418d55b3bed501", - "version" : "0.17.1" + "revision" : "80b4a1646399b8e4e0ce80711653476a85bd5e37", + "version" : "0.17.0" } } ], From ac40901e680cf11482b48d125ade7f753494af43 Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Mon, 9 Oct 2023 14:17:59 -0400 Subject: [PATCH 13/14] link necessary libraries in predictions test targets --- .../project.pbxproj | 86 +++++++++++++++++++ .../PredictionsHostApp/ContentView.swift | 66 -------------- 2 files changed, 86 insertions(+), 66 deletions(-) diff --git a/AmplifyPlugins/Predictions/Tests/PredictionsHostApp/PredictionsHostApp.xcodeproj/project.pbxproj b/AmplifyPlugins/Predictions/Tests/PredictionsHostApp/PredictionsHostApp.xcodeproj/project.pbxproj index ba091df90b..cdd34b7658 100644 --- a/AmplifyPlugins/Predictions/Tests/PredictionsHostApp/PredictionsHostApp.xcodeproj/project.pbxproj +++ b/AmplifyPlugins/Predictions/Tests/PredictionsHostApp/PredictionsHostApp.xcodeproj/project.pbxproj @@ -52,6 +52,18 @@ 90542370291425630000D108 /* testImageCeleb.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 90542363291425630000D108 /* testImageCeleb.jpg */; }; 90542371291425630000D108 /* testImageTextForms.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 90542364291425630000D108 /* testImageTextForms.jpg */; }; 90542372291425630000D108 /* audio.wav in Resources */ = {isa = PBXBuildFile; fileRef = 90542365291425630000D108 /* audio.wav */; }; + 90CF304A2AD47A71006B6FF3 /* Amplify in Frameworks */ = {isa = PBXBuildFile; productRef = 90CF30492AD47A71006B6FF3 /* Amplify */; }; + 90CF304C2AD47A74006B6FF3 /* Amplify in Frameworks */ = {isa = PBXBuildFile; productRef = 90CF304B2AD47A74006B6FF3 /* Amplify */; }; + 90CF304E2AD47A78006B6FF3 /* Amplify in Frameworks */ = {isa = PBXBuildFile; productRef = 90CF304D2AD47A78006B6FF3 /* Amplify */; }; + 90CF30502AD47B0E006B6FF3 /* AWSCognitoAuthPlugin in Frameworks */ = {isa = PBXBuildFile; productRef = 90CF304F2AD47B0E006B6FF3 /* AWSCognitoAuthPlugin */; }; + 90CF30522AD47B0E006B6FF3 /* AWSPredictionsPlugin in Frameworks */ = {isa = PBXBuildFile; productRef = 90CF30512AD47B0E006B6FF3 /* AWSPredictionsPlugin */; }; + 90CF30542AD47B0E006B6FF3 /* CoreMLPredictionsPlugin in Frameworks */ = {isa = PBXBuildFile; productRef = 90CF30532AD47B0E006B6FF3 /* CoreMLPredictionsPlugin */; }; + 90CF30562AD47B19006B6FF3 /* AWSCognitoAuthPlugin in Frameworks */ = {isa = PBXBuildFile; productRef = 90CF30552AD47B19006B6FF3 /* AWSCognitoAuthPlugin */; }; + 90CF30582AD47B19006B6FF3 /* AWSPredictionsPlugin in Frameworks */ = {isa = PBXBuildFile; productRef = 90CF30572AD47B19006B6FF3 /* AWSPredictionsPlugin */; }; + 90CF305A2AD47B19006B6FF3 /* CoreMLPredictionsPlugin in Frameworks */ = {isa = PBXBuildFile; productRef = 90CF30592AD47B19006B6FF3 /* CoreMLPredictionsPlugin */; }; + 90CF305C2AD47B24006B6FF3 /* AWSCognitoAuthPlugin in Frameworks */ = {isa = PBXBuildFile; productRef = 90CF305B2AD47B24006B6FF3 /* AWSCognitoAuthPlugin */; }; + 90CF305E2AD47B24006B6FF3 /* AWSPredictionsPlugin in Frameworks */ = {isa = PBXBuildFile; productRef = 90CF305D2AD47B24006B6FF3 /* AWSPredictionsPlugin */; }; + 90CF30602AD47B24006B6FF3 /* CoreMLPredictionsPlugin in Frameworks */ = {isa = PBXBuildFile; productRef = 90CF305F2AD47B24006B6FF3 /* CoreMLPredictionsPlugin */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -125,6 +137,10 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 90CF30602AD47B24006B6FF3 /* CoreMLPredictionsPlugin in Frameworks */, + 90CF304E2AD47A78006B6FF3 /* Amplify in Frameworks */, + 90CF305E2AD47B24006B6FF3 /* AWSPredictionsPlugin in Frameworks */, + 90CF305C2AD47B24006B6FF3 /* AWSCognitoAuthPlugin in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -143,6 +159,10 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 90CF30542AD47B0E006B6FF3 /* CoreMLPredictionsPlugin in Frameworks */, + 90CF304A2AD47A71006B6FF3 /* Amplify in Frameworks */, + 90CF30522AD47B0E006B6FF3 /* AWSPredictionsPlugin in Frameworks */, + 90CF30502AD47B0E006B6FF3 /* AWSCognitoAuthPlugin in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -150,6 +170,10 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 90CF305A2AD47B19006B6FF3 /* CoreMLPredictionsPlugin in Frameworks */, + 90CF304C2AD47A74006B6FF3 /* Amplify in Frameworks */, + 90CF30582AD47B19006B6FF3 /* AWSPredictionsPlugin in Frameworks */, + 90CF30562AD47B19006B6FF3 /* AWSCognitoAuthPlugin in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -312,6 +336,10 @@ ); name = AWSPredictionsPluginIntegrationTestsWatch; packageProductDependencies = ( + 90CF304D2AD47A78006B6FF3 /* Amplify */, + 90CF305B2AD47B24006B6FF3 /* AWSCognitoAuthPlugin */, + 90CF305D2AD47B24006B6FF3 /* AWSPredictionsPlugin */, + 90CF305F2AD47B24006B6FF3 /* CoreMLPredictionsPlugin */, ); productName = AWSPredictionsPluginIntegrationTests; productReference = 6875F9242A3CCCB7001C9AAF /* AWSPredictionsPluginIntegrationTestsWatch.xctest */; @@ -355,6 +383,12 @@ 90283038291402D500897087 /* PBXTargetDependency */, ); name = CoreMLPredictionsPluginIntegrationTests; + packageProductDependencies = ( + 90CF30492AD47A71006B6FF3 /* Amplify */, + 90CF304F2AD47B0E006B6FF3 /* AWSCognitoAuthPlugin */, + 90CF30512AD47B0E006B6FF3 /* AWSPredictionsPlugin */, + 90CF30532AD47B0E006B6FF3 /* CoreMLPredictionsPlugin */, + ); productName = CoreMLPredictionsPluginIntegrationTests; productReference = 90283033291402D500897087 /* CoreMLPredictionsPluginIntegrationTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; @@ -374,6 +408,10 @@ ); name = AWSPredictionsPluginIntegrationTests; packageProductDependencies = ( + 90CF304B2AD47A74006B6FF3 /* Amplify */, + 90CF30552AD47B19006B6FF3 /* AWSCognitoAuthPlugin */, + 90CF30572AD47B19006B6FF3 /* AWSPredictionsPlugin */, + 90CF30592AD47B19006B6FF3 /* CoreMLPredictionsPlugin */, ); productName = AWSPredictionsPluginIntegrationTests; productReference = 903555F829141355004B83C2 /* AWSPredictionsPluginIntegrationTests.xctest */; @@ -1118,6 +1156,54 @@ isa = XCSwiftPackageProductDependency; productName = CoreMLPredictionsPlugin; }; + 90CF30492AD47A71006B6FF3 /* Amplify */ = { + isa = XCSwiftPackageProductDependency; + productName = Amplify; + }; + 90CF304B2AD47A74006B6FF3 /* Amplify */ = { + isa = XCSwiftPackageProductDependency; + productName = Amplify; + }; + 90CF304D2AD47A78006B6FF3 /* Amplify */ = { + isa = XCSwiftPackageProductDependency; + productName = Amplify; + }; + 90CF304F2AD47B0E006B6FF3 /* AWSCognitoAuthPlugin */ = { + isa = XCSwiftPackageProductDependency; + productName = AWSCognitoAuthPlugin; + }; + 90CF30512AD47B0E006B6FF3 /* AWSPredictionsPlugin */ = { + isa = XCSwiftPackageProductDependency; + productName = AWSPredictionsPlugin; + }; + 90CF30532AD47B0E006B6FF3 /* CoreMLPredictionsPlugin */ = { + isa = XCSwiftPackageProductDependency; + productName = CoreMLPredictionsPlugin; + }; + 90CF30552AD47B19006B6FF3 /* AWSCognitoAuthPlugin */ = { + isa = XCSwiftPackageProductDependency; + productName = AWSCognitoAuthPlugin; + }; + 90CF30572AD47B19006B6FF3 /* AWSPredictionsPlugin */ = { + isa = XCSwiftPackageProductDependency; + productName = AWSPredictionsPlugin; + }; + 90CF30592AD47B19006B6FF3 /* CoreMLPredictionsPlugin */ = { + isa = XCSwiftPackageProductDependency; + productName = CoreMLPredictionsPlugin; + }; + 90CF305B2AD47B24006B6FF3 /* AWSCognitoAuthPlugin */ = { + isa = XCSwiftPackageProductDependency; + productName = AWSCognitoAuthPlugin; + }; + 90CF305D2AD47B24006B6FF3 /* AWSPredictionsPlugin */ = { + isa = XCSwiftPackageProductDependency; + productName = AWSPredictionsPlugin; + }; + 90CF305F2AD47B24006B6FF3 /* CoreMLPredictionsPlugin */ = { + isa = XCSwiftPackageProductDependency; + productName = CoreMLPredictionsPlugin; + }; /* End XCSwiftPackageProductDependency section */ }; rootObject = 90282FFA2914027000897087 /* Project object */; diff --git a/AmplifyPlugins/Predictions/Tests/PredictionsHostApp/PredictionsHostApp/ContentView.swift b/AmplifyPlugins/Predictions/Tests/PredictionsHostApp/PredictionsHostApp/ContentView.swift index 3af450c8a8..f5b0b64765 100644 --- a/AmplifyPlugins/Predictions/Tests/PredictionsHostApp/PredictionsHostApp/ContentView.swift +++ b/AmplifyPlugins/Predictions/Tests/PredictionsHostApp/PredictionsHostApp/ContentView.swift @@ -9,8 +9,6 @@ import SwiftUI import Amplify struct ContentView: View { - - var body: some View { VStack { Image(systemName: "globe") @@ -22,70 +20,6 @@ struct ContentView: View { .accessibilityLabel("foobar") .padding() } - - func convert() async throws { - let url = URL(string: "")! - let textToSpeech = try await Amplify.Predictions.convert(.textToSpeech("hello, world!")) - _ = textToSpeech - let speechToText = try await Amplify.Predictions.convert(.speechToText(url: url)) - _ = speechToText - } - - func identify() async throws { - let imageURL = URL(string: "")! - let identifyTextOptions = Predictions.Identify.Options( - defaultNetworkPolicy: .auto, - uploadToRemote: false, - pluginOptions: nil - ) - - let text = try await Amplify.Predictions.identify( - .text, - in: imageURL, - options: identifyTextOptions - ) - - _ = text - let celebrities = try await Amplify.Predictions.identify(.celebrities, in: imageURL) - _ = celebrities - let entities = try await Amplify.Predictions.identify(.entities, in: imageURL) - _ = entities - let entitiesFromCollection = try await Amplify.Predictions.identify( - .entitiesFromCollection(withID: ""), - in: imageURL - ) - _ = entitiesFromCollection - let allLabels = try await Amplify.Predictions.identify( - .labels(type: .all), - in: imageURL - ) - _ = allLabels - let labels = try await Amplify.Predictions.identify( - .labels(type: .labels), - in: imageURL - ) - _ = labels - let moderationLabels = try await Amplify.Predictions.identify( - .labels(type: .moderation), - in: imageURL - ) - _ = moderationLabels - let textFromDocAll = try await Amplify.Predictions.identify( - .textInDocument(textFormatType: .all), - in: imageURL - ) - _ = textFromDocAll - let textFromDocForm = try await Amplify.Predictions.identify( - .textInDocument(textFormatType: .form), - in: imageURL - ) - _ = textFromDocForm - let textFromDocTable = try await Amplify.Predictions.identify( - .textInDocument(textFormatType: .table), - in: imageURL - ) - _ = textFromDocTable - } } struct ContentView_Previews: PreviewProvider { From c4e6fa0d3d20c070d9d4c1d20fb422d7827e98c3 Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Mon, 9 Oct 2023 14:33:10 -0400 Subject: [PATCH 14/14] auth hostedui disable parellel test execution --- .../xcshareddata/xcschemes/AuthHostedUIApp.xcscheme | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/AmplifyPlugins/Auth/Tests/AuthHostedUIApp/AuthHostedUIApp.xcodeproj/xcshareddata/xcschemes/AuthHostedUIApp.xcscheme b/AmplifyPlugins/Auth/Tests/AuthHostedUIApp/AuthHostedUIApp.xcodeproj/xcshareddata/xcschemes/AuthHostedUIApp.xcscheme index b919f7e960..bed1ed8b62 100644 --- a/AmplifyPlugins/Auth/Tests/AuthHostedUIApp/AuthHostedUIApp.xcodeproj/xcshareddata/xcschemes/AuthHostedUIApp.xcscheme +++ b/AmplifyPlugins/Auth/Tests/AuthHostedUIApp/AuthHostedUIApp.xcodeproj/xcshareddata/xcschemes/AuthHostedUIApp.xcscheme @@ -30,8 +30,7 @@ shouldAutocreateTestPlan = "YES"> + skipped = "NO">