TOOLS-4263 Convert mongorestore users and roles temp collection tests to Go - #1097
Conversation
This was referenced Aug 7, 2026
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.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
autarch
force-pushed
the
08-07-tools-4263_convert_mongorestore_users_and_roles_temp_collection_tests_to_go
branch
from
August 7, 2026 18:57
6c8805c to
8a19082
Compare
autarch
force-pushed
the
08-07-tools-4263_convert_mongorestore_drop_path_and_stdin_tests_to_go
branch
from
August 7, 2026 18:57
56c20e5 to
dde6481
Compare
autarch
force-pushed
the
08-07-tools-4263_convert_mongorestore_users_and_roles_temp_collection_tests_to_go
branch
from
August 10, 2026 20:44
8a19082 to
8b003ae
Compare
autarch
force-pushed
the
08-07-tools-4263_convert_mongorestore_drop_path_and_stdin_tests_to_go
branch
from
August 10, 2026 20:44
dde6481 to
4f3a46b
Compare
autarch
force-pushed
the
08-07-tools-4263_convert_mongorestore_users_and_roles_temp_collection_tests_to_go
branch
from
August 11, 2026 16:19
8b003ae to
3e2ec35
Compare
autarch
force-pushed
the
08-07-tools-4263_convert_mongorestore_drop_path_and_stdin_tests_to_go
branch
2 times, most recently
from
August 11, 2026 17:11
330501c to
b73dae3
Compare
autarch
force-pushed
the
08-07-tools-4263_convert_mongorestore_users_and_roles_temp_collection_tests_to_go
branch
from
August 11, 2026 17:11
3e2ec35 to
43362fe
Compare
autarch
force-pushed
the
08-07-tools-4263_convert_mongorestore_drop_path_and_stdin_tests_to_go
branch
from
August 12, 2026 18:45
b73dae3 to
8c3b16c
Compare
… to Go Extends `TestRestoreUsersOrRoles` in `integration/dumprestore/roundtrip_test.go` with two cases covering how mongorestore handles the temporary collections it stages users and roles in, and deletes the two JS tests they replace. JS -> Go mapping: - `test/qa-tests/jstests/restore/nonempty_temp_users.js` -> the "with a nonempty temp users collection" case of `TestRestoreUsersOrRoles` (`integration/dumprestore/roundtrip_test.go`) - mongorestore stages users in `admin.tempusers` before merging them into the real user collection, so a document left there by an interrupted earlier run must neither derail the restore nor survive it. The test seeds that collection with a junk document before restoring, then asserts the restore succeeded, the temp collections are gone, and the user and role from the dump actually exist. - `test/qa-tests/jstests/restore/users_and_roles_temp_collections.js` -> the "with custom temp collection names" case of `TestRestoreUsersOrRoles` (`integration/dumprestore/roundtrip_test.go`) - this is the first coverage anywhere of `--tempUsersColl` and `--tempRolesColl`. The restore is run with custom names for both, and the test asserts those custom collections are cleaned up afterwards and that the user and role were restored. Both JS tests asserted only the tool's exit code; these assert that the user and role exist afterwards, which is what the temp-collection machinery is in service of. The fixture user and role are dropped before each case, because `BeforeTest` deliberately leaves the `admin` database alone and that is where they live.
autarch
force-pushed
the
08-07-tools-4263_convert_mongorestore_users_and_roles_temp_collection_tests_to_go
branch
from
August 12, 2026 18:45
43362fe to
7e8aa42
Compare
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.

Extends
TestRestoreUsersOrRolesinintegration/dumprestore/roundtrip_test.gowith two cases covering how mongorestore handles the temporary collections it stages users and roles in, and deletes the two JS tests they replace.JS -> Go mapping:
test/qa-tests/jstests/restore/nonempty_temp_users.js-> the "with a nonempty temp users collection" case ofTestRestoreUsersOrRoles(integration/dumprestore/roundtrip_test.go) - mongorestore stages users inadmin.tempusersbefore merging them into the real user collection, so a document left there by an interrupted earlier run must neither derail the restore nor survive it. The test seeds that collection with a junk document before restoring, then asserts the restore succeeded, the temp collections are gone, and the user and role from the dump actually exist.test/qa-tests/jstests/restore/users_and_roles_temp_collections.js-> the "with custom temp collection names" case ofTestRestoreUsersOrRoles(integration/dumprestore/roundtrip_test.go) - this is the first coverage anywhere of--tempUsersColland--tempRolesColl. The restore is run with custom names for both, and the test asserts those custom collections are cleaned up afterwards and that the user and role were restored.Both JS tests asserted only the tool's exit code; these assert that the user and role exist afterwards, which is what the temp-collection machinery is in service of. The fixture user and role are dropped before each case, because
BeforeTestdeliberately leaves theadmindatabase alone and that is where they live.