Skip to content

TOOLS-4278 Convert mongoimport TestImportDocuments to testify - #1076

Draft
autarch wants to merge 1 commit into
TOOLS-4278-convey-to-testify-mongoimport-main-1from
TOOLS-4278-convey-to-testify-mongoimport-main-2
Draft

TOOLS-4278 Convert mongoimport TestImportDocuments to testify#1076
autarch wants to merge 1 commit into
TOOLS-4278-convey-to-testify-mongoimport-main-1from
TOOLS-4278-convey-to-testify-mongoimport-main-2

Conversation

@autarch

@autarch autarch commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

At 827 lines this is the largest function in the file, and the only one
so far where the GoConvey re-execution semantics mattered.

Every leaf shared one collection, and GoConvey re-ran the outer block per
leaf, so the Reset cleared that collection 51 times. Subtests do not work
that way: a shared parent would run setup once and let each subtest
inherit whatever its siblings left behind. The teardown is now a
cleanImportCollection helper that every subtest calls, registering its own
t.Cleanup, so the 51 leaf executions still get 51 clears.

The cleanup deletes with context.Background() rather than t.Context().
t.Context() is cancelled just before Cleanup functions run, so the delete
failed with "context canceled" until this was changed.

Isolation was checked empirically rather than assumed: three consecutive
runs, -count=5, three shuffled runs, all 52 subtests run individually,
and zero residual documents afterwards.

The three t.Fatalf checks in the old Reset body become require.NoError in
the helper, which is the only reason the assertion count moves at all:
120 before, 123 after. No behavior change.

At 827 lines this is the largest function in the file, and the only one
so far where the GoConvey re-execution semantics mattered.

Every leaf shared one collection, and GoConvey re-ran the outer block per
leaf, so the Reset cleared that collection 51 times. Subtests do not work
that way: a shared parent would run setup once and let each subtest
inherit whatever its siblings left behind. The teardown is now a
cleanImportCollection helper that every subtest calls, registering its own
t.Cleanup, so the 51 leaf executions still get 51 clears.

The cleanup deletes with context.Background() rather than t.Context().
t.Context() is cancelled just before Cleanup functions run, so the delete
failed with "context canceled" until this was changed.

Isolation was checked empirically rather than assumed: three consecutive
runs, -count=5, three shuffled runs, all 52 subtests run individually,
and zero residual documents afterwards.

The three t.Fatalf checks in the old Reset body become require.NoError in
the helper, which is the only reason the assertion count moves at all:
120 before, 123 after. 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