diff options
author | Matt Broadstone <mbroadst@mongodb.com> | 2023-01-10 18:55:54 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-01-10 19:49:44 +0000 |
commit | f846df62b5cc55de0fc0eda7051fcbeef029994f (patch) | |
tree | 49cf0e83b33f58e7a0bea03b54b0805d1dd7272a /jstests/auth/lib/commands_builtin_roles.js | |
parent | 5139c8c1e3791516d6cd138e1ba7680ec59029aa (diff) | |
download | mongo-f846df62b5cc55de0fc0eda7051fcbeef029994f.tar.gz |
SERVER-72577 Convert tenant migrations tests to use es modules
Diffstat (limited to 'jstests/auth/lib/commands_builtin_roles.js')
-rw-r--r-- | jstests/auth/lib/commands_builtin_roles.js | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/jstests/auth/lib/commands_builtin_roles.js b/jstests/auth/lib/commands_builtin_roles.js index e478598ce2b..f81a8b2efaa 100644 --- a/jstests/auth/lib/commands_builtin_roles.js +++ b/jstests/auth/lib/commands_builtin_roles.js @@ -5,14 +5,21 @@ * in jstests/auth/lib/commands_lib.js */ +import { + adminDbName, + authCommandsLib, + authErrCode, + commandNotSupportedCode, + firstDbName +} from "jstests/auth/lib/commands_lib.js"; + +load("jstests/libs/fail_point_util.js"); + // This test involves killing all sessions, which will not work as expected if the kill command is // sent with an implicit session. TestData.disableImplicitSessions = true; -load("jstests/auth/lib/commands_lib.js"); -load("jstests/libs/fail_point_util.js"); - -var roles = [ +export const roles = [ {key: "read", role: "read", dbname: firstDbName}, {key: "readLocal", role: {role: "read", db: "local"}, dbname: adminDbName}, {key: "readAnyDatabase", role: "readAnyDatabase", dbname: adminDbName}, @@ -132,7 +139,7 @@ function createUsers(conn) { assert(adminDb.auth("admin", "password")); for (var i = 0; i < roles.length; i++) { - r = roles[i]; + const r = roles[i]; r.db = conn.getDB(r.dbname); r.db.createUser({user: "user|" + r.key, pwd: "password", roles: [r.role]}); } @@ -143,7 +150,7 @@ function createUsers(conn) { * This tests the authorization of commands with builtin roles for a given server configuration * represented in 'conn'. */ -function runAllCommandsBuiltinRoles(conn) { +export function runAllCommandsBuiltinRoles(conn) { const testFunctionImpls = {createUsers: createUsers, runOneTest: runOneTest}; authCommandsLib.runTests(conn, testFunctionImpls); } |