Skip to content

Commit

Permalink
made bench_test3 less flaky, just have it retry a few times #869
Browse files Browse the repository at this point in the history
  • Loading branch information
leifwalsh committed Feb 15, 2014
1 parent 558f180 commit 0c91a2a
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions jstests/bench_test3.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
t = db.bench_test3
t.drop();


benchArgs = { ops : [ { ns : t.getFullName() ,
Expand All @@ -18,10 +17,26 @@ if (jsTest.options().auth) {
benchArgs['password'] = jsTest.options().adminPassword;
}

res = benchRun( benchArgs )
printjson( res );
for (var i = 0; i < 5; ++i) {
t.drop();

var keys = []
var totals = {}
db.bench_test3.find().sort( { _id : 1 } ).forEach( function(z){ keys.push( z._id ); totals[z._id] = z.x } );
assert.eq( [ 0 , 4 , 8 , 12 , 16 ] , keys )
res = benchRun( benchArgs )
printjson( res );

var keys = []
var totals = {}
db.bench_test3.find().sort( { _id : 1 } ).forEach( function(z){ keys.push( z._id ); totals[z._id] = z.x } );

// Rather than do this assert, since the updates sometimes get lock not granted, we try a few
// times before failing the test
// assert.eq( [ 0 , 4 , 8 , 12 , 16 ] , keys )

if (keys == [ 0 , 4 , 8 , 12 , 16 ]) {
// pass
break;
}

if (i == 4) {
assert.eq( [ 0 , 4 , 8 , 12 , 16 ] , keys );
}
}

0 comments on commit 0c91a2a

Please sign in to comment.