Files
mongo/jstests/sharding/auth2.js
Kaloian Manassiev 3db9d1338c SERVER-21009 Remove usages of the multi-argument ShardingTest constructor
No functional changes, just converting everything to use the JSON-based
constructor.

Also moves some sharding-specific tests out of noPassthroughWithMongod and
under the sharding suite.
2015-10-23 09:50:35 -04:00

21 lines
738 B
JavaScript

var st = new ShardingTest({ keyFile : 'jstests/libs/key1', shards : 2, chunkSize: 1, verbose : 2,
other : { nopreallocj : 1, verbose : 2, useHostname : true,
configOptions : { verbose : 2 }}});
var mongos = st.s;
var adminDB = mongos.getDB('admin');
var db = mongos.getDB('test')
adminDB.createUser({user: 'admin', pwd: 'password', roles: jsTest.adminUserRoles});
jsTestLog( "Add user was successful" );
// Test for SERVER-6549, make sure that repeatedly logging in always passes.
for ( var i = 0; i < 100; i++ ) {
adminDB = new Mongo( mongos.host ).getDB('admin');
assert( adminDB.auth('admin', 'password'), "Auth failed on attempt #: " + i );
}
st.stop();