From a9ce63984c13d126f633a6ab8a243910feac6bc8 Mon Sep 17 00:00:00 2001 From: Filipe David Borba Manana Date: Wed, 18 May 2011 10:54:39 +0000 Subject: 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 --- share/www/script/test/replication.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'share/www/script') 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( -- cgit v1.2.3