Skip to content

TOOLS-4278 Convert mongodump BSON and metadata tests to testify - #1086

Draft
autarch wants to merge 1 commit into
TOOLS-4278-convey-to-testify-mongofiles-2from
TOOLS-4278-convey-to-testify-mongodump-1
Draft

TOOLS-4278 Convert mongodump BSON and metadata tests to testify#1086
autarch wants to merge 1 commit into
TOOLS-4278-convey-to-testify-mongofiles-2from
TOOLS-4278-convey-to-testify-mongodump-1

Conversation

@autarch

@autarch autarch commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Converts TestMongoDumpBSON, TestMongoDumpBSONLongCollectionName,
TestDumpPreludeMetadataJson and TestMongoDumpMetaData, along with the
three helpers they call. The rest of the file stays on GoConvey for now,
so the dot-import remains.

Thirteen Reset calls become t.Cleanup registered at the scope matching
the leaves each one originally fired for. The prelude default-directory
leaves each get their own removal rather than sharing one, and the
"dump directory not created" case keeps its after-only cleanup, both
matching the original. Cleanups use assert and delete with
context.Background(), since t.Context() is cancelled before they run;
that is why tearDownMongoDumpTestDataInCleanup exists alongside the
t-taking version the unconverted tests still use.

testDumpOneCollection's count check is NotZero rather than NotEqual
against 0. restoredCount is an int64, and testify compares types, so
NotEqual against an untyped 0 is satisfied by the type difference alone
and passes even when nothing was restored. ShouldNotEqual was tolerant
here and did fail.

Assertion sites go from 133 to 130. The three fewer are unchecked Close
and Drop calls in the long-collection-name test, which is skipped and
which the original left unchecked.

No behavior change.

Converts TestMongoDumpBSON, TestMongoDumpBSONLongCollectionName,
TestDumpPreludeMetadataJson and TestMongoDumpMetaData, along with the
three helpers they call. The rest of the file stays on GoConvey for now,
so the dot-import remains.

Thirteen Reset calls become t.Cleanup registered at the scope matching
the leaves each one originally fired for. The prelude default-directory
leaves each get their own removal rather than sharing one, and the
"dump directory not created" case keeps its after-only cleanup, both
matching the original. Cleanups use assert and delete with
context.Background(), since t.Context() is cancelled before they run;
that is why tearDownMongoDumpTestDataInCleanup exists alongside the
t-taking version the unconverted tests still use.

testDumpOneCollection's count check is NotZero rather than NotEqual
against 0. restoredCount is an int64, and testify compares types, so
NotEqual against an untyped 0 is satisfied by the type difference alone
and passes even when nothing was restored. ShouldNotEqual was tolerant
here and did fail.

Assertion sites go from 133 to 130. The three fewer are unchecked Close
and Drop calls in the long-collection-name test, which is skipped and
which the original left unchecked.

No behavior change.

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