Skip to content

Commit d9673d2

Browse files
authored
fix(Storage): increase testTask timeout and network timeout (#2446)
1 parent 48d010e commit d9673d2

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

AmplifyAsyncTesting/Sources/AsyncTesting/XCTestCase+AsyncTesting.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import XCTest
1010

1111
extension XCTestCase {
1212
public static let defaultTimeoutForAsyncExpectations = TimeInterval(60)
13-
public static let defaultNetworkTimeoutForAsyncExpectations = TimeInterval(10)
13+
public static let defaultNetworkTimeoutForAsyncExpectations = TimeInterval(300)
1414

1515
/// Creates a new async expectation with an associated description.
1616
///

AmplifyPlugins/Storage/Tests/StorageHostApp/AWSS3StoragePluginIntegrationTests/Helpers/TestConfigHelper.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ class TestConfigHelper {
3939
}
4040

4141
class TestCommonConstants {
42-
static let networkTimeout = TimeInterval(180)
42+
static let networkTimeout = TimeInterval(300)
4343
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class AWSS3StoragePluginDownloadDataResumabilityTests: AWSS3StoragePluginTestBas
1818
/// When: Call the get API then pause
1919
/// Then: The operation is stalled (no progress, completed, or failed event)
2020
func testDownloadDataAndPause() async throws {
21-
try await testTask {
21+
try await testTask(timeout: 300) {
2222
let key = UUID().uuidString
2323
let data = AWSS3StoragePluginTestBase.smallDataObject
2424
let uploadKey = try await Amplify.Storage.uploadData(key: key, data: data).value
@@ -44,7 +44,7 @@ class AWSS3StoragePluginDownloadDataResumabilityTests: AWSS3StoragePluginTestBas
4444
}
4545
}
4646
await waitForExpectations([didPause], timeout: TestCommonConstants.networkTimeout)
47-
await waitForExpectations([didContinue])
47+
await waitForExpectations([didContinue], timeout: 5)
4848

4949
let completeInvoked = asyncExpectation(description: "Download is completed", isInverted: true)
5050
let downloadTask = Task {
@@ -70,7 +70,7 @@ class AWSS3StoragePluginDownloadDataResumabilityTests: AWSS3StoragePluginTestBas
7070
/// When: Call the downloadData API, pause, and then resume the operation
7171
/// Then: The operation should complete successfully
7272
func testDownloadDataAndPauseThenResume() async throws {
73-
try await testTask {
73+
try await testTask(timeout: 300) {
7474
let key = UUID().uuidString
7575
let data = AWSS3StoragePluginTestBase.smallDataObject
7676
let uploadKey = try await Amplify.Storage.uploadData(key: key, data: data).value
@@ -123,7 +123,7 @@ class AWSS3StoragePluginDownloadDataResumabilityTests: AWSS3StoragePluginTestBas
123123
/// When: Call the get API then cancel the operation,
124124
/// Then: The operation should not complete or fail.
125125
func testDownloadDataAndCancel() async throws {
126-
try await testTask {
126+
try await testTask(timeout: 300) {
127127
let key = UUID().uuidString
128128
let data = AWSS3StoragePluginTestBase.smallDataObject
129129
let uploadKey = try await Amplify.Storage.uploadData(key: key, data: data).value
@@ -149,7 +149,7 @@ class AWSS3StoragePluginDownloadDataResumabilityTests: AWSS3StoragePluginTestBas
149149
}
150150
}
151151
await waitForExpectations([didCancel], timeout: TestCommonConstants.networkTimeout)
152-
await waitForExpectations([didContinue])
152+
await waitForExpectations([didContinue], timeout: 5)
153153

154154
let completeInvoked = asyncExpectation(description: "Download is completed", isInverted: true)
155155
let downloadTask = Task {

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class AWSS3StoragePluginUploadDataResumabilityTests: AWSS3StoragePluginTestBase
1717
/// When: Call the put API and pause the operation
1818
/// Then: The operation is stalled (no progress, completed, or failed event)
1919
func testUploadLargeDataThenPause() async throws {
20-
try await testTask {
20+
try await testTask(timeout: 300) {
2121
let key = UUID().uuidString
2222
Self.logger.debug("Uploading data")
2323
let task = try await Amplify.Storage.uploadData(key: key, data: AWSS3StoragePluginTestBase.largeDataObject)
@@ -39,7 +39,7 @@ class AWSS3StoragePluginUploadDataResumabilityTests: AWSS3StoragePluginTestBase
3939
}
4040
}
4141
await waitForExpectations([didPause], timeout: TestCommonConstants.networkTimeout)
42-
await waitForExpectations([didContinue])
42+
await waitForExpectations([didContinue], timeout: 5)
4343

4444
let completeInvoked = asyncExpectation(description: "Upload is completed", isInverted: true)
4545
let uploadTask = Task {
@@ -65,7 +65,7 @@ class AWSS3StoragePluginUploadDataResumabilityTests: AWSS3StoragePluginTestBase
6565
/// When: Call the put API, pause, and then resume the operation,
6666
/// Then: The operation should complete successfully
6767
func testUploadLargeDataAndPauseThenResume() async throws {
68-
try await testTask {
68+
try await testTask(timeout: 300) {
6969
let key = UUID().uuidString
7070
Self.logger.debug("Uploading data")
7171
let task = try await Amplify.Storage.uploadData(key: key, data: AWSS3StoragePluginTestBase.largeDataObject)
@@ -112,7 +112,7 @@ class AWSS3StoragePluginUploadDataResumabilityTests: AWSS3StoragePluginTestBase
112112
/// When: Call the put API, pause, and then resume tthe operation,
113113
/// Then: The operation should complete successfully
114114
func testUploadLargeDataAndCancel() async throws {
115-
try await testTask {
115+
try await testTask(timeout: 300) {
116116
let key = UUID().uuidString
117117
Self.logger.debug("Uploading data")
118118
let task = try await Amplify.Storage.uploadData(key: key, data: AWSS3StoragePluginTestBase.largeDataObject)
@@ -134,7 +134,7 @@ class AWSS3StoragePluginUploadDataResumabilityTests: AWSS3StoragePluginTestBase
134134
}
135135
}
136136
await waitForExpectations([didCancel], timeout: TestCommonConstants.networkTimeout)
137-
await waitForExpectations([didContinue])
137+
await waitForExpectations([didContinue], timeout: 5)
138138

139139
let completeInvoked = asyncExpectation(description: "Upload is completed", isInverted: true)
140140
let uploadTask = Task {

0 commit comments

Comments
 (0)