diff options
author | Filipe David Borba Manana <fdmanana@apache.org> | 2011-05-18 10:54:39 +0000 |
---|---|---|
committer | Filipe David Borba Manana <fdmanana@apache.org> | 2011-05-18 10:54:39 +0000 |
commit | a9ce63984c13d126f633a6ab8a243910feac6bc8 (patch) | |
tree | 4a29b23a66f4826d1264c7f4c1655dbc7a954835 /share/www | |
parent | aea9ddf21eedc566afa01892778081425fc131ac (diff) |
Avoid assertion failure in replication.js due to timing issues
git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1124185 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www')
-rw-r--r-- | share/www/script/test/replication.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/share/www/script/test/replication.js b/share/www/script/test/replication.js index a08c0b66..5e85847e 100644 --- a/share/www/script/test/replication.js +++ b/share/www/script/test/replication.js @@ -12,6 +12,20 @@ couchTests.replication = function(debug) { if (debug) debugger; + + function waitForSeq(sourceDb, targetDb) { + var targetSeq, + sourceSeq = sourceDb.info().update_seq, + t0 = new Date(), + t1, + ms = 3000; + + do { + targetSeq = targetDb.info().update_seq; + t1 = new Date(); + } while (((t1 - t0) <= ms) && targetSeq < sourceSeq); + } + var host = CouchDB.host; var dbPairs = [ {source:"test_suite_db_a", @@ -768,6 +782,7 @@ couchTests.replication = function(debug) { var tasksAfter = JSON.parse(xhr.responseText); TEquals(tasks.length, tasksAfter.length); + waitForSeq(dbA, dbB); T(dbB.open("30") !== null); repResult = CouchDB.replicate( |