Repository navigation
test(r2): run the multipart upload test - #1155
Open
instantraaamen wants to merge 1 commit into
Open
instantraaamen wants to merge 1 commit into
instantraaamen wants to merge 1 commit into
Conversation
The /r2/put-multipart route was registered but no spec requested it. It also could not pass: it numbered parts from 0, and its first two parts had different sizes. Number the parts from 1, give the leading parts the same size, and call the route from r2.spec.ts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
test/src/r2.rshasput_multipart, andtest/src/router.rsregisters it at/r2/put-multipart, but nothing intest/tests/r2.spec.tsrequests that route. Multipart upload has no test that runs.The route could not pass as written. Calling it gives:
It numbers its parts
0, 1, 2, and its sizes are5MiB+100, 5MiB+200, 500, while every part except the last has to be the same size. Both points were raised in the comments of #273, which was closed without being merged.Fix
test/src/r2.rs: number the parts from 1, make the first two parts the same size, and adjust the byte assertions to the new sizes.test/tests/r2.spec.ts: add aput multiparttest that calls the route.No change to the
workercrate, so no changeset.Tests
npm teston macOS: with only the spec calling the route,put multipartfails with the error above; with the route fixed as well it passes.npm run lintandcargo fmt --all --checkpass. One test fails for me with and without this change:socket.spec.ts"read", because port 8080 is taken on my machine.I checked the equal-size rule in a separate Worker, not through this suite: the original route stops at the part number before it gets that far.
resume_multipart_uploadhas no test either. I left it out to keep this small, and can add a route for it here or in a follow-up if that is wanted.Found while evaluating workers-rs for an existing TypeScript Worker: I wrote the same routes in both and compared the results. With 1-based parts of equal size, resumed by id across separate requests, workers-rs 0.9.0 matched JavaScript for upload,
complete, reading across a part boundary,aborttwice, a part sent to an aborted upload, andcompletewith a wrong etag. The one difference I found is in a follow-up PR stacked on this one.