diff options
author | John Christopher Anderson <jchris@apache.org> | 2010-04-06 19:54:04 +0000 |
---|---|---|
committer | John Christopher Anderson <jchris@apache.org> | 2010-04-06 19:54:04 +0000 |
commit | c6b27a3d4fbd4dcbf5716720af5be4e31bf2a8c7 (patch) | |
tree | 3aaa47c50596f0e5e62c37406812f8ca3b88e204 /share/www/script/couch_tests.js | |
parent | 8897dbe40941295009d156bf77eb0bf40abc5136 (diff) |
use waitForSuccess to timeout changes requests that never succeed
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@931297 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script/couch_tests.js')
-rw-r--r-- | share/www/script/couch_tests.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/share/www/script/couch_tests.js b/share/www/script/couch_tests.js index 3978d483..943b851b 100644 --- a/share/www/script/couch_tests.js +++ b/share/www/script/couch_tests.js @@ -149,6 +149,22 @@ function stringFun(fun) { return string; } +function waitForSuccess(fun, tag) { + var start = new Date(); + while(true) { + if (new Date() - start > 5000) { + throw("timeout: "+tag); + } else { + try { + fun(); + break; + } catch (e) {} + // sync http req allow async req to happen + CouchDB.request("GET", "/test_suite_db/?tag="+encodeURIComponent(tag)); + } + } +} + function waitForRestart() { var waiting = true; while (waiting) { |