You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2015/12/12 17:01:45 UTC
[24/35] couchdb commit: updated refs/heads/2876-js-tests-merged to
6d9b2eb
draft compression config
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/3346282f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/3346282f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/3346282f
Branch: refs/heads/2876-js-tests-merged
Commit: 3346282fa1273ad29de286b757106ad30c76180c
Parents: 29cb25f
Author: sebastianro <se...@apache.org>
Authored: Wed Nov 11 22:36:23 2015 +0100
Committer: Jan Lehnardt <ja...@apache.org>
Committed: Sat Dec 12 15:25:10 2015 +0100
----------------------------------------------------------------------
test/javascript/tests/replication.js | 84 +++++++++++++++++++++----------
1 file changed, 57 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/3346282f/test/javascript/tests/replication.js
----------------------------------------------------------------------
diff --git a/test/javascript/tests/replication.js b/test/javascript/tests/replication.js
index 5b65e38..b2eafeb 100644
--- a/test/javascript/tests/replication.js
+++ b/test/javascript/tests/replication.js
@@ -58,39 +58,69 @@ couchTests.replication = function(debug) {
return data;
}
-
- function enableAttCompression(level, types) {
- var xhr = CouchDB.request(
- "PUT",
- "/_config/attachments/compression_level",
- {
- body: JSON.stringify(level),
- headers: {"X-Couch-Persist": "false"}
- }
- );
+
+ function runAllNodes(callback) {
+ // new and fancy: clustered version: pull cluster_members and walk over all of them
+ var xhr = CouchDB.request("GET", "/_membership");
T(xhr.status === 200);
- xhr = CouchDB.request(
- "PUT",
- "/_config/attachments/compressible_types",
- {
- body: JSON.stringify(types),
- headers: {"X-Couch-Persist": "false"}
- }
- );
+ JSON.parse(xhr.responseText).cluster_nodes.forEach(callback);
+ }
+
+ function runFirstNode(callback) {
+ // new and fancy: clustered version: pull cluster_members and walk over all of them
+ var xhr = CouchDB.request("GET", "/_membership");
T(xhr.status === 200);
+ var node = JSON.parse(xhr.responseText).cluster_nodes[0];
+ return callback(node);
}
+ function getCompressionInfo() {
+ return runFirstNode(function(node) {
+ var xhr = CouchDB.request(
+ "GET",
+ "_node/" + node + "/_config/attachments"
+ );
+ T(xhr.status === 200);
+ var res = JSON.parse(xhr.responseText);
+ return {"level": res.compression_level, "types": res.compressible_types};
+ });
+ }
+
+ function enableAttCompression(level, types) {
+ runAllNodes(function(node) {
+ var xhr = CouchDB.request(
+ "PUT",
+ "_node/" + node + "/_config/attachments/compression_level",
+ {
+ body: JSON.stringify(level),
+ headers: {"X-Couch-Persist": "false"}
+ }
+ );
+ T(xhr.status === 200);
+ xhr = CouchDB.request(
+ "PUT",
+ "_node/" + node + "/_config/attachments/compressible_types",
+ {
+ body: JSON.stringify(types),
+ headers: {"X-Couch-Persist": "false"}
+ }
+ );
+ T(xhr.status === 200);
+ });
+ }
function disableAttCompression() {
- var xhr = CouchDB.request(
- "PUT",
- "/_config/attachments/compression_level",
- {
- body: JSON.stringify("0"),
- headers: {"X-Couch-Persist": "false"}
- }
- );
- T(xhr.status === 200);
+ runAllNodes(function(node) {
+ var xhr = CouchDB.request(
+ "PUT",
+ "_node/" + node + "/_config/attachments/compression_level",
+ {
+ body: JSON.stringify("0"),
+ headers: {"X-Couch-Persist": "false"}
+ }
+ );
+ T(xhr.status === 200);
+ });
}