summaryrefslogtreecommitdiff
path: root/jstests/noPassthroughWithMongod/benchrun_substitution.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/noPassthroughWithMongod/benchrun_substitution.js')
-rw-r--r--jstests/noPassthroughWithMongod/benchrun_substitution.js74
1 files changed, 36 insertions, 38 deletions
diff --git a/jstests/noPassthroughWithMongod/benchrun_substitution.js b/jstests/noPassthroughWithMongod/benchrun_substitution.js
index afc79b4cc49..ddcef69d73d 100644
--- a/jstests/noPassthroughWithMongod/benchrun_substitution.js
+++ b/jstests/noPassthroughWithMongod/benchrun_substitution.js
@@ -2,75 +2,73 @@ function benchrun_sub_insert(use_write_command) {
t = db.benchrun_sub;
t.drop();
var offset = 10000;
- ops = [{op: "insert", ns: "test.benchrun_sub",
- doc: {x: { "#RAND_INT" : [ 0, 100 ] },
- curDate: { "#CUR_DATE" : 0 } ,
- futureDate: { "#CUR_DATE" : offset} ,
- pastDate: { "#CUR_DATE" : (0 - offset) } },
- writeCmd: use_write_command,
- }];
+ ops = [{
+ op: "insert",
+ ns: "test.benchrun_sub",
+ doc: {
+ x: {"#RAND_INT": [0, 100]},
+ curDate: {"#CUR_DATE": 0},
+ futureDate: {"#CUR_DATE": offset},
+ pastDate: {"#CUR_DATE": (0 - offset)}
+ },
+ writeCmd: use_write_command,
+ }];
- res = benchRun({parallel: 1,
- seconds: 10,
- ops : ops,
- host: db.getMongo().host});
+ res = benchRun({parallel: 1, seconds: 10, ops: ops, host: db.getMongo().host});
assert.gt(res.insert, 0);
t.find().forEach(function(doc) {
- var field = doc.x;
- assert.gte(field, 0);
- assert.lt(field, 100);
- assert.lt(doc.pastDate, doc.curDate);
- assert.lt(doc.curDate, doc.futureDate);
- }
- );
+ var field = doc.x;
+ assert.gte(field, 0);
+ assert.lt(field, 100);
+ assert.lt(doc.pastDate, doc.curDate);
+ assert.lt(doc.curDate, doc.futureDate);
+ });
}
function benchrun_sub_update(use_write_command) {
t = db.benchrun_sub;
t.drop();
- ops = [{op: "update", ns: "test.benchrun_sub",
- query: {x: {"#RAND_INT": [0, 100]}},
- update: {$inc : {x : 1}},
- writeCmd: use_write_command}];
+ ops = [{
+ op: "update",
+ ns: "test.benchrun_sub",
+ query: {x: {"#RAND_INT": [0, 100]}},
+ update: {$inc: {x: 1}},
+ writeCmd: use_write_command
+ }];
for (var i = 0; i < 100; ++i) {
t.insert({x: i});
}
- res = benchRun({parallel: 1,
- seconds: 10,
- ops: ops,
- host: db.getMongo().host});
+ res = benchRun({parallel: 1, seconds: 10, ops: ops, host: db.getMongo().host});
var field_sum = 0;
t.find().forEach(function(doc) {
- field_sum += doc.x;
- }
- );
+ field_sum += doc.x;
+ });
- assert.gt(field_sum, 4950); // 1 + 2 + .. 99 = 4950
+ assert.gt(field_sum, 4950); // 1 + 2 + .. 99 = 4950
}
function benchrun_sub_remove(use_write_command) {
t = db.benchrun_sub;
t.drop();
- ops = [{op: "remove", ns: "test.benchrun_sub",
- query: {x: {"#RAND_INT": [0, 100]}},
- writeCmd: use_write_command,
- }];
+ ops = [{
+ op: "remove",
+ ns: "test.benchrun_sub",
+ query: {x: {"#RAND_INT": [0, 100]}},
+ writeCmd: use_write_command,
+ }];
for (var i = 0; i < 100; ++i) {
t.insert({x: i});
}
- res = benchRun({parallel: 1,
- seconds: 10,
- ops: ops,
- host: db.getMongo().host});
+ res = benchRun({parallel: 1, seconds: 10, ops: ops, host: db.getMongo().host});
assert.eq(t.count(), 0);
}