summaryrefslogtreecommitdiff
path: root/jstests/dur
diff options
context:
space:
mode:
authorDwight <dwight@10gen.com>2011-05-04 14:22:39 -0400
committerDwight <dwight@10gen.com>2011-05-04 14:22:39 -0400
commit5e99599e6912fcc916cd9f7c9d89690b6285029a (patch)
tree400ebc0b06eb88776b16ea883ba6b691186e7100 /jstests/dur
parent2b7145944b2c73ce7e76866d40ddc2611df3cb0c (diff)
downloadmongo-5e99599e6912fcc916cd9f7c9d89690b6285029a.tar.gz
slightly testier
Diffstat (limited to 'jstests/dur')
-rw-r--r--jstests/dur/closeall.js76
1 files changed, 41 insertions, 35 deletions
diff --git a/jstests/dur/closeall.js b/jstests/dur/closeall.js
index f169f065826..9131aed9403 100644
--- a/jstests/dur/closeall.js
+++ b/jstests/dur/closeall.js
@@ -8,7 +8,9 @@ function f() {
var ourdb = "closealltest";
print("closeall.js start mongod variant:" + variant);
- var options = (new Date()-0)%2==0 ? 8 : 0;
+ var R = (new Date()-0)%2;
+ var QuickCommits = (new Date()-0)%3 == 0;
+ var options = R==0 ? 8 : 0; // 8 is DurParanoid
print("closeall.js --durOptions " + options);
var N = 1000;
if (options)
@@ -23,6 +25,10 @@ function f() {
// we'll use two connections to make a little parallelism
var db1 = conn.getDB(ourdb);
var db2 = new Mongo(db1.getMongo().host).getDB(ourdb);
+ if( QuickCommits ) {
+ print("closeall.js QuickCommits variant (using a small syncdelay)");
+ assert( db2.adminCommand({setParameter:1, syncdelay:5}).ok );
+ }
print("closeall.js run test");
@@ -34,9 +40,9 @@ function f() {
db1.foo.update({ x: 99 }, { a: 1, b: 2, c: 3, d: 4 });
if (i % 100 == 0)
db1.foo.find();
- if( i == 800 )
+ if( i == 800 )
db1.foo.ensureIndex({ x: 1 });
- var res = null;
+ var res = null;
try {
if( variant == 1 )
sleep(0);
@@ -44,37 +50,37 @@ function f() {
sleep(1);
else if( variant == 3 && i % 10 == 0 )
print(i);
- res = db2.adminCommand("closeAllDatabases");
- }
- catch (e) {
- sleep(5000); // sleeping a little makes console output order prettier
- print("\n\n\nFAIL closeall.js closeAllDatabases command invocation threw an exception. i:" + i);
- try {
- print("getlasterror:");
- printjson(db2.getLastErrorObj());
- print("trying one more closealldatabases:");
- res = db2.adminCommand("closeAllDatabases");
- printjson(res);
- }
- catch (e) {
- print("got another exception : " + e);
- }
- print("\n\n\n");
- // sleep a little to capture possible mongod output?
- sleep(2000);
- throw e;
- }
- assert( res.ok, "closeAllDatabases res.ok=false");
- }
-
- print("closeall.js end test loop. slave.foo.count:");
- print(slave.foo.count());
-
- print("closeall.js shutting down servers");
- stopMongod(30002);
- stopMongod(30001);
-}
-
-f();
+ res = db2.adminCommand("closeAllDatabases");
+ }
+ catch (e) {
+ sleep(5000); // sleeping a little makes console output order prettier
+ print("\n\n\nFAIL closeall.js closeAllDatabases command invocation threw an exception. i:" + i);
+ try {
+ print("getlasterror:");
+ printjson(db2.getLastErrorObj());
+ print("trying one more closealldatabases:");
+ res = db2.adminCommand("closeAllDatabases");
+ printjson(res);
+ }
+ catch (e) {
+ print("got another exception : " + e);
+ }
+ print("\n\n\n");
+ // sleep a little to capture possible mongod output?
+ sleep(2000);
+ throw e;
+ }
+ assert( res.ok, "closeAllDatabases res.ok=false");
+ }
+
+ print("closeall.js end test loop. slave.foo.count:");
+ print(slave.foo.count());
+
+ print("closeall.js shutting down servers");
+ stopMongod(30002);
+ stopMongod(30001);
+}
+
+f();
sleep(500);
print("SUCCESS closeall.js");