diff options
author | Kristina <kristina@10gen.com> | 2011-11-11 12:14:23 -0500 |
---|---|---|
committer | Kristina <kristina@10gen.com> | 2011-11-11 12:14:23 -0500 |
commit | 6fe20569913bc822db50cff06d55d50b144bce9d (patch) | |
tree | 7fb5b496410ef52003836904d7f2588aad136b9e /jstests/auth/auth3.js | |
parent | e49b622e5a84104db6464873cbef568b041aee39 (diff) | |
download | mongo-6fe20569913bc822db50cff06d55d50b144bce9d.tar.gz |
add special ns auth test
Diffstat (limited to 'jstests/auth/auth3.js')
-rw-r--r-- | jstests/auth/auth3.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/jstests/auth/auth3.js b/jstests/auth/auth3.js new file mode 100644 index 00000000000..93528f4173a --- /dev/null +++ b/jstests/auth/auth3.js @@ -0,0 +1,25 @@ +var conn = MongoRunner.runMongod({auth : "", port : 31001}); + +var admin = conn.getDB("admin"); + +admin.addUser("foo","bar"); + +print("make sure curop, killop, and unlock fail"); + +var x = admin.$cmd.sys.inprog.findOne(); +assert(!("inprog" in x), tojson(x)); +assert.eq(x.err, "unauthorized", tojson(x)); + +x = admin.killOp(123); +assert(!("info" in x), tojson(x)); +assert.eq(x.err, "unauthorized", tojson(x)); + +x = admin.fsyncUnlock(); +assert(x.errmsg != "not locked", tojson(x)); +assert.eq(x.err, "unauthorized", tojson(x)); + +conn.getDB("admin").auth("foo","bar"); + +assert("inprog" in admin.currentOp()); +assert("info" in admin.killOp(123)); +assert.eq(admin.fsyncUnlock().errmsg, "not locked"); |