TOOLS-4263 Convert the oplog replay and limit restore test to Go - #1162
Conversation
This was referenced Aug 25, 2026
Collaborator
Author
This was referenced Aug 25, 2026
autarch
force-pushed
the
08-21-tools-4263_convert_the_oplog_replay_and_limit_restore_test_to_go
branch
from
August 25, 2026 20:10
646e40f to
b69d4ed
Compare
autarch
force-pushed
the
08-21-tools-4263_convert_the_replica-set_routing_and_no-primary_import_tests_to_go
branch
from
August 25, 2026 20:10
dec9db1 to
831ae22
Compare
- `test/qa-tests/jstests/restore/oplog_replay_and_limit.js` -> `mongorestore/oplog_limit_test.go` - one dump restored three ways: without `--oplogReplay`, with it, and with it plus an `--oplogLimit` falling between two of the oplog entries. The three together pin down what the limit does, since the only difference between the cases is which documents come back. Each case asserts the exact set of `_id`s in the collection, where the JS counted each `_id` it expected, so the Go test also catches a document that should not be there. - `test/qa-tests/jstests/restore/testdata/dump_with_oplog/` - deleted. The dump is now built in the test with `testDumpDir`, which the package already uses for this, so the timestamps the limit is chosen against are visible in the test rather than sitting in a checked-in BSON file. They are the same values the deleted dump held: four entries an instant apart and a fifth from decades later. The JS file is deleted. Coverage notes: the old dump directory carried a `data.metadata.json` and a `system.indexes.bson`, and the built one carries no metadata. The JS test asserted nothing about either, so no assertion is lost, but the collection-options and index half of the restore is not exercised here; `metadata_test.go` covers that. The old dump directory also stored the `_id`s as BSON doubles where these are int32, which nothing asserted either. The JS test skipped itself under the archive and gzip dump targets, because it read a checked-in uncompressed directory. That does not carry over: the Go test builds the directory it reads.
autarch
force-pushed
the
08-21-tools-4263_convert_the_replica-set_routing_and_no-primary_import_tests_to_go
branch
from
August 25, 2026 20:18
831ae22 to
89071fc
Compare
autarch
force-pushed
the
08-21-tools-4263_convert_the_oplog_replay_and_limit_restore_test_to_go
branch
from
August 25, 2026 20:18
b69d4ed to
4e8a9c0
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.

test/qa-tests/jstests/restore/oplog_replay_and_limit.js->mongorestore/oplog_limit_test.go- one dump restored three ways: without--oplogReplay, with it, and with it plus an--oplogLimitfalling between two of the oplog entries. The three together pin down what the limit does, since the only difference between the cases is which documents come back. Each case asserts the exact set of_ids in the collection, where the JS counted each_idit expected, so the Go test also catches a document that should not be there.test/qa-tests/jstests/restore/testdata/dump_with_oplog/- deleted. The dump is now built in the test withtestDumpDir, which the package already uses for this, so the timestamps the limit is chosen against are visible in the test rather than sitting in a checked-in BSON file. They are the same values the deleted dump held: four entries an instant apart and a fifth from decades later.The JS file is deleted.
Coverage notes: the old dump directory carried a
data.metadata.jsonand asystem.indexes.bson, and the built one carries no metadata. The JS test assertednothing about either, so no assertion is lost, but the collection-options and index
half of the restore is not exercised here;
metadata_test.gocovers that. The olddump directory also stored the
_ids as BSON doubles where these are int32,which nothing asserted either.
The JS test skipped itself under the archive and gzip dump targets, because it read
a checked-in uncompressed directory. That does not carry over: the Go test builds
the directory it reads.