diff options
author | John Christopher Anderson <jchris@apache.org> | 2010-03-25 19:06:52 +0000 |
---|---|---|
committer | John Christopher Anderson <jchris@apache.org> | 2010-03-25 19:06:52 +0000 |
commit | ed7e7c686fae7f1d2e3f149c2f2ed8854c4f95c8 (patch) | |
tree | 11b0c48c1a404fa8492f1ad5f5bd86228b8642de /share/www/script/couch_tests.js | |
parent | 2da77cca138c267d2e504d00b99a5d9339531210 (diff) |
restart using init:restart() for better test reliability
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@927545 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script/couch_tests.js')
-rw-r--r-- | share/www/script/couch_tests.js | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/share/www/script/couch_tests.js b/share/www/script/couch_tests.js index 85d07065..3978d483 100644 --- a/share/www/script/couch_tests.js +++ b/share/www/script/couch_tests.js @@ -149,6 +149,25 @@ function stringFun(fun) { return string; } +function waitForRestart() { + var waiting = true; + while (waiting) { + try { + CouchDB.request("GET", "/"); + CouchDB.request("GET", "/"); + waiting = false; + } catch(e) { + // the request will fail until restart completes + } + } +}; + function restartServer() { - CouchDB.request("POST", "/_restart"); + var xhr; + try { + CouchDB.request("POST", "/_restart"); + } catch(e) { + // this request may sometimes fail + } + waitForRestart(); } |