Skip to content

TOOLS-4278 Convert mongorestore metadata and archive tests to testify - #1078

Draft
autarch wants to merge 1 commit into
TOOLS-4278-convey-to-testify-mongoimport-main-3from
TOOLS-4278-convey-to-testify-mongorestore-metadata-archive
Draft

TOOLS-4278 Convert mongorestore metadata and archive tests to testify#1078
autarch wants to merge 1 commit into
TOOLS-4278-convey-to-testify-mongoimport-main-3from
TOOLS-4278-convey-to-testify-mongorestore-metadata-archive

Conversation

@autarch

@autarch autarch commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

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.

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.

autarch commented Aug 6, 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.

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