diff options
author | Jonathan Abrahams <jonathan@mongodb.com> | 2016-03-09 12:27:20 -0500 |
---|---|---|
committer | Jonathan Abrahams <jonathan@mongodb.com> | 2016-03-09 12:27:56 -0500 |
commit | 8c5ff5834ab1f61e68b7839cd99c3de1f87c2121 (patch) | |
tree | ef4d91cc230300a6a48eeeac696ca15df6db1212 /jstests/noPassthroughWithMongod/fsync2.js | |
parent | 0875be78b405016736ff42e3a50166be7561c2f8 (diff) | |
download | mongo-8c5ff5834ab1f61e68b7839cd99c3de1f87c2121.tar.gz |
SERVER-22468 Format JS code with approved style in jstests/
Diffstat (limited to 'jstests/noPassthroughWithMongod/fsync2.js')
-rw-r--r-- | jstests/noPassthroughWithMongod/fsync2.js | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/jstests/noPassthroughWithMongod/fsync2.js b/jstests/noPassthroughWithMongod/fsync2.js index dad1c6088bf..5710f57e33c 100644 --- a/jstests/noPassthroughWithMongod/fsync2.js +++ b/jstests/noPassthroughWithMongod/fsync2.js @@ -1,59 +1,56 @@ -function debug( msg ) { - print( "fsync2: " + msg ); +function debug(msg) { + print("fsync2: " + msg); } var loops = 200; -if ( db.getSisterDB("local").slaves.count() > 0 ) { +if (db.getSisterDB("local").slaves.count() > 0) { // replication can cause some write locks on local // therefore this test is flaky with replication on loops = 1; } - function doTest() { db.fsync2.drop(); // Make write ops asynchronous so the test won't hang when in fsync lock mode. db.getMongo().forceWriteMode('legacy'); - db.fsync2.save( {x:1} ); - - d = db.getSisterDB( "admin" ); + db.fsync2.save({x: 1}); + + d = db.getSisterDB("admin"); // Don't test if the engine doesn't support fsyncLock - var ret = d.runCommand( {fsync:1, lock: 1 } ); + var ret = d.runCommand({fsync: 1, lock: 1}); if (!ret.ok) { assert.commandFailedWithCode(ret, ErrorCodes.CommandNotSupported); jsTestLog("Skipping test as engine does not support fsyncLock"); return; } - - assert.commandWorked( ret ); - debug( "after lock" ); - + assert.commandWorked(ret); - for ( var i=0; i<loops; i++) { - debug( "loop: " + i ); + debug("after lock"); + + for (var i = 0; i < loops; i++) { + debug("loop: " + i); assert.eq(1, db.fsync2.count()); sleep(100); } - - debug( "about to save" ); - db.fsync2.save( {x:1} ); - debug( "save done" ); - - m = new Mongo( db.getMongo().host ); - + + debug("about to save"); + db.fsync2.save({x: 1}); + debug("save done"); + + m = new Mongo(db.getMongo().host); + // Uncomment once SERVER-4243 is fixed - //assert.eq(1, m.getDB(db.getName()).fsync2.count()); - - assert( m.getDB("admin").fsyncUnlock().ok ); + // assert.eq(1, m.getDB(db.getName()).fsync2.count()); + + assert(m.getDB("admin").fsyncUnlock().ok); - assert.eq( 2, db.fsync2.count() ); - + assert.eq(2, db.fsync2.count()); } -if (!jsTest.options().auth) { // SERVER-4243 +if (!jsTest.options().auth) { // SERVER-4243 doTest(); } |