Skip to content

TOOLS-4263 Convert mongodump query and data behavior tests to Go - #1102

Draft
autarch wants to merge 1 commit into
08-07-tools-4263_convert_mongodump_flag_validation_tests_to_gofrom
08-10-tools-4263_convert_mongodump_query_and_data_behavior_tests_to_go
Draft

TOOLS-4263 Convert mongodump query and data behavior tests to Go#1102
autarch wants to merge 1 commit into
08-07-tools-4263_convert_mongodump_flag_validation_tests_to_gofrom
08-10-tools-4263_convert_mongodump_query_and_data_behavior_tests_to_go

Conversation

@autarch

@autarch autarch commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Adds integration/dumprestore/dump_behaviors_test.go, extends TestMongoDumpValidateOptions (mongodump/mongodump_test.go) and TestReadDumpServerVersionFromArchive (mongorestore/mongorestore_archive_test.go), and deletes the four JS tests they replace.

JS -> Go mapping:

  • test/qa-tests/jstests/dump/query_extended_json.js -> TestDumpExtendedJSONQuery (integration/dumprestore/dump_behaviors_test.go) - a --query written in extended JSON reaches the server as the BSON type it denotes rather than as the document it looks like, covered table-driven over $date, $regularExpression, $oid, $minKey and $maxKey. Each case inserts one document the query should match and one it should not, and asserts the matched value comes back as the named BSON type; the JS only counted survivors, which a query parsed as the wrong type could satisfy.
  • test/qa-tests/jstests/dump/force_table_scan_tests.js -> TestDumpForceTableScan (integration/dumprestore/dump_behaviors_test.go) and the "forceTableScan together with a query" case of TestMongoDumpValidateOptions (mongodump/mongodump_test.go) - dumping with --forceTableScan while documents are inserted concurrently succeeds, and because the dump uses no index and takes no snapshot the result is only bounded: it holds at least what existed when the dump started and at most what existed when it finished. This is the first coverage of the flag, including that it cannot be combined with --query.
  • test/qa-tests/jstests/dump/options_json.js -> TestDumpStorageEngineOptions (integration/dumprestore/dump_behaviors_test.go) - a collection created with storage-engine options round-trips with those options intact. The JS checked only exit codes and would have passed had the options been silently dropped, so this captures the options the server reports before the dump and asserts they are identical afterwards.
  • test/qa-tests/jstests/dump/version_test.js -> TestReadDumpServerVersionFromArchive (mongorestore/mongorestore_archive_test.go) - the archive format, server and tool versions read out of the prelude are reported in the restore's log. The restore needs -vvv for those lines to be emitted at all, because ParseOptions calls log.SetVerbosity with the options it parsed and so resets the verbosity the package's init() raised.

autarch commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@autarch
autarch force-pushed the 08-07-tools-4263_convert_mongodump_flag_validation_tests_to_go branch from 671c518 to 8b86f2f Compare August 11, 2026 16:19
@autarch
autarch force-pushed the 08-10-tools-4263_convert_mongodump_query_and_data_behavior_tests_to_go branch from 1608c62 to 5c2f350 Compare August 11, 2026 16:19
@autarch
autarch force-pushed the 08-07-tools-4263_convert_mongodump_flag_validation_tests_to_go branch from 8b86f2f to 6e08784 Compare August 11, 2026 17:11
@autarch
autarch force-pushed the 08-10-tools-4263_convert_mongodump_query_and_data_behavior_tests_to_go branch from 5c2f350 to 3642200 Compare August 11, 2026 17:11
@autarch
autarch force-pushed the 08-07-tools-4263_convert_mongodump_flag_validation_tests_to_go branch from 6e08784 to 30437f1 Compare August 12, 2026 18:46
@autarch
autarch force-pushed the 08-10-tools-4263_convert_mongodump_query_and_data_behavior_tests_to_go branch from 3642200 to da91c0a Compare August 12, 2026 18:46
@autarch
autarch force-pushed the 08-10-tools-4263_convert_mongodump_query_and_data_behavior_tests_to_go branch from da91c0a to 33cbdf2 Compare August 20, 2026 15:41
@autarch
autarch force-pushed the 08-07-tools-4263_convert_mongodump_flag_validation_tests_to_go branch from 30437f1 to 27e94fa Compare August 20, 2026 15:41
Adds `integration/dumprestore/dump_behaviors_test.go`, extends `TestMongoDumpValidateOptions` (`mongodump/mongodump_test.go`) and `TestReadDumpServerVersionFromArchive` (`mongorestore/mongorestore_archive_test.go`), and deletes the four JS tests they replace.

JS -> Go mapping:

- `test/qa-tests/jstests/dump/query_extended_json.js` -> `TestDumpExtendedJSONQuery` (`integration/dumprestore/dump_behaviors_test.go`) - a `--query` written in extended JSON reaches the server as the BSON type it denotes rather than as the document it looks like, covered table-driven over `$date`, `$regularExpression`, `$oid`, `$minKey` and `$maxKey`. Each case inserts one document the query should match and one it should not, and asserts the matched value comes back as the named BSON type; the JS only counted survivors, which a query parsed as the wrong type could satisfy.
- `test/qa-tests/jstests/dump/force_table_scan_tests.js` -> `TestDumpForceTableScan` (`integration/dumprestore/dump_behaviors_test.go`) and the "forceTableScan together with a query" case of `TestMongoDumpValidateOptions` (`mongodump/mongodump_test.go`) - dumping with `--forceTableScan` while documents are inserted concurrently succeeds, and because the dump uses no index and takes no snapshot the result is only bounded: it holds at least what existed when the dump started, and strictly fewer than exist once the inserts are stopped. The strict upper bound is the point -- it is what shows the dump read the collection while it was still growing, and it is why the background inserts run for the whole duration of the dump rather than seeding a fixed number of documents up front. This is the first coverage of the flag, including that it cannot be combined with `--query`.
- `test/qa-tests/jstests/dump/options_json.js` -> `TestDumpStorageEngineOptions` (`integration/dumprestore/dump_behaviors_test.go`) - a collection created with storage-engine options round-trips with those options intact. The JS checked only exit codes and would have passed had the options been silently dropped, so this captures the options the server reports before the dump and asserts they are identical afterwards.
- `test/qa-tests/jstests/dump/version_test.js` -> `TestReadDumpServerVersionFromArchive` (`mongorestore/mongorestore_archive_test.go`) - the archive format, server and tool versions read out of the prelude are reported in the restore's log. The restore needs `-vvv` for those lines to be emitted at all, because `ParseOptions` calls `log.SetVerbosity` with the options it parsed and so resets the verbosity the package's `init()` raised.
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.

1 participant