diff options
author | Adam Midvidy <amidvidy@gmail.com> | 2015-04-02 18:37:06 -0400 |
---|---|---|
committer | Adam Midvidy <amidvidy@gmail.com> | 2015-04-13 10:14:12 -0400 |
commit | 1991daaff1a108d98f6e9e7414a16131e244bdd4 (patch) | |
tree | 24051b5af1c645f37d4f3ecea5b5c3d64a75c9ac /jstests/auth | |
parent | 5cfd95b0eb36c72f1b1b131ff1de76fe05f16cc3 (diff) | |
download | mongo-1991daaff1a108d98f6e9e7414a16131e244bdd4.tar.gz |
SERVER-7775 add currentOp command
Diffstat (limited to 'jstests/auth')
-rw-r--r-- | jstests/auth/auth3.js | 2 | ||||
-rw-r--r-- | jstests/auth/basic_role_auth.js | 3 | ||||
-rw-r--r-- | jstests/auth/lib/commands_lib.js | 15 | ||||
-rw-r--r-- | jstests/auth/pseudo_commands.js | 2 |
4 files changed, 19 insertions, 3 deletions
diff --git a/jstests/auth/auth3.js b/jstests/auth/auth3.js index b22c86b87b4..2f28111da24 100644 --- a/jstests/auth/auth3.js +++ b/jstests/auth/auth3.js @@ -9,7 +9,7 @@ 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)); +assert.eq(x.code, errorCodeUnauthorized, tojson(x)); x = admin.killOp(123); assert(!("info" in x), tojson(x)); diff --git a/jstests/auth/basic_role_auth.js b/jstests/auth/basic_role_auth.js index 1122951fd25..8b50f70671b 100644 --- a/jstests/auth/basic_role_auth.js +++ b/jstests/auth/basic_role_auth.js @@ -158,9 +158,10 @@ var testOps = function(db, allowedActions) { }); checkErr(allowedActions.hasOwnProperty('currentOp'), function() { + var errorCodeUnauthorized = 13; var res = db.currentOp(); - if (res.err == 'unauthorized') { + if (res.code == errorCodeUnauthorized) { throw Error("unauthorized currentOp"); } }); diff --git a/jstests/auth/lib/commands_lib.js b/jstests/auth/lib/commands_lib.js index 25827201154..3fe3fddfeef 100644 --- a/jstests/auth/lib/commands_lib.js +++ b/jstests/auth/lib/commands_lib.js @@ -752,6 +752,21 @@ var authCommandsLib = { ] }, { + testname: "currentOp", + command: {currentOp: 1, $all: true}, + testcases: [ + { + runOnDb: adminDbName, + roles: roles_monitoring, + privileges: [ + { resource: {cluster: true}, actions: ["inprog"] } + ] + }, + { runOnDb: firstDbName, roles: {} }, + { runOnDb: secondDbName, roles: {} } + ] + }, + { testname: "currentOpCtx", command: {currentOpCtx: 1}, skipSharded: true, diff --git a/jstests/auth/pseudo_commands.js b/jstests/auth/pseudo_commands.js index 006d84e147d..219438a672c 100644 --- a/jstests/auth/pseudo_commands.js +++ b/jstests/auth/pseudo_commands.js @@ -74,7 +74,7 @@ function runTest(conn) { var passed = true; try { var res = db.currentOp(); - passed = !res.err && !res['$err']; + passed = res.ok && !res.hasOwnProperty("errmsg"); } catch (e) { passed = false; } |