summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2019-01-28 17:00:20 -0500
committerRandolph Tan <randolph@10gen.com>2019-01-31 14:57:49 -0500
commit8d23154ed3e086213c5bd59b3e2fcba96a3cca41 (patch)
tree1a484f25516da69248d48283890f1a9c7c731263 /jstests
parentc15a40aa4eaee67e060ac63256998232deb97c38 (diff)
downloadmongo-8d23154ed3e086213c5bd59b3e2fcba96a3cca41.tar.gz
SERVER-39232 Allow commands that do not require auth to refresh sessions
Diffstat (limited to 'jstests')
-rw-r--r--jstests/auth/currentop_cursors_auth.js3
-rw-r--r--jstests/auth/pre_auth_commands_with_sessions.js10
-rw-r--r--jstests/noPassthrough/verify_session_cache_updates.js6
3 files changed, 6 insertions, 13 deletions
diff --git a/jstests/auth/currentop_cursors_auth.js b/jstests/auth/currentop_cursors_auth.js
index b08904cd391..ca196be176f 100644
--- a/jstests/auth/currentop_cursors_auth.js
+++ b/jstests/auth/currentop_cursors_auth.js
@@ -152,6 +152,9 @@
// Clean up the cursors so that they don't affect subsequent tests.
assert.commandWorked(
db.runCommand({killCursors: coll.getName(), cursors: [cursorId, secondCursorId]}));
+
+ // Make sure to logout to allow __system user to use the implicit session.
+ assert.commandWorked(adminDB.logout());
}
jsTestLog("Running cursor tests on mongoD");
diff --git a/jstests/auth/pre_auth_commands_with_sessions.js b/jstests/auth/pre_auth_commands_with_sessions.js
index 6472910917b..0e440a01c13 100644
--- a/jstests/auth/pre_auth_commands_with_sessions.js
+++ b/jstests/auth/pre_auth_commands_with_sessions.js
@@ -40,16 +40,6 @@
db.runCommand(commandWithSession),
"failed to run command " + cmd + " with session without being logged in");
- // Test that we can run a pre-auth command with a session while
- // multiple users are logged in (and the session gets ignored)
- db.auth("lily", "pwd");
- admin.auth("admin", "pwd");
- assert.commandWorked(admin.runCommand(command),
- "failed to run command " + cmd + " with multiple users logged in");
- assert.commandWorked(
- admin.runCommand(commandWithSession),
- "failed to run command " + cmd + " with session with multiple users logged in");
-
db.logout();
admin.logout();
};
diff --git a/jstests/noPassthrough/verify_session_cache_updates.js b/jstests/noPassthrough/verify_session_cache_updates.js
index 22674cb1ecb..6fb6d36ea7c 100644
--- a/jstests/noPassthrough/verify_session_cache_updates.js
+++ b/jstests/noPassthrough/verify_session_cache_updates.js
@@ -29,9 +29,9 @@
var session = conn.startSession();
verify(conn, 0);
- // running a non-session updating command doesn't touch
- session.getDatabase("admin").runCommand("getLastError");
- verify(conn, 0);
+ // running a command that doesn't require auth does touch
+ session.getDatabase("admin").runCommand("isMaster");
+ verify(conn, 1);
// running a session updating command does touch
session.getDatabase("admin").runCommand({serverStatus: 1});