summaryrefslogtreecommitdiff
path: root/jstests/parallel/basicPlus.js
blob: 4d65d255486623b22b58059d4a2c32d8583effb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// perform basic js tests in parallel & some other tasks as well

var c = db.jstests_parallel_basicPlus;
c.drop();

Random.setRandomSeed();

var params = ParallelTester.createJstestsLists( 4 );
var t = new ParallelTester();
for( i in params ) {
    t.add( ParallelTester.fileTester, params[ i ] );
}

for( var i = 4; i < 8; ++i ) {
    var g = new EventGenerator( i, "jstests_parallel_basicPlus", Random.randInt( 20 ) );
    for( var j = ( i - 4 ) * 3000; j < ( i - 3 ) * 3000; ++j ) {
        var expected = j - ( ( i - 4 ) * 3000 );
        g.addCheckCount( expected, {_id:{$gte:((i-4)*3000),$lt:((i-3)*3000)}}, expected % 1000 == 0, expected % 500 == 0 );
        g.addInsert( {_id:j} );
    }
    t.add( EventGenerator.dispatch, g.getEvents() );
}

t.run( "one or more tests failed", true );

assert( c.validate().valid, "validate failed" );
db.getCollectionNames().forEach( function( x ) {
                                v = db[ x ].validate();
                                assert( v.valid, "validate failed for " + x + " with " + tojson( v ) );
                                } );