Skip to content
Merged

fix ci #17957

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ class DocumentsStorageProviderIT : AbstractOnServerIT() {
it!!.write(content2)
}

awaitWriteSaved(file1, content2.size.toLong())

// read back content bytes
val bytes = contentResolver.openInputStream(file1.uri)?.readBytes() ?: ByteArray(0)
assertEquals(String(content2), String(bytes))
Expand Down Expand Up @@ -304,6 +306,18 @@ class DocumentsStorageProviderIT : AbstractOnServerIT() {
fail("upload of $remotePath did not finish, stored uploads: ${describeUploads()}")
}

private fun awaitWriteSaved(file: DocumentFile, expectedLength: Long) {
repeat(UPLOAD_POLL_ATTEMPTS) {
if (file.getOCFile(storageManager)?.fileLength == expectedLength) {
return
}

shortSleep()
}

fail("write of ${file.uri} was not saved with length $expectedLength")
}

private fun upload(remotePath: String): OCUpload? = uploadsStorageManager
.getUploadsForAccount(user.accountName)
.firstOrNull { it.remotePath == remotePath }
Expand Down
Loading