summaryrefslogtreecommitdiff
path: root/jstests/dur/closeall.js
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2014-05-14 14:11:11 -0400
committerRandolph Tan <randolph@10gen.com>2014-05-15 14:04:11 -0400
commit0dabee8227d445a18fa5e8e49b2be60ba2a0beef (patch)
tree5cd9058a4483202c2f7e2ab6f5c44079a74ac157 /jstests/dur/closeall.js
parent4de88387eec6c0bb08b10d0ba1574a656f56232d (diff)
downloadmongo-0dabee8227d445a18fa5e8e49b2be60ba2a0beef.tar.gz
SERVER-13741 Migrate remaining tests to use write commands
Diffstat (limited to 'jstests/dur/closeall.js')
-rw-r--r--jstests/dur/closeall.js39
1 files changed, 18 insertions, 21 deletions
diff --git a/jstests/dur/closeall.js b/jstests/dur/closeall.js
index 3d7119ab134..8c3864e8118 100644
--- a/jstests/dur/closeall.js
+++ b/jstests/dur/closeall.js
@@ -30,26 +30,24 @@ function f(variant, quickCommits, paranoid) {
print("closeall.js run test");
print("wait for initial sync to finish") // SERVER-4852
- 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);
+ assert.writeOK(db1.foo.insert({}, { writeConcern: { w: 2 }}));
+ assert.writeOK(db1.foo.remove({}, { writeConcern: { w: 2 }}));
print("initial sync done")
- 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 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++ ) {
var res = null;
try {
if( variant == 1 )
@@ -61,7 +59,6 @@ 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:");
@@ -74,8 +71,6 @@ 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");
@@ -87,6 +82,8 @@ 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)