summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorJason Carey <jcarey@argv.me>2017-07-25 19:10:48 -0400
committerJason Carey <jcarey@argv.me>2017-08-01 17:57:19 -0400
commit009fdc7dfcc0197632cef5e3fdc250fdba68f7a5 (patch)
treec8b1ebb23f9e67a10feb79b14130bf71e7c940c0 /jstests
parentad30a49a33b8773cbc07388bb257d605cbd6aa12 (diff)
downloadmongo-009fdc7dfcc0197632cef5e3fdc250fdba68f7a5.tar.gz
SERVER-30080 LogicalSessions in the shell
Basic logical session implementation for the shell
Diffstat (limited to 'jstests')
-rw-r--r--jstests/libs/override_methods/enable_sessions.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/jstests/libs/override_methods/enable_sessions.js b/jstests/libs/override_methods/enable_sessions.js
new file mode 100644
index 00000000000..2b1be14268b
--- /dev/null
+++ b/jstests/libs/override_methods/enable_sessions.js
@@ -0,0 +1,22 @@
+/**
+ * Enables sessions on the db object
+ */
+(function() {
+ "use strict";
+
+ db = db.getMongo().startSession().getDatabase(db.getName());
+
+ var originalStartParallelShell = startParallelShell;
+ startParallelShell = function(jsCode, port, noConnect) {
+ var newCode;
+ var overridesFile = "jstests/libs/override_methods/enable_sessions.js";
+ if (typeof(jsCode) === "function") {
+ // Load the override file and immediately invoke the supplied function.
+ newCode = `load("${overridesFile}"); (${jsCode})();`;
+ } else {
+ newCode = `load("${overridesFile}"); ${jsCode};`;
+ }
+
+ return originalStartParallelShell(newCode, port, noConnect);
+ };
+})();