Skip to content

Commit 87aca3e

Browse files
committed
Improve reliability of failed download test
1 parent d3ec8f7 commit 87aca3e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

core/src/commonIntegrationTest/kotlin/com/powersync/AttachmentsTest.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -559,14 +559,16 @@ class AttachmentsTest {
559559
""",
560560
)
561561

562+
// Depending on when the query updates, we'll see the attachment as queued for
563+
// download or archived.
562564
var attachmentRecord = attachmentQuery.awaitItem().first()
563565
attachmentRecord shouldNotBe null
564566

565-
attachmentRecord.state shouldBe AttachmentState.QUEUED_DOWNLOAD
567+
if (attachmentRecord.state == AttachmentState.QUEUED_DOWNLOAD) {
568+
attachmentRecord = attachmentQuery.awaitItem().first()
569+
}
566570

567571
// The download should fail. We don't specify a retry. The record should be archived.
568-
attachmentRecord = attachmentQuery.awaitItem().first()
569-
570572
attachmentRecord.state shouldBe AttachmentState.ARCHIVED
571573

572574
attachmentQuery.cancelAndIgnoreRemainingEvents()

0 commit comments

Comments
 (0)