diff options
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) { |