Skip to content

Conversation

@aajtodd
Copy link
Contributor

@aajtodd aajtodd commented Jun 3, 2022

Issue #

N/A

Description of changes

Added a new e2e test for multipart uploads. I often want to test this feature and always have to go looking for my example. Figure we might as well just add it to our test suite.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@aajtodd aajtodd requested a review from a team as a code owner June 3, 2022 20:47
@aajtodd aajtodd requested review from ianbotsf and lucix-aws June 3, 2022 20:48
@github-actions
Copy link

github-actions bot commented Jun 3, 2022

A new generated diff is ready to view: __generated-main...__generated-multipart-e2etest

@github-actions
Copy link

github-actions bot commented Jun 3, 2022

A new generated diff is ready to view: __generated-main...__generated-multipart-e2etest

Comment on lines 218 to 229
private fun File.chunk(partSize: Int): Sequence<LongRange> {
val totalSize = length()
val firstEndExclusive = minOf(partSize.toLong() + 1, totalSize)
val seed = 0 until firstEndExclusive
return generateSequence(seed) {
if (it.last < totalSize - 1) {
it.last + 1 until minOf(it.last + partSize.toLong() + 1, totalSize)
} else {
null
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This implementation actually grabs partSize + 1 bytes for the first chunk and then partSize bytes for every subsequent chunk.

Could be rewritten/simplified to:

fun File.chunk(size: Long) =
    (0 until length() step size).map {
        it until minOf(it + size, length())
    }

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jun 6, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@github-actions
Copy link

github-actions bot commented Jun 6, 2022

A new generated diff is ready to view: __generated-main...__generated-multipart-e2etest

@aajtodd aajtodd merged commit 3858a5d into main Jun 6, 2022
@aajtodd aajtodd deleted the multipart-e2etest branch June 6, 2022 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants