From e058233672db611c9046f1af69952d093db09606 Mon Sep 17 00:00:00 2001 From: Filipe David Borba Manana Date: Wed, 17 Nov 2010 11:41:44 +0000 Subject: Replicator DB: removed some restrictions from the default document update validation function and added some logging. 1) Now it's easier to replicate to the replicator DB and by default it's writable by any user (just like any user can POST to /_replicate/); 2) The logging in the document validation function allows us to see in the log, after a replication, why a document was not written to the target replicator DB. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1035986 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/test/replicator_db.js | 62 ---------------------------------- 1 file changed, 62 deletions(-) (limited to 'share/www/script/test/replicator_db.js') diff --git a/share/www/script/test/replicator_db.js b/share/www/script/test/replicator_db.js index 30468006..2e558f3e 100644 --- a/share/www/script/test/replicator_db.js +++ b/share/www/script/test/replicator_db.js @@ -470,64 +470,6 @@ couchTests.replicator_db = function(debug) { } - function rep_db_write_authorization() { - populate_db(dbA, docs1); - populate_db(dbB, []); - - var server_admins_config = [ - { - section: "admins", - key: "fdmanana", - value: "qwerty" - } - ]; - - run_on_modified_server(server_admins_config, function() { - var repDoc = { - _id: "foo_rep_doc", - source: dbA.name, - target: dbB.name - }; - - try { - repDb.save(repDoc); - T(false && "Should have thrown an exception"); - } catch (x) { - T(x["error"] === "forbidden"); - } - - T(CouchDB.login("fdmanana", "qwerty").ok); - T(CouchDB.session().userCtx.name === "fdmanana"); - T(CouchDB.session().userCtx.roles.indexOf("_admin") !== -1); - - T(repDb.save(repDoc).ok); - - waitForRep(repDb, repDoc, "completed"); - for (var i = 0; i < docs1.length; i++) { - var doc = docs1[i]; - var copy = dbB.open(doc._id); - T(copy !== null); - T(copy.value === doc.value); - } - - repDoc = repDb.open("foo_rep_doc"); - T(repDoc !== null); - - repDoc.target = "test_suite_foo_db"; - repDoc.create_target = true; - - // Only the replicator can update replication documents. - // Admins can only add and delete replication documents. - try { - repDb.save(repDoc); - T(false && "Should have thrown an exception"); - } catch (x) { - T(x["error"] === "forbidden"); - } - }); - } - - function test_replication_credentials_delegation() { populate_db(usersDb, []); @@ -745,10 +687,6 @@ couchTests.replicator_db = function(debug) { restartServer(); run_on_modified_server(server_config, identical_continuous_rep_docs); - repDb.deleteDb(); - restartServer(); - run_on_modified_server(server_config, rep_db_write_authorization); - var server_config_2 = server_config.concat([ { section: "couch_httpd_auth", -- cgit v1.2.3