summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2018-03-28 15:13:21 +0200
committerJan Lehnardt <jan@apache.org>2018-03-28 16:11:04 +0200
commit0074b4f9fc67649be212086eeb2cb6dc066855a0 (patch)
tree3a9ec07f59e322a81baaf04d1c67554a1854d784
parent0e1cdef450db07dad5349a7d0ce26b41dab435f7 (diff)
downloadcouchdb-0074b4f9fc67649be212086eeb2cb6dc066855a0.tar.gz
fix: more reliable password scheme tests
Closes #1238 1. log errors from waitForSuccess 2. log errors in testFun() 3. spinloop replaces arbitrary wait timeout
-rw-r--r--test/javascript/couch_test_runner.js4
-rw-r--r--test/javascript/tests/users_db_security.js33
2 files changed, 34 insertions, 3 deletions
diff --git a/test/javascript/couch_test_runner.js b/test/javascript/couch_test_runner.js
index 47f1ad95c..7fe8ed39f 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 536585acf..4cc154edd 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')
}
}
);