diff options
author | Aaron <aaron@10gen.com> | 2010-01-04 10:50:36 -0800 |
---|---|---|
committer | Aaron <aaron@10gen.com> | 2010-01-04 10:50:36 -0800 |
commit | f0d60f2396aa57210aaddf5b208d0d4ab047aded (patch) | |
tree | 27aa1f5137f3370dc5efcf16253fe55759ad91dd /jstests | |
parent | a0f882dae0a477f8c3ed1c75daa6bf84cab83cc8 (diff) | |
download | mongo-f0d60f2396aa57210aaddf5b208d0d4ab047aded.tar.gz |
SERVER-519 adding test
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/fsync.js | 15 | ||||
-rw-r--r-- | jstests/fsync2.js | 15 | ||||
-rw-r--r-- | jstests/parallel/basic.js | 21 |
3 files changed, 43 insertions, 8 deletions
diff --git a/jstests/fsync.js b/jstests/fsync.js index 4097bc65f10..1ea86f5d1f3 100644 --- a/jstests/fsync.js +++ b/jstests/fsync.js @@ -1,5 +1,9 @@ // test the lock/unlock snapshotting feature a bit +debug = function( t ) { + print( t ); +} + x=db.runCommand({fsync:1,lock:1}); assert(!x.ok,"D"); @@ -12,11 +16,22 @@ assert(x.ok,"C"); y = d.currentOp(); assert(y.fsyncLock,"B"); +debug( "current op ok" ); + +printjson( db.foo.find().toArray() ); +db.foo.insert({x:2}); + +debug( "done insert attempt" ); + z = d.runCommand({unlock:1}); +debug( "sent unlock" ); + // it will take some time to unlock, and unlock does not block and wait for that // doing a write will make us wait until db is writeable. db.foo.insert({x:1}); +debug( "done insert" ); + assert( d.currentOp().fsyncLock == null, "A" ); diff --git a/jstests/fsync2.js b/jstests/fsync2.js new file mode 100644 index 00000000000..e294adcb891 --- /dev/null +++ b/jstests/fsync2.js @@ -0,0 +1,15 @@ +db.fsync2.drop(); + +d = db.getSisterDB( "admin" ); + +assert.commandWorked( d.runCommand( {fsync:1, lock: 1 } ) ); + +// uncomment when fixed SERVER-519 +// db.fsync2.save( {x:1 } ); + +m = new Mongo( db.getMongo().host ); +print( "sending unlock command" ); +assert.commandWorked( m.getDB( "admin" ).runCommand( {unlock:1} ) ); + +// uncomment when fixed SERVER-519 +//assert.eq( 1, db.fsync2.count() ); diff --git a/jstests/parallel/basic.js b/jstests/parallel/basic.js index f35c3a359de..8140d826679 100644 --- a/jstests/parallel/basic.js +++ b/jstests/parallel/basic.js @@ -2,31 +2,36 @@ var files = listFiles("jstests"); var i = 0; -var argvs = new Array( [], [], [], [] ); +var argvs = new Array( [{0:[]}], [{1:[]}], [{2:[]}], [{3:[]}] ); + +// some tests can't run in parallel with others +var skipTests = { "jstests/dbadmin.js":1 }; files.forEach( function(x) { if ( /_runner/.test(x.name) || /_lodeRunner/.test(x.name) || + ( x.name in skipTests ) || ! /\.js$/.test(x.name ) ){ print(" >>>>>>>>>>>>>>> skipping " + x.name); return; } - - argvs[ i++ % 4 ].push( x.name ); + + argvs[ i % 4 ][0][ i % 4 ].push( x.name ); + ++i; } ); -printjson( argvs ); - test = function() { - var args = argumentsToArray( arguments ); + var args = argumentsToArray( arguments )[ 0 ]; + var suite = Object.keySet( args )[ 0 ]; + var args = args[ suite ]; args.forEach( function( x ) { - print(" Test : " + x + " ..."); + print(" S" + suite + " Test : " + x + " ..."); var time = Date.timeFunc( function() { load(x); }, 1); - print(" Test : " + x + " " + time + "ms" ); + print(" S" + suite + " Test : " + x + " " + time + "ms" ); } ); } |