diff options
author | Jan Lehnardt <jan@apache.org> | 2013-02-08 20:35:56 +0100 |
---|---|---|
committer | Jan Lehnardt <jan@apache.org> | 2013-02-08 20:35:56 +0100 |
commit | e552f629d3967cca8d4394054b871c91568a60da (patch) | |
tree | 3f6f5b6be819bfcbacf86aecb3d7ea1e76b0728f | |
parent | ae048910ebea89942116fe7734d36baaa7d6cfcf (diff) | |
download | couchdb-e552f629d3967cca8d4394054b871c91568a60da.tar.gz |
refactor replicator_db_security to be more resilient
-rw-r--r-- | share/www/script/test/replicator_db_security.js | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/share/www/script/test/replicator_db_security.js b/share/www/script/test/replicator_db_security.js index 67390cf74..7a2bfd18a 100644 --- a/share/www/script/test/replicator_db_security.js +++ b/share/www/script/test/replicator_db_security.js @@ -11,14 +11,19 @@ // the License. couchTests.replicator_db_security = function(debug) { + + var reset_dbs = function(dbs) { + dbs.forEach(function(db) { + db.deleteDb(); + try { db.createDb() } catch (e) {}; + }); + }; + var dbs = ["couch_test_rep_db", "couch_test_users_db", "test_suite_db_a", "test_suite_db_b", "test_suite_db_c"] .map(function(db_name) { - var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"}); - db.deleteDb(); - db.createDb(); - return db; - }); + return new CouchDB(db_name, {"X-Couch-Full-Commit":"false"}); + }); var repDb = dbs[0]; var usersDb = dbs[1]; @@ -94,6 +99,8 @@ couchTests.replicator_db_security = function(debug) { var testFun = function() { + reset_dbs(dbs); + // _replicator db // in admin party mode, anonymous should be able to create a replication var repDoc = { @@ -372,9 +379,6 @@ couchTests.replicator_db_security = function(debug) { }); }; - usersDb.deleteDb(); - repDb.deleteDb(); - run_on_modified_server([ { section: "couch_httpd_auth", |