summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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!" )