summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorSpencer T Brody <spencer@mongodb.com>2014-02-06 17:32:17 -0500
committerSpencer T Brody <spencer@mongodb.com>2014-02-12 14:38:46 -0500
commite203fc775578a42c88494639b15f9f67f350c4c1 (patch)
tree6695b75cd8a1ae8e19003102e2c80703e0c659c9 /jstests
parent065d65bd64a4b5f9541a24fe491a1d27d56890ad (diff)
downloadmongo-e203fc775578a42c88494639b15f9f67f350c4c1.tar.gz
SERVER-10320 Test user manipulation while config servers are down
Diffstat (limited to 'jstests')
-rw-r--r--jstests/sharding/auth_config_down.js39
1 files changed, 26 insertions, 13 deletions
diff --git a/jstests/sharding/auth_config_down.js b/jstests/sharding/auth_config_down.js
index b22534e8fbf..ba1eaa955aa 100644
--- a/jstests/sharding/auth_config_down.js
+++ b/jstests/sharding/auth_config_down.js
@@ -20,26 +20,39 @@ assert.eq( null, mongos.getDB( "foo" ).getLastError() )
var stopOrder = [ 1, 0 ]
for( var i = 0; i < stopOrder.length; i++ ){
-
+
var configToStop = configs[ stopOrder[i] ]
-
+
jsTest.log( "Stopping config server " + stopOrder[i] + " : " + configToStop )
-
+
MongoRunner.stopMongod( configToStop )
-
+
jsTest.log( "Starting mongos with auth..." )
-
+
var mongosWithAuth = MongoRunner.runMongos({ keyFile : "jstests/libs/key1",
configdb : mongos.savedOptions.configdb })
-
- var res = null;
- try {
- res = mongosWithAuth.getCollection("foo.bar").findOne();
- }
- catch (e) {
- print("Caught exception: " + tojson(e));
- }
+ var foodb = mongosWithAuth.getDB('foo');
+ var res = foodb.bar.findOne();
assert.neq(null, res, "Test FAILED: unable to find document using mongos with auth");
+ assert.eq("world", res.hello);
+
+ assert.throws( function() { foodb.createUser({user:'user' + i, pwd: 'pwd', roles: []}); } );
+}
+
+// Restart the config servers and make sure everything is consistent
+for (var i = 0; i < stopOrder.length; i++ ) {
+
+ var configToStart = configs[ stopOrder[i] ];
+
+ jsTest.log( "Starting config server " + stopOrder[i] + " : " + configToStop );
+
+ configToStart.restart = true;
+ configs[stopOrder[i]] = MongoRunner.runMongod( configToStart );
+}
+
+assert.eq(0, mongos.getDB('foo').getUsers().length);
+for (var i = 0; i < configs.length; i++) {
+ assert.eq(0, configs[i].getDB('foo').getUsers().length);
}
jsTest.log( "DONE!" )