blob: 7e5dc421cad7e3004ea564ab6143e81c01b39f7a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
//
// Tests the behavior of the shell's fluent (bulk) API under legacy opcode writes
//
var conn = MongoRunner.runMongod({});
// Explicitly disable write commands over this connection
conn.useWriteCommands = function() { return false; };
// Remember the global 'db' var
var lastDB = db;
// The fluent API tests are a subset of the standard suite
var coreTests = listFiles("jstests/core");
var fluentTests = [];
var isFluentAPITest = function(fileName) {
return /(^fluent_)|(^bulk_)/.test(fileName) && /\.js$/.test(fileName);
};
coreTests.forEach( function(file) {
if (isFluentAPITest(file.baseName))
fluentTests.push(file);
});
fluentTests.forEach( function(file) {
// Reset global 'db' var
db = conn.getDB("testFluent");
print(" *******************************************");
print(" Test : " + file.name + " ...");
var testTime = Date.timeFunc( function() { load(file.name); }, 1);
print(" " + testTime + "ms");
});
print("Tests completed.");
// Restore 'db' var
db = lastDB;
MongoRunner.stopMongod(conn);
|