Skip to content
Browse files

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
  • Loading branch information...
1 parent aea9ddf commit a9ce63984c13d126f633a6ab8a243910feac6bc8 @fdmanana fdmanana committed May 18, 2011
Showing with 15 additions and 0 deletions.
  1. +15 −0 share/www/script/test/replication.js
View
15 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(

0 comments on commit a9ce639

Please sign in to comment.
Something went wrong with that request. Please try again.