summaryrefslogtreecommitdiff
path: root/jstests/serial_run/memory.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/serial_run/memory.js')
-rw-r--r--jstests/serial_run/memory.js16
1 files changed, 11 insertions, 5 deletions
diff --git a/jstests/serial_run/memory.js b/jstests/serial_run/memory.js
index f9b125b24a9..e117f572dc2 100644
--- a/jstests/serial_run/memory.js
+++ b/jstests/serial_run/memory.js
@@ -1,12 +1,18 @@
var col = db.memoryTest;
-var buildInfo = db.adminCommand("buildInfo");
+var buildInfo = assert.commandWorked(db.adminCommand("buildInfo"));
+var serverStatus = assert.commandWorked(db.adminCommand("serverStatus"));
+
+// If mongod was compiled with the code coverage flag, then we reduce the length of some of the
+// tests as they take an excessive amount of time. If the mongod is running with an in-memory
+// storage engine, then we reduce the length of some of the tests to avoid an OOM due to the number
+// of documents inserted.
var codeCoverageVariant = buildInfo.buildEnvironment.ccflags.includes("-ftest-coverage");
-// If mongod was compiled with the code coverage flag, reduce some tests, as they take excessive
-// time.
+var inMemoryStorageEngine = !serverStatus.storageEngine.persistent;
+var reduceNumLoops = codeCoverageVariant || inMemoryStorageEngine;
// test creating many collections to make sure no internal cache goes OOM
-var loopNum = codeCoverageVariant ? 100 : 10000;
+var loopNum = reduceNumLoops ? 100 : 10000;
for (var i = 0; i < loopNum; ++i) {
name = "memoryTest" + i;
if ((i % 1000) == 0)
@@ -35,7 +41,7 @@ assert.throws(function() {
doWhereTest(1000000000);
});
-loopNum = codeCoverageVariant ? 10000 : 1000000;
+loopNum = reduceNumLoops ? 10000 : 1000000;
doWhereTest(loopNum);
doWhereTest(loopNum);
doWhereTest(loopNum);