2015-09-01 16:19:57 -04:00
|
|
|
(function() {
|
|
|
|
|
|
|
|
|
|
'use strict'
|
|
|
|
|
|
|
|
|
|
var conn = MongoRunner.runMongod({ auth: "" });
|
2011-11-11 12:14:23 -05:00
|
|
|
|
|
|
|
|
var admin = conn.getDB("admin");
|
2015-03-26 10:03:29 -04:00
|
|
|
var errorCodeUnauthorized = 13;
|
2011-11-11 12:14:23 -05:00
|
|
|
|
2013-11-06 14:49:35 -05:00
|
|
|
admin.createUser({user:"foo",pwd: "bar", roles: jsTest.adminUserRoles});
|
2011-11-11 12:14:23 -05:00
|
|
|
|
|
|
|
|
print("make sure curop, killop, and unlock fail");
|
|
|
|
|
|
|
|
|
|
var x = admin.$cmd.sys.inprog.findOne();
|
|
|
|
|
assert(!("inprog" in x), tojson(x));
|
2015-04-02 18:37:06 -04:00
|
|
|
assert.eq(x.code, errorCodeUnauthorized, tojson(x));
|
2011-11-11 12:14:23 -05:00
|
|
|
|
|
|
|
|
x = admin.killOp(123);
|
|
|
|
|
assert(!("info" in x), tojson(x));
|
2015-04-06 18:49:59 -04:00
|
|
|
assert.eq(x.code, errorCodeUnauthorized, tojson(x));
|
2011-11-11 12:14:23 -05:00
|
|
|
|
|
|
|
|
x = admin.fsyncUnlock();
|
|
|
|
|
assert(x.errmsg != "not locked", tojson(x));
|
2015-03-26 10:03:29 -04:00
|
|
|
assert.eq(x.code, errorCodeUnauthorized, tojson(x));
|
2011-11-11 12:14:23 -05:00
|
|
|
|
|
|
|
|
conn.getDB("admin").auth("foo","bar");
|
|
|
|
|
|
|
|
|
|
assert("inprog" in admin.currentOp());
|
|
|
|
|
assert("info" in admin.killOp(123));
|
|
|
|
|
assert.eq(admin.fsyncUnlock().errmsg, "not locked");
|
2015-09-01 16:19:57 -04:00
|
|
|
|
|
|
|
|
})();
|