summaryrefslogtreecommitdiff
path: root/share/www/script/test
diff options
context:
space:
mode:
authorFilipe David Borba Manana <fdmanana@apache.org>2011-03-03 09:47:29 +0000
committerFilipe David Borba Manana <fdmanana@apache.org>2011-03-03 09:47:29 +0000
commit834c5c9c6f98db08a80b7ca1bac9d133e718793e (patch)
tree7222caa0fe7b8eab819dc34c6cf0025f64f172f2 /share/www/script/test
parent99c0ab928a9247f7a61d1ee3912895978e106b37 (diff)
Merged revision 1076569 from trunk
Added replicator database compaction test A test to confirm that ongoing replications are not stopped when/after the replicator database is compacted. git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1076570 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script/test')
-rw-r--r--share/www/script/test/replicator_db.js67
1 files changed, 67 insertions, 0 deletions
diff --git a/share/www/script/test/replicator_db.js b/share/www/script/test/replicator_db.js
index b5406691..95a196d7 100644
--- a/share/www/script/test/replicator_db.js
+++ b/share/www/script/test/replicator_db.js
@@ -834,6 +834,69 @@ couchTests.replicator_db = function(debug) {
}
+ function compact_rep_db() {
+ var dbA_copy = new CouchDB("test_suite_rep_db_a_copy");
+ var dbB_copy = new CouchDB("test_suite_rep_db_b_copy");
+ var repDoc1, repDoc2;
+ var xhr, i, doc, copy, new_doc;
+ var docs = makeDocs(1, 50);
+
+ populate_db(dbA, docs);
+ populate_db(dbB, docs);
+ populate_db(dbA_copy, []);
+ populate_db(dbB_copy, []);
+
+ repDoc1 = {
+ _id: "rep1",
+ source: CouchDB.protocol + host + "/" + dbA.name,
+ target: dbA_copy.name,
+ continuous: true
+ };
+ repDoc2 = {
+ _id: "rep2",
+ source: CouchDB.protocol + host + "/" + dbB.name,
+ target: dbB_copy.name,
+ continuous: true
+ };
+
+ TEquals(true, repDb.save(repDoc1).ok);
+ TEquals(true, repDb.save(repDoc2).ok);
+
+ TEquals(true, repDb.compact().ok);
+ TEquals(202, repDb.last_req.status);
+
+ waitForSeq(dbA, dbA_copy);
+ waitForSeq(dbB, dbB_copy);
+
+ while (repDb.info().compact_running) {};
+
+ for (i = 0; i < docs.length; i++) {
+ copy = dbA_copy.open(docs[i]._id);
+ T(copy !== null);
+ copy = dbB_copy.open(docs[i]._id);
+ T(copy !== null);
+ }
+
+ new_doc = {
+ _id: "foo666",
+ value: 666
+ };
+
+ TEquals(true, dbA.save(new_doc).ok);
+ TEquals(true, dbB.save(new_doc).ok);
+
+ waitForSeq(dbA, dbA_copy);
+ waitForSeq(dbB, dbB_copy);
+
+ copy = dbA.open(new_doc._id);
+ T(copy !== null);
+ TEquals(666, copy.value);
+ copy = dbB.open(new_doc._id);
+ T(copy !== null);
+ TEquals(666, copy.value);
+ }
+
+
function error_state_replication() {
populate_db(dbA, docs1);
@@ -916,6 +979,10 @@ couchTests.replicator_db = function(debug) {
restartServer();
run_on_modified_server(server_config, swap_rep_db);
+ repDb.deleteDb();
+ restartServer();
+ run_on_modified_server(server_config, compact_rep_db);
+
/*
* Disabled, since error state would be set on the document only after
* the exponential backoff retry done by the replicator database listener