couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject svn commit: r1124184 - /couchdb/branches/1.0.x/share/www/script/test/replication.js
Date Wed, 18 May 2011 10:51:22 GMT
Author: fdmanana
Date: Wed May 18 10:51:22 2011
New Revision: 1124184

URL: http://svn.apache.org/viewvc?rev=1124184&view=rev
Log:
Avoid assertion failure in replication.js due to timing issues

Modified:
    couchdb/branches/1.0.x/share/www/script/test/replication.js

Modified: couchdb/branches/1.0.x/share/www/script/test/replication.js
URL: http://svn.apache.org/viewvc/couchdb/branches/1.0.x/share/www/script/test/replication.js?rev=1124184&r1=1124183&r2=1124184&view=diff
==============================================================================
--- couchdb/branches/1.0.x/share/www/script/test/replication.js (original)
+++ couchdb/branches/1.0.x/share/www/script/test/replication.js Wed May 18 10:51:22 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",
@@ -723,6 +737,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(



Mime
View raw message