summaryrefslogtreecommitdiff
path: root/jstests/dur
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2014-05-06 19:00:56 -0400
committerDavid Storch <david.storch@10gen.com>2014-05-06 19:00:56 -0400
commit72380726608df663a85bee24d69a20ed2ca8287d (patch)
tree735b7724ddc814fdf385d754bd7921975b5de491 /jstests/dur
parent3061ab54eb2cc642a279becfca0b93f5e17db117 (diff)
downloadmongo-72380726608df663a85bee24d69a20ed2ca8287d.tar.gz
Revert "SERVER-13741 Migrate remaining tests to use write commands"
This reverts commit 87dc3ae516e1d12a632dc604710661e38ed7b3dd.
Diffstat (limited to 'jstests/dur')
-rwxr-xr-xjstests/dur/a_quick.js6
-rw-r--r--jstests/dur/closeall.js39
-rw-r--r--jstests/dur/diskfull.js11
-rw-r--r--jstests/dur/dropdb.js4
-rwxr-xr-xjstests/dur/dur1.js6
-rwxr-xr-xjstests/dur/dur1_tool.js7
-rw-r--r--jstests/dur/indexbg2.js4
-rwxr-xr-xjstests/dur/manyRestart.js6
-rw-r--r--jstests/dur/md5.js7
-rwxr-xr-xjstests/dur/oplog.js3
10 files changed, 66 insertions, 27 deletions
diff --git a/jstests/dur/a_quick.js b/jstests/dur/a_quick.js
index bbec8af6939..ab36f91327e 100755
--- a/jstests/dur/a_quick.js
+++ b/jstests/dur/a_quick.js
@@ -62,7 +62,8 @@ tst.log("start mongod without dur");
var conn = startMongodEmpty("--port", 30000, "--dbpath", path1, "--nodur");
tst.log("without dur work");
var d = conn.getDB("test");
-assert.writeOK(d.foo.insert({ _id: 123 }));
+d.foo.insert({ _id:123 });
+d.getLastError();
tst.log("stop without dur");
stopMongod(30000);
@@ -71,7 +72,8 @@ tst.log("start mongod with dur");
conn = startMongodEmpty("--port", 30001, "--dbpath", path2, "--dur", "--durOptions", 8);
tst.log("with dur work");
d = conn.getDB("test");
-assert.writeOK(d.foo.insert({ _id: 123 }));
+d.foo.insert({ _id: 123 });
+d.getLastError(); // wait
// we could actually do getlasterror fsync:1 now, but maybe this is agood
// as it will assure that commits happen on a timely basis. a bunch of the other dur/*js
diff --git a/jstests/dur/closeall.js b/jstests/dur/closeall.js
index 8c3864e8118..3d7119ab134 100644
--- a/jstests/dur/closeall.js
+++ b/jstests/dur/closeall.js
@@ -30,24 +30,26 @@ function f(variant, quickCommits, paranoid) {
print("closeall.js run test");
print("wait for initial sync to finish") // SERVER-4852
- assert.writeOK(db1.foo.insert({}, { writeConcern: { w: 2 }}));
- assert.writeOK(db1.foo.remove({}, { writeConcern: { w: 2 }}));
+ db1.foo.insert({});
+ err = db1.getLastErrorObj(2);
+ printjson(err)
+ assert.isnull(err.err);
+ db1.foo.remove({});
+ err = db1.getLastErrorObj(2);
+ printjson(err)
+ assert.isnull(err.err);
print("initial sync done")
- var writeOps = startParallelShell('var coll = db.getSiblingDB("closealltest").foo; \
- var bulk = coll.initializeUnorderedBulkOp(); \
- for( var i = 0; i < ' + N + '; i++ ) { \
- bulk.insert({ x: 1 }); \
- if ( i % 7 == 0 ) \
- bulk.insert({ x: 99, y: 2 }); \
- if ( i % 49 == 0 ) \
- bulk.find({ x: 99 }).update( \
- { a: 1, b: 2, c: 3, d: 4 }); \
- if( i == 800 ) \
- coll.ensureIndex({ x: 1 }); \
- }', 30001);
-
- for( var i = 0; i < N; i++ ) {
+ for( var i = 0; i < N; i++ ) {
+ db1.foo.insert({x:1}); // this does wait for a return code so we will get some parallelism
+ if( i % 7 == 0 )
+ db1.foo.insert({x:99, y:2});
+ if( i % 49 == 0 )
+ db1.foo.update({ x: 99 }, { a: 1, b: 2, c: 3, d: 4 });
+ if (i % 100 == 0)
+ db1.foo.find();
+ if( i == 800 )
+ db1.foo.ensureIndex({ x: 1 });
var res = null;
try {
if( variant == 1 )
@@ -59,6 +61,7 @@ function f(variant, quickCommits, paranoid) {
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:");
@@ -71,6 +74,8 @@ function f(variant, quickCommits, paranoid) {
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");
@@ -82,8 +87,6 @@ function f(variant, quickCommits, paranoid) {
print("closeall.js shutting down servers");
stopMongod(30002);
stopMongod(30001);
-
- writeOps();
}
// Skip this test on 32-bit Windows (unfixable failures in MapViewOfFileEx)
diff --git a/jstests/dur/diskfull.js b/jstests/dur/diskfull.js
index a604439424d..a1efba5595d 100644
--- a/jstests/dur/diskfull.js
+++ b/jstests/dur/diskfull.js
@@ -50,12 +50,15 @@ function work() {
log("work");
try {
var d = conn.getDB("test");
- var big = new Array( 5000 ).toString();
- var bulk = d.foo.initializeUnorderedBulkOp();
+
+ big = new Array( 5000 ).toString();
for( i = 0; i < 10000; ++i ) {
- bulk.insert({ _id: i, b: big });
+ d.foo.insert( { _id:i, b:big } );
}
- assert.writeOK(bulk.execute());
+
+ gle = d.getLastError();
+ if ( gle )
+ throw gle;
} catch ( e ) {
print( e );
raise( e );
diff --git a/jstests/dur/dropdb.js b/jstests/dur/dropdb.js
index 54de6bdd7f2..4fb94cc7d1e 100644
--- a/jstests/dur/dropdb.js
+++ b/jstests/dur/dropdb.js
@@ -62,8 +62,10 @@ function work() {
d.dropDatabase();
+ d.foo.insert({ _id: 100 });
+
// assure writes applied in case we kill -9 on return from this function
- assert.writeOK(d.foo.insert({ _id: 100 }, { writeConcern: { fsync: 1 }}));
+ assert(d.runCommand({ getlasterror: 1, fsync: 1 }).ok, "getlasterror not ok");
}
function verify() {
diff --git a/jstests/dur/dur1.js b/jstests/dur/dur1.js
index 0aecaaac21c..cb4495aea52 100755
--- a/jstests/dur/dur1.js
+++ b/jstests/dur/dur1.js
@@ -64,6 +64,12 @@ function work() {
// try building an index. however, be careful as object id's in system.indexes would vary, so we do it manually:
d.system.indexes.insert({ _id: 99, ns: "test.a", key: { x: 1 }, name: "x_1", v: 0 });
+// d.a.update({ _id: 4 }, { $inc: { x: 1} });
+// d.a.reIndex();
+
+ // assure writes applied in case we kill -9 on return from this function
+ d.getLastError();
+
log("endwork");
return d;
}
diff --git a/jstests/dur/dur1_tool.js b/jstests/dur/dur1_tool.js
index adee933fdb4..fdfe05236f4 100755
--- a/jstests/dur/dur1_tool.js
+++ b/jstests/dur/dur1_tool.js
@@ -63,6 +63,13 @@ function work() {
// try building an index. however, be careful as object id's in system.indexes would vary, so we do it manually:
d.system.indexes.insert({ _id: 99, ns: "test.a", key: { x: 1 }, name: "x_1", v: 0 });
+
+// d.a.update({ _id: 4 }, { $inc: { x: 1} });
+// d.a.reIndex();
+
+ // assure writes applied in case we kill -9 on return from this function
+ d.getLastError();
+
log("endwork");
return d;
}
diff --git a/jstests/dur/indexbg2.js b/jstests/dur/indexbg2.js
index d239d4eaa44..a7484f0a561 100644
--- a/jstests/dur/indexbg2.js
+++ b/jstests/dur/indexbg2.js
@@ -15,5 +15,5 @@ for( var i = 1000; i < 2000; ++i ) {
t.insert( {_id:i,a:'abcd',b:'bcde',x:'four score and seven years ago'} );
t.remove( {_id:i} );
}
-assert.writeOK(t.insert({ _id: 2000, a: 'abcd', b: 'bcde', x: 'four score and seven years ago' }));
-
+t.insert( {_id:2000,a:'abcd',b:'bcde',x:'four score and seven years ago'} );
+assert( !t.getDB().getLastError() );
diff --git a/jstests/dur/manyRestart.js b/jstests/dur/manyRestart.js
index 5a68afdecbb..f434278ca9a 100755
--- a/jstests/dur/manyRestart.js
+++ b/jstests/dur/manyRestart.js
@@ -63,6 +63,12 @@ function work() {
// try building an index. however, be careful as object id's in system.indexes would vary, so we do it manually:
d.system.indexes.insert({ _id: 99, ns: "test.a", key: { x: 1 }, name: "x_1", v: 0 });
+
+// d.a.update({ _id: 4 }, { $inc: { x: 1} });
+// d.a.reIndex();
+
+ // assure writes applied in case we kill -9 on return from this function
+ d.getLastError();
log("endwork");
return d;
}
diff --git a/jstests/dur/md5.js b/jstests/dur/md5.js
index 1b4ec43340e..1773091186a 100644
--- a/jstests/dur/md5.js
+++ b/jstests/dur/md5.js
@@ -29,6 +29,13 @@ function work() {
// try building an index. however, be careful as object id's in system.indexes would vary, so we do it manually:
d.system.indexes.insert({ _id: 99, ns: "test.a", key: { x: 1 }, name: "x_1", v: 0 });
+
+ // d.a.update({ _id: 4 }, { $inc: { x: 1} });
+ // d.a.reIndex();
+
+ // assure writes applied in case we kill -9 on return from this function
+ d.getLastError();
+
log("endwork");
}
diff --git a/jstests/dur/oplog.js b/jstests/dur/oplog.js
index 8ded3c980a9..cd7d7c5e6ef 100755
--- a/jstests/dur/oplog.js
+++ b/jstests/dur/oplog.js
@@ -81,6 +81,9 @@ function work() {
d.foo.insert({ _id: 6, q: "aaaaa", b: big, z: 3 });
d.foo.update({ _id: 5 }, { $set: { z: 99} });
+ // assure writes applied in case we kill -9 on return from this function
+ d.getLastError();
+
log("endwork");
verify();