Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
sebaland committed Sep 6, 2024
1 parent eca7cfe commit 5301c27
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/composite_actions/run_xcodebuild_test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ runs:
xcode-select -p
xcodebuild -version
xcodebuild $action -scheme $SCHEME -sdk '${{ inputs.sdk }}' -destination '${{ inputs.destination }}' ${{ inputs.other_flags }} $clonedSourcePackagesPath $derivedDataPath $coverageFlags | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]}
xcodebuild $action -scheme $SCHEME -sdk '${{ inputs.sdk }}' -destination '${{ inputs.destination }}' ${{ inputs.other_flags }} $clonedSourcePackagesPath $derivedDataPath $coverageFlags && exit ${PIPESTATUS[0]}
shell: bash

- name: Generate Coverage report
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build_amplify_swift_platforms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ on:
required: true
default: true
type: boolean
push:
branches-ignore:
- main
- release
# push:
# branches-ignore:
# - main
# - release

permissions:
contents: read
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/fortify_scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ on:
required: true
type: string

push:
branches-ignore:
- main
- release
# push:
# branches-ignore:
# - main
# - release

permissions:
id-token: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integ_test_storage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ jobs:
platform: ${{ matrix.platform }}
project_path: ./AmplifyPlugins/Storage/Tests/StorageHostApp/
resource_subfolder: storage
timeout-minutes: 30
timeout-minutes: 10
secrets: inherit
8 changes: 4 additions & 4 deletions .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ on:
required: true
default: true
type: boolean
push:
branches-ignore:
- main
- release
# push:
# branches-ignore:
# - main
# - release

permissions:
contents: read
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ class AWSS3StoragePluginBasicIntegrationTests: AWSS3StoragePluginTestBase {
let fileURL = URL(fileURLWithPath: filePath)
FileManager.default.createFile(atPath: filePath, contents: Data(key.utf8), attributes: nil)

_ = try await Amplify.Storage.uploadFile(key: key, local: fileURL, options: nil).value
_ = try await Amplify.Storage.remove(key: key)
await waitTasks(timeout: 10) {
_ = try await Amplify.Storage.uploadFile(key: key, local: fileURL, options: nil).value
_ = try await Amplify.Storage.remove(key: key)
}

// Only the remove operation results in an SDK request
XCTAssertEqual(requestRecorder.sdkRequests.map { $0.method} , [.delete])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,20 @@ class AWSS3StoragePluginTestBase: XCTestCase {
}
}

func waitTasks(timeout: TimeInterval, closure: @escaping () async throws -> ()) async {
let expectation = expectation(description: "Operation expectation")
Task {
defer { expectation.fulfill() }
do {
try await closure()
} catch {
XCTFail("Unexpected error: \(error)")
}
}

await fulfillment(of: [expectation], timeout: timeout)
}

private func invalidateCurrentSession() {
Self.logger.debug("Invalidating URLSession")
guard let plugin = try? Amplify.Storage.getPlugin(for: "awsS3StoragePlugin") as? AWSS3StoragePlugin,
Expand Down

0 comments on commit 5301c27

Please sign in to comment.