Files
mongo/jstests/sharding/auth2.js
Kaloian Manassiev b6abb408c1 SERVER-24603 Re-enable auth tests in 'sharding_last_stable_mongos'
This change makes auth tests with 3.2 mongos, which need to control the
balancer state to go through a special control mongos instance running
version 3.4.

This reverts commit bfde0ecb1c.
2016-06-20 22:15:57 -04:00

25 lines
692 B
JavaScript

(function() {
'use strict';
var st = new ShardingTest({
shards: 2,
other: {chunkSize: 1, useHostname: true, keyFile: 'jstests/libs/key1'},
});
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();
})();