diff options
author | Blake Oler <blake.oler@mongodb.com> | 2018-12-03 11:57:58 -0500 |
---|---|---|
committer | Blake Oler <blake.oler@mongodb.com> | 2018-12-27 23:35:32 -0500 |
commit | 11f1cd95a26d94bb5c5298ed34c0fd4a857c35c5 (patch) | |
tree | 3e9c0c5c067df42d44d105e49348ce19a51d7621 | |
parent | d40dec1355e8afaa19f39a9e6903a7aeec215574 (diff) | |
download | mongo-11f1cd95a26d94bb5c5298ed34c0fd4a857c35c5.tar.gz |
SERVER-38062 Add assertions to commands in read_pref_cmd.js
(cherry picked from commit 7b1e64f12e855d979232ef7b185002d5c8103353)
-rw-r--r-- | jstests/sharding/read_pref_cmd.js | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/jstests/sharding/read_pref_cmd.js b/jstests/sharding/read_pref_cmd.js index 099630fa5c3..2f25406cfde 100644 --- a/jstests/sharding/read_pref_cmd.js +++ b/jstests/sharding/read_pref_cmd.js @@ -17,14 +17,14 @@ TestData.skipCheckingUUIDsConsistentAcrossCluster = true; */ 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. Enable profiling on 'admin' // to test the $currentOp aggregation stage. st.rs0.nodes.forEach(function(node) { - node.getDB('test').setProfilingLevel(2); - node.getDB('admin').setProfilingLevel(2); + assert(node.getDB('test').setProfilingLevel(2)); + assert(node.getDB('admin').setProfilingLevel(2)); }); }; @@ -32,7 +32,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(); }; @@ -165,9 +165,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. |