summaryrefslogtreecommitdiff
path: root/jstests/sharding/authCommands.js
diff options
context:
space:
mode:
authorDavid Hows <howsdav@gmail.com>2015-06-24 15:50:36 +1000
committerDavid Hows <howsdav@gmail.com>2015-07-01 15:33:21 +1000
commite7278a49734e5b2977363d313b2e7553675eba23 (patch)
treebc3d1f313bbe4a0a243637319b40cfd8a4cb6b65 /jstests/sharding/authCommands.js
parent2f79ff09cce53743a34ee9fdfa99981d4b12fd13 (diff)
downloadmongo-e7278a49734e5b2977363d313b2e7553675eba23.tar.gz
BF-802 check error output from insert
Diffstat (limited to 'jstests/sharding/authCommands.js')
-rw-r--r--jstests/sharding/authCommands.js17
1 files changed, 10 insertions, 7 deletions
diff --git a/jstests/sharding/authCommands.js b/jstests/sharding/authCommands.js
index e97a319d9f1..ab4fcf1ecf8 100644
--- a/jstests/sharding/authCommands.js
+++ b/jstests/sharding/authCommands.js
@@ -5,9 +5,9 @@
*/
var doTest = function() {
-var rsOpts = { oplogSize: 10, verbose : 2, useHostname : false };
+var rsOpts = { oplogSize: 10, useHostname : false };
var st = new ShardingTest({ keyFile : 'jstests/libs/key1', shards : 2, chunksize : 2, config : 3,
- rs : rsOpts, other : { nopreallocj : 1, verbose : 2, useHostname : false }});
+ rs : rsOpts, other : { nopreallocj : 1, useHostname : false }});
var mongos = st.s;
var adminDB = mongos.getDB( 'admin' );
@@ -18,6 +18,7 @@ jsTestLog('Setting up initial users');
var rwUser = 'rwUser';
var roUser = 'roUser';
var password = 'password';
+var expectedDocs = 1000;
adminDB.createUser({user: rwUser, pwd: password, roles: jsTest.adminUserRoles});
@@ -59,14 +60,16 @@ var str = 'a';
while ( str.length < 8000 ) {
str += str;
}
+
+var bulk = testDB.foo.initializeUnorderedBulkOp();
for ( var i = 0; i < 100; i++ ) {
for ( var j = 0; j < 10; j++ ) {
- testDB.foo.save({i:i, j:j, str:str});
+ bulk.insert({i:i, j:j, str:str});
}
}
-testDB.getLastError( 'majority' );
+assert.writeOK(bulk.execute({ w: "majority"}));
-assert.eq(1000, testDB.foo.count());
+assert.eq(expectedDocs, testDB.foo.count());
// Wait for the balancer to start back up
st.startBalancer()
@@ -114,8 +117,8 @@ var checkCommandFailed = function( db, cmdObj ) {
var checkReadOps = function( hasReadAuth ) {
if ( hasReadAuth ) {
print( "Checking read operations, should work" );
- assert.eq( 1000, testDB.foo.find().itcount() );
- assert.eq( 1000, testDB.foo.count() );
+ assert.eq( expectedDocs, testDB.foo.find().itcount() );
+ assert.eq( expectedDocs, testDB.foo.count() );
// NOTE: This is an explicit check that GLE can be run with read prefs, not the result of
// above.
assert.eq( null, testDB.runCommand({getlasterror : 1}).err );