TOOLS-4278 Convert mongorestore metadata and archive tests to testify - #1078
Draft
autarch wants to merge 1 commit into
Conversation
Converts mongorestore/metadata_test.go and mongorestore_archive_test.go, including the 11 direct t.Fatal/t.Errorf assertions in the two files. The other mongorestore test files stay on GoConvey for now. TestCollectionExists had the only Reset. It was registered inside the "and some test data in a server" block, so it ran on one of the two execution paths, not both. The replacement registers its t.Cleanup in that subtest alone rather than in the shared helper, so the drop still runs on exactly the leaves it used to. That cleanup uses assert, not require. require calls FailNow, which is runtime.Goexit, and that unwinds out of the cleanup runner and skips every cleanup registered earlier -- here it would have stranded the session provider's Close. The Reset it replaces had no such effect, since a failing So still left the surrounding defers to run. TestGetDumpAuthVersion's cases collapse into two tables. That drops 8 call sites while preserving all 15 runtime assertions. 52 runtime assertions before and after. No behavior change. TestReadDumpServerVersionFromArchive still fails locally against a git-built mongod, as it does on master. See the pre-existing issues doc.
This was referenced Aug 6, 2026
Collaborator
Author
This was referenced Aug 6, 2026
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.

Converts mongorestore/metadata_test.go and mongorestore_archive_test.go,
including the 11 direct t.Fatal/t.Errorf assertions in the two files.
The other mongorestore test files stay on GoConvey for now.
TestCollectionExists had the only Reset. It was registered inside the
"and some test data in a server" block, so it ran on one of the two
execution paths, not both. The replacement registers its t.Cleanup in
that subtest alone rather than in the shared helper, so the drop still
runs on exactly the leaves it used to.
That cleanup uses assert, not require. require calls FailNow, which is
runtime.Goexit, and that unwinds out of the cleanup runner and skips
every cleanup registered earlier -- here it would have stranded the
session provider's Close. The Reset it replaces had no such effect,
since a failing So still left the surrounding defers to run.
TestGetDumpAuthVersion's cases collapse into two tables. That drops 8
call sites while preserving all 15 runtime assertions.
52 runtime assertions before and after. No behavior change.
TestReadDumpServerVersionFromArchive still fails locally against a
git-built mongod, as it does on master. See the pre-existing issues doc.