diff options
author | Eliot Horowitz <eliot@10gen.com> | 2012-01-07 23:00:41 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2012-01-07 23:00:41 -0500 |
commit | 3aaea5262d761e0bb6bfef5351cfbfca7af06ec2 (patch) | |
tree | ed11ffb6712a5f0047ef93bc1a62b4414021f286 | |
parent | 6e95d546e21a3b0925dd5d7f4ef4c17564d11ad0 (diff) | |
download | mongo-3aaea5262d761e0bb6bfef5351cfbfca7af06ec2.tar.gz |
this test requries shell features in 2.2
tested with a 2.2 shell to make sure it works
-rw-r--r-- | jstests/replsets/auth3.js | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/jstests/replsets/auth3.js b/jstests/replsets/auth3.js deleted file mode 100644 index ff1e6ccd97d..00000000000 --- a/jstests/replsets/auth3.js +++ /dev/null @@ -1,68 +0,0 @@ -var path = "jstests/libs/"; - -var rs = new ReplSetTest({"nodes" : {node0 : {}, node1 : {}, arbiter : {}}, keyFile : path+"key1"}); -rs.startSet(); -rs.initiate(); - -master = rs.getMaster(); -print("adding user"); -master.getDB("admin").addUser("foo", "bar"); - -var checkValidState = function(i) { - assert.soon(function() { - var result = rs.nodes[i].getDB("admin").runCommand({isMaster : 1}); - printjson(result); - return result.secondary || result.ismaster; - }); -}; - -var safeInsert = function() { - master = rs.getMaster(); - master.getDB("admin").auth("foo", "bar"); - master.getDB("foo").bar.insert({x:1}); - var insertWorked = master.getDB("foo").runCommand({getlasterror:1}); - printjson(insertWorked); - assert.eq(insertWorked.ok, 1); -} - -print("authing"); -for (var i=0; i<2; i++) { - checkValidState(i); - - // if this is run before initial sync finishes, we won't be logged in - rs.nodes[i].getDB("admin").auth("foo", "bar"); -} - -print("make common point"); - -safeInsert(); -rs.awaitReplication(); - -print("write stuff to 0&2") -rs.stop(1); - -master = rs.getMaster(); -master.getDB("foo").bar.drop(); -print("last op: "+tojson(master.getDB("local").oplog.rs.find().sort({$natural:-1}).limit(1).next())); - -print("write stuff to 1&2") -rs.stop(0); -rs.restart(1); - -safeInsert(); -print("last op: "+tojson(master.getDB("local").oplog.rs.find().sort({$natural:-1}).limit(1).next())); - -rs.restart(0); - -print("doing rollback!"); -assert.soon(function() { - var result = rs.nodes[0].getDB("admin").runCommand({isMaster : 1}); - printjson(result); - return !result.secondary && !result.ismaster; -}); - -print("make sure 0 successfully rolls back"); -m = rs.nodes[0]; - -checkValidState(0); -checkValidState(1); |