TOOLS-4263 Convert mongorestore oplog-replay edge-case tests to Go - #1060
Merged
autarch merged 1 commit intoAug 12, 2026
Conversation
This was referenced Jul 27, 2026
Collaborator
Author
autarch
force-pushed
the
07-17-tools-4263_convert_mongorestore_oplog-replay_edge-case_tests_to_go
branch
from
August 5, 2026 21:43
8fc1df8 to
cb21dec
Compare
autarch
force-pushed
the
07-16-tools-4263_convert_mongorestore_invalid-input_tests_to_go
branch
from
August 5, 2026 21:43
1507db7 to
b058c9d
Compare
autarch
force-pushed
the
07-16-tools-4263_convert_mongorestore_invalid-input_tests_to_go
branch
from
August 5, 2026 21:47
b058c9d to
aaa2f97
Compare
autarch
force-pushed
the
07-17-tools-4263_convert_mongorestore_oplog-replay_edge-case_tests_to_go
branch
from
August 5, 2026 21:47
cb21dec to
20dc955
Compare
autarch
force-pushed
the
07-16-tools-4263_convert_mongorestore_invalid-input_tests_to_go
branch
2 times, most recently
from
August 6, 2026 19:57
556d7a4 to
3faea21
Compare
autarch
force-pushed
the
07-17-tools-4263_convert_mongorestore_oplog-replay_edge-case_tests_to_go
branch
from
August 6, 2026 21:25
20dc955 to
cdfbc96
Compare
This was referenced Aug 6, 2026
autarch
marked this pull request as ready for review
August 7, 2026 16:12
autarch
force-pushed
the
07-17-tools-4263_convert_mongorestore_oplog-replay_edge-case_tests_to_go
branch
from
August 7, 2026 18:41
cdfbc96 to
2ab1f91
Compare
autarch
force-pushed
the
07-16-tools-4263_convert_mongorestore_invalid-input_tests_to_go
branch
from
August 7, 2026 18:42
3faea21 to
4ce1d14
Compare
autarch
force-pushed
the
07-17-tools-4263_convert_mongorestore_oplog-replay_edge-case_tests_to_go
branch
from
August 7, 2026 18:57
2ab1f91 to
0343320
Compare
mmcclimon
approved these changes
Aug 10, 2026
| "providing two top-priority oplogs errors", | ||
| ) | ||
|
|
||
| count, err := coll.CountDocuments(context.Background(), bson.M{}) |
Collaborator
There was a problem hiding this comment.
(nit agin) Usually we use bson.D here.
| assert.EqualValues(t, 0, count, "no entries are restored when the oplogs conflict") | ||
| } | ||
|
|
||
| // TestOplogReplayPriorityOplog converts oplog_replay_priority_oplog.js: when a |
Collaborator
There was a problem hiding this comment.
I don't think these comments that say "this converts whatever.js" are useful.
|
|
||
| // This test restores the dump_local_oplog fixture, which contains a | ||
| // local/oplog.rs.bson. Writing local.oplog.rs is only allowed on a | ||
| // standalone. Like the JS test this replaces, it is only meaningful there. |
Collaborator
There was a problem hiding this comment.
Needless reference to JS test.
| // preserve_oplog_structure_order.js: replaying an update op whose _id is a | ||
| // multi-field subdocument must preserve the field order, otherwise the server | ||
| // rejects the op (the o._id and o2._id must match). | ||
| func TestOplogReplayPreservesComplexIDOrder(t *testing.T) { |
Collaborator
There was a problem hiding this comment.
The JS version of this tests runs restore 10 times; I'm not totally sure why, but the comment suggests that it might randomly do the correct thing, and that running it multiple times will ensure it's actually doing the right thing. Should we keep that behavior here?
autarch
force-pushed
the
07-16-tools-4263_convert_mongorestore_invalid-input_tests_to_go
branch
from
August 10, 2026 20:44
4ce1d14 to
da61e5a
Compare
autarch
force-pushed
the
07-17-tools-4263_convert_mongorestore_oplog-replay_edge-case_tests_to_go
branch
from
August 10, 2026 20:44
0343320 to
aa0f959
Compare
autarch
force-pushed
the
07-16-tools-4263_convert_mongorestore_invalid-input_tests_to_go
branch
from
August 10, 2026 21:22
da61e5a to
616ab13
Compare
autarch
force-pushed
the
07-17-tools-4263_convert_mongorestore_oplog-replay_edge-case_tests_to_go
branch
2 times, most recently
from
August 11, 2026 17:11
4d1d9e4 to
5b3c649
Compare
autarch
force-pushed
the
07-16-tools-4263_convert_mongorestore_invalid-input_tests_to_go
branch
from
August 11, 2026 17:11
616ab13 to
4156951
Compare
Collaborator
Author
autarch
changed the base branch from
07-16-tools-4263_convert_mongorestore_invalid-input_tests_to_go
to
graphite-base/1060
August 12, 2026 18:37
The JS -> Go mapping (all under `test/qa-tests/jstests/restore`):
- oplog_replay_conflict.js -> TestOplogReplayConflict
(an embedded oplog plus --oplogFile must fail and apply no data)
- oplog_replay_priority_oplog.js -> TestOplogReplayPriorityOplog
(only the higher-priority --oplogFile entries are applied)
- oplog_replay_noop.js -> TestOplogReplayNoop
(noop entries are skipped, inserts applied)
- preserve_oplog_structure_order.js -> TestOplogReplayPreservesComplexIDOrder
(an update op with a multi-field subdocument _id preserves field
order; the doc is pre-inserted on 8.1+ per SERVER-88158)
- oplog_replay_size_safety.js -> TestOplogReplaySizeSafety
(reduced matrix: 50k small ops + 8 ~1MB ops; the JS swept up to a
million ops)
This also moves some fixtures under `mongorestore/testdata`. Move fixtures dump_oplog_conflict, dump_local_oplog, dump_with_noop_in_oplog, dump_with_complex_id_oplog, and extra_oplog.bson into mongorestore/testdata/.
The `oplog_replay_local_rs.js` and `dumprestore7.js` tests are not included in this conversion; they require a replica-set topology and will be converted separately.
autarch
force-pushed
the
07-17-tools-4263_convert_mongorestore_oplog-replay_edge-case_tests_to_go
branch
from
August 12, 2026 18:39
5b3c649 to
48f39e4
Compare
autarch
deleted the
07-17-tools-4263_convert_mongorestore_oplog-replay_edge-case_tests_to_go
branch
August 12, 2026 18:40
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.

Adds five tests in
mongorestore/oplog_edges_test.gocovering mongorestore's oplog-replay edge cases, and moves the BSON fixtures these tests need fromtest/qa-tests/jstests/restore/testdata/tomongorestore/testdata/. This also addstestutil.SkipUnlessStandaloneincommon/testutil/testutil.go: restoring a dumpedlocal/oplog.rs.bsonas a collection only works on a standalone, because a replica set rejects direct writes tolocal.oplog.rsandmongosrejects writes to thelocaldatabase and does not supportapplyOps. Evergreen'sintegration-*-clustervariants are replica sets, so the affected test skips there.JS -> Go mapping (all Go tests live in
mongorestore/oplog_edges_test.go):test/qa-tests/jstests/restore/oplog_replay_conflict.js->TestOplogReplayConflict- a dump that contains an embeddedoplog.bsonand is also given an explicit--oplogFilemust fail, and must apply no data at all.test/qa-tests/jstests/restore/oplog_replay_priority_oplog.js->TestOplogReplayPriorityOplog- when both an embedded oplog and a higher-priority--oplogFileare available, only the entries from the--oplogFileare applied. Standalone only, per the skip described above.test/qa-tests/jstests/restore/oplog_replay_noop.js->TestOplogReplayNoop- noop oplog entries are skipped during replay while the surrounding inserts are applied.test/qa-tests/jstests/restore/preserve_oplog_structure_order.js->TestOplogReplayPreservesComplexIDOrder- an update op whose_idis a multi-field subdocument preserves that subdocument's field order through replay, so the op matches the intended document. The document is pre-inserted on server 8.1+ per SERVER-88158.test/qa-tests/jstests/restore/oplog_replay_size_safety.js->TestOplogReplaySizeSafety- replay batches ops without exceeding the server's message size limit. The matrix is reduced to 50k small ops plus 8 roughly 1MB ops; the JS version swept up to a million ops, which is far slower for the same signal.