diff options
Diffstat (limited to 'share/www/script/test/stats.js')
-rw-r--r-- | share/www/script/test/stats.js | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/share/www/script/test/stats.js b/share/www/script/test/stats.js index cf2581e9..6e37e741 100644 --- a/share/www/script/test/stats.js +++ b/share/www/script/test/stats.js @@ -80,9 +80,24 @@ couchTests.stats = function(debug) { var testFun = function() { var pre_dbs = getStat("couchdb", "open_databases").current || 0; var pre_files = getStat("couchdb", "open_os_files").current || 0; - + + // We have to make sure that as we open the max'th database + // that we've waited for more than 1 second since opening + // the first database so that any delayed commits will be + // flushed. + var times = []; for(var i = 0; i < max*2; i++) { - newDb("test_suite_db_" + i, true); + if(i >= max) { + var msecs = (new Date()).getTime() - times[i-max]; + if(msecs < 1000) { + CouchDB.request("GET", "/_sleep?time=" + (msecs+250)); + } + } + db = newDb("test_suite_db_" + i, true); + times.push((new Date()).getTime()); + + // Trigger a delayed commit + db.save({_id: "" + i, "lang": "Awesome!"}); } var open_dbs = getStat("couchdb", "open_databases").current; |