Skip to content

Commit 61b2a2c

Browse files
authored
fix(storage): fix upload/download integration tests (#2457)
1 parent 361ba1d commit 61b2a2c

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

AmplifyPlugins/Storage/Tests/StorageHostApp/AWSS3StoragePluginIntegrationTests/ResumabilityTests/AWSS3StoragePluginGetDataResumabilityTests.swift

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,18 @@ class AWSS3StoragePluginDownloadDataResumabilityTests: AWSS3StoragePluginTestBas
3131
let didContinue = asyncExpectation(description: "did continue", isInverted: true)
3232
Task {
3333
var paused = false
34-
var continued = false
34+
var progressAfterPause = 0
3535
for await progress in await task.progress {
36-
if !paused, progress.fractionCompleted > 0.1 {
36+
Self.logger.debug("progress: \(progress)")
37+
if !paused {
3738
paused = true
3839
task.pause()
3940
await didPause.fulfill()
40-
} else if paused, !continued, progress.fractionCompleted > 0.5 {
41-
continued = true
42-
await didContinue.fulfill()
41+
} else {
42+
progressAfterPause += 1
43+
if progressAfterPause > 1 {
44+
await didContinue.fulfill()
45+
}
4346
}
4447
}
4548
}

AmplifyPlugins/Storage/Tests/StorageHostApp/AWSS3StoragePluginIntegrationTests/ResumabilityTests/AWSS3StoragePluginPutDataResumabilityTests.swift

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,18 @@ class AWSS3StoragePluginUploadDataResumabilityTests: AWSS3StoragePluginTestBase
2626
let didContinue = asyncExpectation(description: "did continue", isInverted: true)
2727
Task {
2828
var paused = false
29-
var continued = false
29+
var progressAfterPause = 0
3030
for await progress in await task.progress {
31-
if !paused, progress.fractionCompleted > 0.1 {
31+
Self.logger.debug("progress: \(progress)")
32+
if !paused {
3233
paused = true
3334
task.pause()
3435
await didPause.fulfill()
35-
} else if paused, !continued, progress.fractionCompleted > 0.5 {
36-
continued = true
37-
await didContinue.fulfill()
36+
} else {
37+
progressAfterPause += 1
38+
if progressAfterPause > 1 {
39+
await didContinue.fulfill()
40+
}
3841
}
3942
}
4043
}

0 commit comments

Comments
 (0)