summaryrefslogtreecommitdiff
path: root/jstests/parallel/basicPlus.js
blob: 2153923c67a4847fba6c99d2cd99f63fd2d0dbf0 (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
31
// perform basic js tests in parallel & some other tasks as well
load('jstests/libs/parallelTester.js');

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 ) );
                                } );