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 2018/03/28 14:11:08 UTC

[couchdb] branch master updated: fix: more reliable password scheme tests

This is an automated email from the ASF dual-hosted git repository.

jan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 0074b4f  fix: more reliable password scheme tests
0074b4f is described below

commit 0074b4f9fc67649be212086eeb2cb6dc066855a0
Author: Jan Lehnardt <ja...@apache.org>
AuthorDate: Wed Mar 28 15:13:21 2018 +0200

    fix: more reliable password scheme tests
    
    Closes #1238
    
    1. log errors from waitForSuccess
    2. log errors in testFun()
    3. spinloop replaces arbitrary wait timeout
---
 test/javascript/couch_test_runner.js       |  4 +++-
 test/javascript/tests/users_db_security.js | 33 ++++++++++++++++++++++++++++--
 2 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/test/javascript/couch_test_runner.js b/test/javascript/couch_test_runner.js
index 47f1ad9..7fe8ed3 100644
--- a/test/javascript/couch_test_runner.js
+++ b/test/javascript/couch_test_runner.js
@@ -427,7 +427,9 @@ function waitForSuccess(fun, tag) {
       try {
         fun();
         break;
-      } catch (e) {}
+      } catch (e) {
+        log(e)
+      }
       // sync http req allow async req to happen
       try {
         CouchDB.request("GET", "/test_suite_db/?tag="+encodeURIComponent(tag));
diff --git a/test/javascript/tests/users_db_security.js b/test/javascript/tests/users_db_security.js
index 536585a..4cc154e 100644
--- a/test/javascript/tests/users_db_security.js
+++ b/test/javascript/tests/users_db_security.js
@@ -411,11 +411,27 @@ couchTests.users_db_security = function(debug) {
       function() {
         try {
           testFun(scheme, derivedKeyTests[scheme], saltTests[scheme]);
+        } catch (e) {
+          throw(e)
         } finally {
           CouchDB.login("jan", "apple");
           usersDb.deleteDb(); // cleanup
-          sleep(5000);
+          waitForSuccess(function() {
+            var req = CouchDB.request("GET", db_name);
+            if (req.status == 404) {
+              return true
+            }
+            throw({});
+          }, 'usersDb.deleteDb')
+
           usersDb.createDb();
+          waitForSuccess(function() {
+            var req = CouchDB.request("GET", db_name);
+            if (req.status == 200) {
+              return true
+            }
+            throw({});
+          }, 'usersDb.creteDb')
         }
       }
     );
@@ -501,8 +517,21 @@ couchTests.users_db_security = function(debug) {
       } finally {
         CouchDB.login("jan", "apple");
         usersDb.deleteDb(); // cleanup
-        sleep(5000);
+        waitForSuccess(function() {
+          var req = CouchDB.request("GET", db_name);
+          if (req.status == 404) {
+            return true
+          }
+          throw({});
+        }, 'usersDb.deleteDb')
         usersDb.createDb();
+        waitForSuccess(function() {
+          var req = CouchDB.request("GET", db_name);
+          if (req.status == 200) {
+            return true
+          }
+          throw({});
+        }, 'usersDb.creteDb')
       }
     }
   );

-- 
To stop receiving notification emails like this one, please contact
jan@apache.org.