diff options
Diffstat (limited to 'jstests/sharding/read_pref_cmd.js')
-rw-r--r-- | jstests/sharding/read_pref_cmd.js | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/jstests/sharding/read_pref_cmd.js b/jstests/sharding/read_pref_cmd.js index 54effe9f249..784d02faf81 100644 --- a/jstests/sharding/read_pref_cmd.js +++ b/jstests/sharding/read_pref_cmd.js @@ -7,12 +7,12 @@ var NODE_COUNT = 2; */ var setUp = function() { var configDB = st.s.getDB('config'); - configDB.adminCommand({enableSharding: 'test'}); - configDB.adminCommand({shardCollection: 'test.user', key: {x: 1}}); + assert.commandWorked(configDB.adminCommand({enableSharding: 'test'})); + assert.commandWorked(configDB.adminCommand({shardCollection: 'test.user', key: {x: 1}})); // Each time we drop the 'test' DB we have to re-enable profiling st.rs0.nodes.forEach(function(node) { - node.getDB('test').setProfilingLevel(2); + assert(node.getDB('test').setProfilingLevel(2)); }); }; @@ -20,7 +20,7 @@ var setUp = function() { * Clean up after testReadPreference() or testBadMode(), prepare to call setUp() again. */ var tearDown = function() { - st.s.getDB('test').dropDatabase(); + assert.commandWorked(st.s.getDB('test').dropDatabase()); // Hack until SERVER-7739 gets fixed st.rs0.awaitReplication(); }; @@ -147,9 +147,10 @@ var testReadPreference = function(conn, hostList, isMongos, mode, tagSets, secEx cmdTest({collStats: 'user'}, true, formatProfileQuery({count: 'user'})); cmdTest({dbStats: 1}, true, formatProfileQuery({dbStats: 1})); - testDB.user.ensureIndex({loc: '2d'}); - testDB.user.ensureIndex({position: 'geoHaystack', type: 1}, {bucketSize: 10}); - testDB.runCommand({getLastError: 1, w: NODE_COUNT}); + assert.commandWorked(testDB.user.ensureIndex({loc: '2d'})); + assert.commandWorked( + testDB.user.ensureIndex({position: 'geoHaystack', type: 1}, {bucketSize: 10})); + assert.commandWorked(testDB.runCommand({getLastError: 1, w: NODE_COUNT})); cmdTest({geoNear: 'user', near: [1, 1]}, true, formatProfileQuery({geoNear: 'user'})); // Mongos doesn't implement geoSearch; test it only with ReplicaSetConnection. |