summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorEddie Louie <eddie.louie@mongodb.com>2017-09-30 02:44:13 -0400
committerEddie Louie <eddie.louie@mongodb.com>2017-10-03 19:07:24 -0400
commit6ed8e31519f14f163606f17199f4cb9b0dccf281 (patch)
tree6d58788cfc5808ce60cfbffbc98d6dca85b50115 /jstests
parent3a2666842f2a6ae57fdb09ccaedc629ca5871e67 (diff)
downloadmongo-6ed8e31519f14f163606f17199f4cb9b0dccf281.tar.gz
SERVER-29243 Move jsHeapLimit.js from core to noPassthrough
Plus add overrides for runMongod, ShardingTest and ReplSetTest to throw error if any js test in core.yml tries to use these to start their own mongod.
Diffstat (limited to 'jstests')
-rw-r--r--jstests/libs/override_methods/detect_spawning_own_mongod.js33
-rw-r--r--jstests/noPassthrough/jsHeapLimit.js (renamed from jstests/core/jsHeapLimit.js)2
2 files changed, 34 insertions, 1 deletions
diff --git a/jstests/libs/override_methods/detect_spawning_own_mongod.js b/jstests/libs/override_methods/detect_spawning_own_mongod.js
new file mode 100644
index 00000000000..ad8e1cd8a5e
--- /dev/null
+++ b/jstests/libs/override_methods/detect_spawning_own_mongod.js
@@ -0,0 +1,33 @@
+/**
+ * Define overrides to be loaded in the core.yml suite.
+ * Since the core.yml suite should not contain JS tests that start their own mongod/s, these
+ * overrides are to catch any JS tests that tries to spawn their own mongod by throwing an error.
+ */
+(function() {
+ 'use strict';
+
+ MongoRunner.runMongod = function() {
+ throw new Error("Detected MongoRunner.runMongod() call in js test from core.yml suite. " +
+ "Consider moving the test to one of the jstests/noPassthrough/, " +
+ "jstests/replsets/, or jstests/sharding/ directories.");
+ };
+
+ MongoRunner.runMongos = function() {
+ throw new Error("Detected MongoRunner.runMongos() call in js test from core.yml suite. " +
+ "Consider moving the test to one of the jstests/noPassthrough/, " +
+ "jstests/replsets/, or jstests/sharding/ directories.");
+ };
+
+ ShardingTest = function() {
+ throw new Error("Detected ShardingTest() call in js test from core.yml suite. " +
+ "Consider moving the test to one of the jstests/noPassthrough/, " +
+ "jstests/replsets/, or jstests/sharding/ directories.");
+ };
+
+ ReplSetTest = function() {
+ throw new Error("Detected ReplSetTest() call in js test from core.yml suite. " +
+ "Consider moving the test to one of the jstests/noPassthrough/, " +
+ "jstests/replsets/, or jstests/sharding/ directories.");
+ };
+
+})();
diff --git a/jstests/core/jsHeapLimit.js b/jstests/noPassthrough/jsHeapLimit.js
index 51d9cdc7b7e..512a79332ad 100644
--- a/jstests/core/jsHeapLimit.js
+++ b/jstests/noPassthrough/jsHeapLimit.js
@@ -23,4 +23,4 @@
assert.eq(1000, res.jsHeapLimitMB);
MongoRunner.stopMongod(conn);
-})(); \ No newline at end of file
+})();