diff options
author | Jonathan Abrahams <jonathan@mongodb.com> | 2016-03-09 12:17:50 -0500 |
---|---|---|
committer | Jonathan Abrahams <jonathan@mongodb.com> | 2016-03-09 12:18:14 -0500 |
commit | 4ae691e8edc87d0e3cfb633bb91c328426be007b (patch) | |
tree | 52079a593f54382ca13a2e741633eab1b6271893 /jstests/slow1/memory.js | |
parent | a025d43f3ce2efc1fb1282a718f5d286fa0a4dc1 (diff) | |
download | mongo-4ae691e8edc87d0e3cfb633bb91c328426be007b.tar.gz |
SERVER-22468 Format JS code with approved style in jstests/
Diffstat (limited to 'jstests/slow1/memory.js')
-rw-r--r-- | jstests/slow1/memory.js | 47 |
1 files changed, 31 insertions, 16 deletions
diff --git a/jstests/slow1/memory.js b/jstests/slow1/memory.js index a2f84fddc6c..9d67aa7aab6 100644 --- a/jstests/slow1/memory.js +++ b/jstests/slow1/memory.js @@ -3,31 +3,45 @@ var col = db.memoryTest; // test creating many collections to make sure no internal cache goes OOM for (var i = 0; i < 10000; ++i) { name = "memoryTest" + i; - if ((i % 1000) == 0) print("Processing " + name); - db.eval(function(col) { for (var i = 0; i < 100; ++i) {db[col + "_" + i].find();} }, name); + if ((i % 1000) == 0) + print("Processing " + name); + db.eval(function(col) { + for (var i = 0; i < 100; ++i) { + db[col + "_" + i].find(); + } + }, name); } // test recovery of JS engine after out of memory -db.system.js.save( { "_id" : "f1", "value" : function(n) { - a = []; - b = []; - c = []; - for (i = 0; i < n; i++) { - a.push(Math.random()); - b.push(Math.random()); - c.push(Math.random()); +db.system.js.save({ + "_id": "f1", + "value": function(n) { + a = []; + b = []; + c = []; + for (i = 0; i < n; i++) { + a.push(Math.random()); + b.push(Math.random()); + c.push(Math.random()); + } } -} }); +}); // do mix of calls to make sure OOM is handled with no permanent damage db.eval("f1(10)"); -assert.throws(function() { db.eval("f1(100000000)"); } ); +assert.throws(function() { + db.eval("f1(100000000)"); +}); db.eval("f1(10)"); -assert.throws(function() { db.eval("f1(1000000000)"); } ); +assert.throws(function() { + db.eval("f1(1000000000)"); +}); db.eval("f1(1000000)"); db.eval("f1(1000000)"); db.eval("f1(1000000)"); -assert.throws(function() { db.eval("f1(100000000)"); } ); +assert.throws(function() { + db.eval("f1(100000000)"); +}); db.eval("f1(10)"); db.eval("f1(1000000)"); db.eval("f1(1000000)"); @@ -37,6 +51,7 @@ db.eval("f1(1000000)"); col.drop(); col.insert({a: 1}); col.findOne({$where: "var arr = []; for (var i = 0; i < 1000000; ++i) {arr.push(0);}"}); -assert.throws(function() { col.findOne({$where: "var arr = []; for (var i = 0; i < 1000000000; ++i) {arr.push(0);}"}); }); +assert.throws(function() { + col.findOne({$where: "var arr = []; for (var i = 0; i < 1000000000; ++i) {arr.push(0);}"}); +}); col.findOne({$where: "var arr = []; for (var i = 0; i < 1000000; ++i) {arr.push(0);}"}); - |