Skip to content

TOOLS-4263 Convert the replica-set routing and no-primary import tests to Go - #1161

Draft
autarch wants to merge 1 commit into
08-21-tools-4263_convert_the_write-concern_tests_to_gofrom
08-21-tools-4263_convert_the_replica-set_routing_and_no-primary_import_tests_to_go
Draft

TOOLS-4263 Convert the replica-set routing and no-primary import tests to Go#1161
autarch wants to merge 1 commit into
08-21-tools-4263_convert_the_write-concern_tests_to_gofrom
08-21-tools-4263_convert_the_replica-set_routing_and_no-primary_import_tests_to_go

Conversation

@autarch

@autarch autarch commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator
  • test/qa-tests/jstests/import/replset.js -> integration/exportimport/replset_routing_test.go - the two ways of addressing a replica set that have to end up writing to the primary: the primary's own host, and a set-name seedlist that names only a secondary, where the driver has to discover the primary for itself. The third thing that file checked, an import aimed straight at a secondary being refused, is already covered by TestImportToSecondaryFails.
  • test/qa-tests/jstests/import/no_primary_error_code.js and test/qa-tests/jstests/import/all_primaries_down_error_code.js -> integration/exportimport/no_primary_test.go - mongoimport reports a failure when there is no primary to write to, rather than exiting as if it had succeeded (TOOLS-690). Both cases use a server the test starts: a member started with --replSet but never initiated belongs to a set that has no primary, and a free port has no server at all.
  • integration/sharedsuite/replicaset.go - ReplicaSetToolArgsForHosts builds the same --host argument as ReplicaSetToolArgs over a seedlist of only the given hosts, which is what lets the routing test name just a secondary.
  • integration/exportimport/multinode_test.go - TestImportToSecondaryFails now drops the collection before importing, and asserts the rejected import left it empty. Without the drop the emptiness assertion could not be made.

All three JS files are deleted.

Coverage note: the two no-primary tests ran against a sharded cluster, and so
exercised mongos's wording of the failure -- "not master", "unable to target",
"could not contact primary for replica set" -- by stepping every shard's primary
down. The Go test reaches the same tool-level behavior by other means, so those
mongos-specific messages are no longer covered. What is covered is that the tool
fails rather than claiming success.

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

…s to Go

- `test/qa-tests/jstests/import/replset.js` -> `integration/exportimport/replset_routing_test.go` - the two ways of addressing a replica set that have to end up writing to the primary: the primary's own host, and a set-name seedlist that names only a secondary, where the driver has to discover the primary for itself. The third thing that file checked, an import aimed straight at a secondary being refused, is already covered by `TestImportToSecondaryFails`.
- `test/qa-tests/jstests/import/no_primary_error_code.js` and `test/qa-tests/jstests/import/all_primaries_down_error_code.js` -> `integration/exportimport/no_primary_test.go` - mongoimport reports a failure when there is no primary to write to, rather than exiting as if it had succeeded (TOOLS-690). Both cases use a server the test starts: a member started with `--replSet` but never initiated belongs to a set that has no primary, and a free port has no server at all.
- `integration/sharedsuite/replicaset.go` - `ReplicaSetToolArgsForHosts` builds the same `--host` argument as `ReplicaSetToolArgs` over a seedlist of only the given hosts, which is what lets the routing test name just a secondary.
- `integration/exportimport/multinode_test.go` - `TestImportToSecondaryFails` now drops the collection before importing, and asserts the rejected import left it empty. Without the drop the emptiness assertion could not be made.

All three JS files are deleted.

Coverage note: the two no-primary tests ran against a sharded cluster, and so
exercised mongos's wording of the failure -- "not master", "unable to target",
"could not contact primary for replica set" -- by stepping every shard's primary
down. The Go test reaches the same tool-level behavior by other means, so those
mongos-specific messages are no longer covered. What is covered is that the tool
fails rather than claiming success.
@autarch
autarch force-pushed the 08-21-tools-4263_convert_the_replica-set_routing_and_no-primary_import_tests_to_go branch from 831ae22 to 89071fc Compare August 25, 2026 20:18
@autarch
autarch force-pushed the 08-21-tools-4263_convert_the_write-concern_tests_to_go branch from c6c8c8a to abb3819 Compare August 25, 2026 20:18
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