Author: fdmanana
Date: Wed May 18 10:54:39 2011
New Revision: 1124185
URL: http://svn.apache.org/viewvc?rev=1124185&view=rev
Log:
Avoid assertion failure in replication.js due to timing issues
Modified:
couchdb/branches/1.1.x/share/www/script/test/replication.js
Modified: couchdb/branches/1.1.x/share/www/script/test/replication.js
URL: http://svn.apache.org/viewvc/couchdb/branches/1.1.x/share/www/script/test/replication.js?rev=1124185&r1=1124184&r2=1124185&view=diff
==============================================================================
--- couchdb/branches/1.1.x/share/www/script/test/replication.js (original)
+++ couchdb/branches/1.1.x/share/www/script/test/replication.js Wed May 18 10:54:39 2011
@@ -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(
|