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-28 00:01:13 -0500
commit3cf1a9edcdb9761a94ec4b37e3156c91cb4d7c7d (patch)
treedb090a8d5a6bcb647f9be15b20bd6ab104aeb8fc
parent3faad0436f720778108149aa3bddda727305c2b1 (diff)
downloadmongo-3cf1a9edcdb9761a94ec4b37e3156c91cb4d7c7d.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.js15
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.