summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorPaul Joseph Davis <davisp@apache.org>2011-01-20 00:51:26 +0000
committerPaul Joseph Davis <davisp@apache.org>2011-01-20 00:51:26 +0000
commit7ab438e99d43acc8898471c13c512124cccca56f (patch)
tree8fc4d2c5570792b48f0169f1dc2da948d8e2a51c /share
parent3798ac83517494e2f3435f9093613d0e94bbec43 (diff)
parentc9c334db9fe384265df316459555fe2411fd8231 (diff)
Tagging the 1.0.2 release. Again.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/tags/1.0.2@1061084 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share')
-rw-r--r--share/Makefile.am1
-rw-r--r--share/www/script/couch_tests.js1
-rw-r--r--share/www/script/test/attachment_conflicts.js56
-rw-r--r--share/www/script/test/attachments_multipart.js6
-rw-r--r--share/www/script/test/purge.js8
5 files changed, 69 insertions, 3 deletions
diff --git a/share/Makefile.am b/share/Makefile.am
index 752fa9f9..f72db769 100644
--- a/share/Makefile.am
+++ b/share/Makefile.am
@@ -114,6 +114,7 @@ nobase_dist_localdata_DATA = \
www/script/test/all_docs.js \
www/script/test/attachments.js \
www/script/test/attachments_multipart.js \
+ www/script/test/attachment_conflicts.js \
www/script/test/attachment_names.js \
www/script/test/attachment_paths.js \
www/script/test/attachment_views.js \
diff --git a/share/www/script/couch_tests.js b/share/www/script/couch_tests.js
index c5257ea6..896b3538 100644
--- a/share/www/script/couch_tests.js
+++ b/share/www/script/couch_tests.js
@@ -32,6 +32,7 @@ loadTest("basics.js");
loadTest("all_docs.js");
loadTest("attachments.js");
loadTest("attachments_multipart.js");
+loadTest("attachment_conflicts.js");
loadTest("attachment_names.js");
loadTest("attachment_paths.js");
loadTest("attachment_views.js");
diff --git a/share/www/script/test/attachment_conflicts.js b/share/www/script/test/attachment_conflicts.js
new file mode 100644
index 00000000..c400277e
--- /dev/null
+++ b/share/www/script/test/attachment_conflicts.js
@@ -0,0 +1,56 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+// Do some edit conflict detection tests for attachments.
+couchTests.attachment_conflicts = function(debug) {
+
+ var dbA = new CouchDB("test_suite_db_a", {"X-Couch-Full-Commit":"false"});
+ var dbB = new CouchDB("test_suite_db_b", {"X-Couch-Full-Commit":"false"});
+ dbA.deleteDb();
+ dbA.createDb();
+ dbB.deleteDb();
+ dbB.createDb();
+
+ if (debug) debugger;
+
+ T(dbA.save({"_id":"doc", "foo":"bar"}).ok);
+
+ // create conflict
+ T(CouchDB.replicate("test_suite_db_a", "test_suite_db_b").ok);
+
+ var doc = dbA.open("doc");
+ var rev11 = doc._rev;
+ T(dbA.save({"_id":"doc", "foo":"bar2","_rev":rev11}).ok);
+
+ doc = dbB.open("doc");
+ var rev12 = doc._rev;
+ T(dbB.save({"_id":"doc", "foo":"bar3","_rev":rev12}).ok);
+
+ T(CouchDB.replicate("test_suite_db_a", "test_suite_db_b").ok);
+
+ // the attachment
+ var bin_data = "JHAPDO*AU£PN ){(3u[d 93DQ9¡€])} ææøo'∂ƒæ≤çæππ•¥∫¶®#†π¶®¥π€ª®˙π8np";
+
+ doc = dbB.open("doc");
+ var rev13 = doc._rev;
+
+ // test that we can can attach to conflicting documents
+ var xhr = CouchDB.request("PUT", "/test_suite_db_b/doc/attachment.txt", {
+ headers: {
+ "Content-Type": "text/plain;charset=utf-8",
+ "If-Match": rev13
+ },
+ body: bin_data
+ });
+ T(xhr.status == 201);
+
+};
diff --git a/share/www/script/test/attachments_multipart.js b/share/www/script/test/attachments_multipart.js
index fecf9d01..f173d2bb 100644
--- a/share/www/script/test/attachments_multipart.js
+++ b/share/www/script/test/attachments_multipart.js
@@ -29,17 +29,17 @@ couchTests.attachments_multipart= function(debug) {
"_attachments":{
"foo.txt": {
"follows":true,
- "content_type":"text/plain",
+ "content_type":"application/test",
"length":21
},
"bar.txt": {
"follows":true,
- "content_type":"text/plain",
+ "content_type":"application/test",
"length":20
},
"baz.txt": {
"follows":true,
- "content_type":"text/plain",
+ "content_type":"application/test",
"length":19
}
}
diff --git a/share/www/script/test/purge.js b/share/www/script/test/purge.js
index af72ea4f..f8f45138 100644
--- a/share/www/script/test/purge.js
+++ b/share/www/script/test/purge.js
@@ -76,6 +76,14 @@ couchTests.purge = function(debug) {
}
T(db.view("test/single_doc").total_rows == 0);
+ // purge sequences are preserved after compaction (COUCHDB-1021)
+ T(db.compact().ok);
+ T(db.last_req.status == 202);
+ // compaction isn't instantaneous, loop until done
+ while (db.info().compact_running) {};
+ var compactInfo = db.info();
+ T(compactInfo.purge_seq == newInfo.purge_seq);
+
// purge documents twice in a row without loading views
// (causes full view rebuilds)