You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2012/12/06 22:06:55 UTC

[24/27] git commit: Work around race conditions in tests on faster hardware.

Work around race conditions in tests on faster hardware.

THIS NEEDS A PROPER FIX.


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/5316647b
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/5316647b
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/5316647b

Branch: refs/heads/1597-update-erlang-oauth-1-3-0
Commit: 5316647be17913ec0d9d7166368bffc13f8aaf01
Parents: 4166764
Author: Jan Lehnardt <ja...@apache.org>
Authored: Tue Nov 13 19:07:22 2012 +0100
Committer: Jan Lehnardt <ja...@apache.org>
Committed: Tue Nov 13 19:07:22 2012 +0100

----------------------------------------------------------------------
 share/www/script/test/replication.js       |    1 +
 share/www/script/test/users_db_security.js |    8 ++++++++
 2 files changed, 9 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/5316647b/share/www/script/test/replication.js
----------------------------------------------------------------------
diff --git a/share/www/script/test/replication.js b/share/www/script/test/replication.js
index f54ffff..2b23af5 100644
--- a/share/www/script/test/replication.js
+++ b/share/www/script/test/replication.js
@@ -97,6 +97,7 @@ couchTests.replication = function(debug) {
   function populateDb(db, docs, dontRecreateDb) {
     if (dontRecreateDb !== true) {
       db.deleteDb();
+      wait(100);
       db.createDb();
     }
     for (var i = 0; i < docs.length; i++) {

http://git-wip-us.apache.org/repos/asf/couchdb/blob/5316647b/share/www/script/test/users_db_security.js
----------------------------------------------------------------------
diff --git a/share/www/script/test/users_db_security.js b/share/www/script/test/users_db_security.js
index f8a9d5c..d439fcb 100644
--- a/share/www/script/test/users_db_security.js
+++ b/share/www/script/test/users_db_security.js
@@ -14,6 +14,13 @@ couchTests.users_db_security = function(debug) {
   var usersDb = new CouchDB("test_suite_users", {"X-Couch-Full-Commit":"false"});
   if (debug) debugger;
 
+  function wait(ms) {
+    var t0 = new Date(), t1;
+    do {
+      CouchDB.request("GET", "/");
+      t1 = new Date();
+    } while ((t1 - t0) <= ms);
+  }
 
   var loginUser = function(username) {
     var pws = {
@@ -133,6 +140,7 @@ couchTests.users_db_security = function(debug) {
       jchrisDoc.password = "couch";
 
       TEquals(true, save_as(usersDb, jchrisDoc, "jchris").ok);
+      wait(100);
       var jchrisDoc = open_as(usersDb, "org.couchdb.user:jchris", "jchris1");
 
       TEquals(undefined, jchrisDoc.password, "password field should be null 2");