Skip to content

Commit c2ae0e3

Browse files
committed
test(storage): add integration tests for progress stall timeout uploads
Cover the happy path for both single-part and multipart S3 uploads when a ProgressStallTimeout is set on the upload options. The stall timer must not break a successful upload; these tests assert that the option flows end-to-end through the worker pipeline without affecting normal completion. Mirrors the unit-tested integration coverage retained in the iOS PR.
1 parent 05f6185 commit c2ae0e3

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

aws-storage-s3/src/androidTest/java/com/amplifyframework/storage/s3/AWSS3StoragePathUploadTest.kt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import com.amplifyframework.core.async.Resumable
2323
import com.amplifyframework.hub.HubChannel
2424
import com.amplifyframework.hub.HubEvent
2525
import com.amplifyframework.hub.SubscriptionToken
26+
import com.amplifyframework.storage.ProgressStallTimeout
2627
import com.amplifyframework.storage.StorageCategory
2728
import com.amplifyframework.storage.StorageChannelEventName
2829
import com.amplifyframework.storage.StorageException
@@ -363,6 +364,38 @@ class AWSS3StoragePathUploadTest : DeviceFarmTestBase() {
363364
)
364365
}
365366

367+
/**
368+
* Given: A progress stall timeout configured on upload options
369+
* When: A small file is uploaded over the network
370+
* Then: The upload completes successfully (the stall timer must not break the happy path)
371+
*/
372+
@Test
373+
fun testUploadSmallFileWithProgressStallTimeoutOptionCompletesSuccessfully() {
374+
val uploadFile: File = RandomTempFile(SMALL_FILE_SIZE)
375+
storagePath = StoragePath.fromString("public/${uploadFile.name}")
376+
val options = AWSS3StorageUploadFileOptions.builder()
377+
.progressStallTimeout(ProgressStallTimeout.Interval(120))
378+
.build()
379+
380+
synchronousStorage.uploadFile(storagePath, uploadFile, options)
381+
}
382+
383+
/**
384+
* Given: A progress stall timeout configured on upload options for a multipart upload
385+
* When: A file larger than the multipart threshold is uploaded
386+
* Then: The upload completes successfully across all parts
387+
*/
388+
@Test
389+
fun testUploadLargeFileWithProgressStallTimeoutOptionCompletesSuccessfully() {
390+
val uploadFile: File = RandomTempFile(LARGE_FILE_SIZE)
391+
storagePath = StoragePath.fromString("public/${uploadFile.name}")
392+
val options = AWSS3StorageUploadFileOptions.builder()
393+
.progressStallTimeout(ProgressStallTimeout.Interval(120))
394+
.build()
395+
396+
synchronousStorage.uploadFile(storagePath, uploadFile, options, EXTENDED_TIMEOUT_MS)
397+
}
398+
366399
@Test(expected = StorageException::class)
367400
fun testUploadUnauthenticatedProtectedAccess() {
368401
val uploadFile: File = RandomTempFile(SMALL_FILE_SIZE)

0 commit comments

Comments
 (0)