Skip to content

TOOLS-4263 Convert the oplog replay and limit restore test to Go - #1162

Draft
autarch wants to merge 1 commit into
08-21-tools-4263_convert_the_replica-set_routing_and_no-primary_import_tests_to_gofrom
08-21-tools-4263_convert_the_oplog_replay_and_limit_restore_test_to_go
Draft

TOOLS-4263 Convert the oplog replay and limit restore test to Go#1162
autarch wants to merge 1 commit into
08-21-tools-4263_convert_the_replica-set_routing_and_no-primary_import_tests_to_gofrom
08-21-tools-4263_convert_the_oplog_replay_and_limit_restore_test_to_go

Conversation

@autarch

@autarch autarch commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator
  • 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 _ids 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 _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.

autarch commented Aug 25, 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-21-tools-4263_convert_the_oplog_replay_and_limit_restore_test_to_go branch from 646e40f to b69d4ed Compare August 25, 2026 20:10
@autarch
autarch force-pushed the 08-21-tools-4263_convert_the_replica-set_routing_and_no-primary_import_tests_to_go branch from dec9db1 to 831ae22 Compare August 25, 2026 20:10
- `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
autarch force-pushed the 08-21-tools-4263_convert_the_replica-set_routing_and_no-primary_import_tests_to_go branch from 831ae22 to 89071fc Compare August 25, 2026 20:18
@autarch
autarch force-pushed the 08-21-tools-4263_convert_the_oplog_replay_and_limit_restore_test_to_go branch from b69d4ed to 4e8a9c0 Compare August 25, 2026 20:18
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