summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlake Oler <blake.oler@mongodb.com>2018-12-03 11:57:58 -0500
committerBlake Oler <blake.oler@mongodb.com>2018-12-10 10:46:31 -0500
commit7b1e64f12e855d979232ef7b185002d5c8103353 (patch)
tree9de80be3fafa4c3772e915883c81cc57990df126
parenta1442e88e77fff49dd20a11953a6012be66d4b79 (diff)
downloadmongo-7b1e64f12e855d979232ef7b185002d5c8103353.tar.gz
SERVER-38062 Add assertions to commands in read_pref_cmd.js
-rw-r--r--jstests/sharding/read_pref_cmd.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/jstests/sharding/read_pref_cmd.js b/jstests/sharding/read_pref_cmd.js
index 8c2704a3886..0782484b615 100644
--- a/jstests/sharding/read_pref_cmd.js
+++ b/jstests/sharding/read_pref_cmd.js
@@ -16,14 +16,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));
});
};
@@ -31,7 +31,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();
};
@@ -160,9 +160,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}));
// Mongos doesn't implement geoSearch; test it only with ReplicaSetConnection.
if (!isMongos) {