summaryrefslogtreecommitdiff
path: root/jstests/parallel
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2010-01-05 14:05:40 -0800
committerAaron <aaron@10gen.com>2010-01-05 14:05:40 -0800
commit88eb16dc0f8b06311b5e04670c6377be491652e4 (patch)
treee507eb66658eb9bf740b9342117bb2c02b7206ee /jstests/parallel
parent5869ed26b864f335345c7a496f592bf23c3f1ed6 (diff)
downloadmongo-88eb16dc0f8b06311b5e04670c6377be491652e4.tar.gz
SERVER-470 move more code to parallel testing fwk
Diffstat (limited to 'jstests/parallel')
-rw-r--r--jstests/parallel/basic.js58
-rw-r--r--jstests/parallel/insert.js29
2 files changed, 11 insertions, 76 deletions
diff --git a/jstests/parallel/basic.js b/jstests/parallel/basic.js
index 96a488686fe..9c103069349 100644
--- a/jstests/parallel/basic.js
+++ b/jstests/parallel/basic.js
@@ -1,62 +1,10 @@
// perform basic js tests in parallel
-var files = listFiles("jstests");
-
-var params = new Array( [], [], [], [] );
-
Random.setRandomSeed();
-makeKeys = function( a ) {
- var ret = {};
- for( var i in a ) {
- ret[ a[ i ] ] = 1;
- }
- return ret;
-}
-
-// some tests can't run in parallel with most others
-var skipTests = makeKeys( [ "jstests/dbadmin.js",
- "jstests/repair.js",
- "jstests/cursor8.js",
- "jstests/recstore.js",
- "jstests/extent.js",
- "jstests/indexb.js",
- "jstests/profile1.js"] );
-
-// some tests can't be run in parallel with each other
-var serialTestsArr = [ "jstests/fsync.js",
- "jstests/fsync2.js" ];
-var serialTests = makeKeys( serialTestsArr );
-
-params[ 0 ] = serialTestsArr;
-
-files = Array.shuffle( files );
-
-var i = 0;
-files.forEach(
- function(x) {
-
- if ( /_runner/.test(x.name) ||
- /_lodeRunner/.test(x.name) ||
- ( x.name in skipTests ) ||
- ( x.name in serialTests ) ||
- ! /\.js$/.test(x.name ) ){
- print(" >>>>>>>>>>>>>>> skipping " + x.name);
- return;
- }
-
- params[ i % 4 ].push( x.name );
- ++i;
- }
-);
-
-// randomize ordering of the serialTests
-params[ 0 ] = Array.shuffle( params[ 0 ] );
-
-t = new ParallelTester();
-
-for( var i in params ) {
- params[ i ].unshift( i );
+var params = ParallelTester.createJstestsLists( 4 );
+var t = new ParallelTester();
+for( i in params ) {
t.add( ParallelTester.fileTester, params[ i ] );
}
diff --git a/jstests/parallel/insert.js b/jstests/parallel/insert.js
index 40302450e45..f62bde78be2 100644
--- a/jstests/parallel/insert.js
+++ b/jstests/parallel/insert.js
@@ -2,34 +2,21 @@
f = db.jstests_parallel_insert;
f.drop();
-f.ensureIndex( {me:1} );
+f.ensureIndex( {who:1} );
Random.setRandomSeed();
t = new ParallelTester();
-test = function() {
- var args = argumentsToArray( arguments );
- var me = args.shift();
- var m = new Mongo( db.getMongo().host );
- var t = m.getDB( "test" ).jstests_parallel_insert;
- for( var i in args ) {
- sleep( args[ i ] );
- if ( i % 50 == 0 ) {
- assert.eq( i, t.count( { who:me } ) );
- print( me + " " + i );
- }
- t.save( { i:i, who:me } );
- }
-}
-
-for( i = 0; i < 10; ++i ) {
- var params = [ i ];
- var mean = Random.rand() * 20;
+for( id = 0; id < 10; ++id ) {
+ var g = new EventGenerator( id, "jstests_parallel_insert", Random.rand() * 20 );
for( j = 0; j < 1000; ++j ) {
- params.push( Random.genExp( mean ) );
+ if ( j % 50 == 0 ) {
+ g.addCheckCount( j, {who:id} );
+ }
+ g.addInsert( { i:j, who:id } );
}
- t.add( test, params );
+ t.add( EventGenerator.dispatch, g.getEvents() );
}
t.run( "one or more tests failed" );