Some of the shell utils are not tested
e.g. isBalancerRunning and getBalancerHost (defined in src/mongo/shell/utils_sh.js ). Possibly other commands.
Need to find what commands are not covered and add those tests
Current list from 3.4 docs of the sharding commands
Name Description
Balancer:
sh.getBalancerLockDetails() Reports on the active balancer lock, if it exists.
sh.setBalancerState() Enables or disables the balancer which migrates chunks between shards.
sh.getBalancerHost() Returns the process that has the balancer lock.
sh.getBalancerState() Returns a boolean to report if the balancer is currently enabled.
sh.startBalancer() Enables the balancer and waits for balancing to start.
sh.stopBalancer() Disables the balancer and waits for any in progress balancing rounds to complete.
sh.waitForBalancer() Internal. Waits for the balancer state to change.
sh.waitForBalancerOff() Internal. Waits until the balancer stops running.
sh.waitForDLock() Internal. Waits for a specified distributed sharded cluster lock.
sh.waitForPingChange() Internal. Waits for a change in ping state from one of the mongos in the sharded cluster.
sh.isBalancerRunning() Returns a boolean to report if the balancer process is currently migrating chunks.
sh.disableBalancing() Disable balancing on a single collection in a sharded database. Does not affect balancing of other collections in a sharded cluster.
sh.enableBalancing() Activates the sharded collection balancer process if previously disabled using sh.disableBalancing().
Tags/Zones:
sh.addShardTag() In MongoDB 3.4, this method aliases to sh.addShardToZone().
sh.addShardToZone() Associates a shard to a zone. Supports configuring zones in sharded clusters.
sh.removeShardTag() In MongoDB 3.4, this method aliases to sh.removeShardFromZone().
sh.removeShardFromZone() Removes the association between a shard and a zone. Use to manage zone sharding.
sh.addTagRange() In MongoDB 3.4, this method aliases to sh.updateZoneKeyRange().
sh.updateZoneKeyRange() Associates a range of shard keys to a zone. Supports configuring zones in sharded clusters.
sh.removeTagRange() In MongoDB 3.4, this method aliases to sh.removeRangeFromZone().
sh.removeRangeFromZone() Removes an association between a range of shard keys and a zone. Supports configuring zones in sharded clusters.
Chunks:
sh._lastMigration() Reports on the last chunk migration.
sh.moveChunk() Migrates a chunk in a sharded cluster.
sh.splitAt() Divides an existing chunk into two chunks using a specific value of the shard key as the dividing point.
sh.splitFind() Divides an existing chunk that contains a document matching a query into two approximately equal chunks.
Misc:
sh._adminCommand() Runs a database command against the admin database, like db.runCommand(), but can confirm that it is issued against a mongos.
sh._checkFullName() Tests a namespace to determine if its well formed.
sh._checkMongos() Tests to see if the mongo shell is connected to a mongos instance.
sh.addShard() Adds a shard to a sharded cluster.
sh.enableSharding() Enables sharding on a specific database.
sh.shardCollection() Enables sharding for a collection.
The sh.status() Reports on the status of a sharded cluster, as db.printShardingStatus().
uses several methods:
sh.getRecentFailedRounds
sh.getRecentMigrations
sh.getActiveMigrations
sh.getBalancerWindow
sh.getBalancerLockDetails