TOOLS-4263 Convert mongofiles put and storage-option tests to Go - #1138
Draft
Conversation
This was referenced Aug 20, 2026
Collaborator
Author
This was referenced Aug 20, 2026
autarch
force-pushed
the
08-14-tools-4263_convert_mongofiles_put_and_storage-option_tests_to_go
branch
from
August 25, 2026 15:30
32f6e70 to
8b67494
Compare
autarch
force-pushed
the
08-13-tools-4263_drop_the_mopt_alias_for_the_driver_s_options_package
branch
from
August 25, 2026 15:30
6015ed4 to
468ae05
Compare
This was referenced Aug 25, 2026
autarch
force-pushed
the
08-13-tools-4263_drop_the_mopt_alias_for_the_driver_s_options_package
branch
from
August 25, 2026 20:10
468ae05 to
76d1300
Compare
autarch
force-pushed
the
08-14-tools-4263_convert_mongofiles_put_and_storage-option_tests_to_go
branch
from
August 25, 2026 20:10
8b67494 to
182aae0
Compare
Six `jstests/files` tests covered mongofiles' storage options — `--replace`, `--prefix`, `--type`, `--db`, `--local` — and putting a file much larger than one GridFS chunk. This replaces them with testify tests in the `mongofiles` package, in a new file so the existing GoConvey blocks are left alone. * `test/qa-tests/jstests/files/mongofiles_replace.js` -> `TestPutReplace` and `TestPutIDRejectsDuplicateID` in `mongofiles/put_options_test.go` - three puts of one file leave three `fs.files` docs, `--replace` collapses them to one and leaves one copy of each other file, and a second `put_id` with the same `_id` fails with a duplicate-key error without disturbing that file's chunks. * `test/qa-tests/jstests/files/mongofiles_prefix.js` -> `TestGridFSPrefix` - a default put writes to `fs.*`, `--prefix custom` writes to `custom.files` and `custom.chunks` and nothing to `fs.files`, and a get through the same prefix returns identical bytes. * `test/qa-tests/jstests/files/mongofiles_type.js` -> `TestPutContentType` - `--type` is stored as `metadata.contentType`, a put without it stores no content type, and the typed file still round-trips byte for byte. * `test/qa-tests/jstests/files/mongofiles_db.js` -> `TestPutIntoOtherDB` - both puts land in the database named by `--db` and the default database stays empty. * `test/qa-tests/jstests/files/mongofiles_local.js` -> `TestPutLocalFileName` and `TestEmptyLocalFileName` - `--local` supplies the bytes while the positional argument names the GridFS file, a missing `--local` path is an error, and an empty `--local` falls back to the GridFS name for both put (an error when no local file has that name) and get. * `test/qa-tests/jstests/files/mongofiles_put.js` -> `TestPutLargeFile` - a 40MB file is stored with the right `length` and `ceil(length/chunkSize)` chunks and comes back byte for byte, and putting a directory fails. The JS tests drove the compiled binary and so also exercised flag parsing (`-d`, `-t`, `-l`) and ran against standalone, replica set and sharded topologies with and without auth. Like the rest of this package, the Go tests build `MongoFiles` values directly, so they cover the option behavior but not the flag wiring, and they run against whichever server the integration suite is pointed at. The `jstests/files/*.js` glob in the resmoke suites still matches the JS tests that have yet to be converted, so no suite config changes are needed yet. The JS tests also asserted that an empty `--local` fails on Windows while it succeeds elsewhere, without recording why. They passed a path with a directory component; `TestEmptyLocalFileName` uses a bare file name in a temporary working directory, where `getLocalFileName`'s fallback has nothing platform-specific left in it, so no Windows branch is carried over.
autarch
force-pushed
the
08-13-tools-4263_drop_the_mopt_alias_for_the_driver_s_options_package
branch
from
August 25, 2026 20:18
76d1300 to
b2f6ffa
Compare
autarch
force-pushed
the
08-14-tools-4263_convert_mongofiles_put_and_storage-option_tests_to_go
branch
from
August 25, 2026 20:18
182aae0 to
5666277
Compare
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.

Six
jstests/filestests covered mongofiles' storage options —--replace,--prefix,--type,--db,--local— and putting a file much larger than oneGridFS chunk. This replaces them with testify tests in the
mongofilespackage,in a new file so the existing GoConvey blocks are left alone.
test/qa-tests/jstests/files/mongofiles_replace.js->TestPutReplaceandTestPutIDRejectsDuplicateIDinmongofiles/put_options_test.go- three putsof one file leave three
fs.filesdocs,--replacecollapses them to one andleaves one copy of each other file, and a second
put_idwith the same_idfails with a duplicate-key error without disturbing that file's chunks.
test/qa-tests/jstests/files/mongofiles_prefix.js->TestGridFSPrefix- adefault put writes to
fs.*,--prefix customwrites tocustom.filesandcustom.chunksand nothing tofs.files, and a get through the same prefixreturns identical bytes.
test/qa-tests/jstests/files/mongofiles_type.js->TestPutContentType---typeis stored asmetadata.contentType, a put without it stores nocontent type, and the typed file still round-trips byte for byte.
test/qa-tests/jstests/files/mongofiles_db.js->TestPutIntoOtherDB- bothputs land in the database named by
--dband the default database staysempty.
test/qa-tests/jstests/files/mongofiles_local.js->TestPutLocalFileNameand
TestEmptyLocalFileName---localsupplies the bytes while thepositional argument names the GridFS file, a missing
--localpath is anerror, and an empty
--localfalls back to the GridFS name for both put(an error when no local file has that name) and get.
test/qa-tests/jstests/files/mongofiles_put.js->TestPutLargeFile- a 40MBfile is stored with the right
lengthandceil(length/chunkSize)chunks andcomes back byte for byte, and putting a directory fails.
The JS tests drove the compiled binary and so also exercised flag parsing (
-d,-t,-l) and ran against standalone, replica set and sharded topologies withand without auth. Like the rest of this package, the Go tests build
MongoFilesvalues directly, so they cover the option behavior but not the flag wiring, and
they run against whichever server the integration suite is pointed at.
The
jstests/files/*.jsglob in the resmoke suites still matches the JS teststhat have yet to be converted, so no suite config changes are needed yet.