summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul J. Davis <paul.joseph.davis@gmail.com>2019-12-19 15:36:05 -0600
committerPaul J. Davis <paul.joseph.davis@gmail.com>2019-12-25 13:52:32 -0600
commit451e7204accbfdb918bb1b5a9ecc819272b3fa22 (patch)
treee9010a2527b2a99450d2cd426948dd86b1fb1b05
parent650ceb053af42280f8f76ce5f9bf9c266300bc94 (diff)
downloadcouchdb-451e7204accbfdb918bb1b5a9ecc819272b3fa22.tar.gz
Disable JavaScript tests ported to Elixir
-rw-r--r--test/javascript/cli_runner.js4
-rwxr-xr-xtest/javascript/run4
-rw-r--r--test/javascript/tests/all_docs.js3
-rw-r--r--test/javascript/tests/attachment_names.js1
-rw-r--r--test/javascript/tests/attachment_paths.js1
-rw-r--r--test/javascript/tests/attachment_ranges.js3
-rw-r--r--test/javascript/tests/attachment_views.js1
-rw-r--r--test/javascript/tests/attachments.js3
-rw-r--r--test/javascript/tests/attachments_multipart.js115
-rw-r--r--test/javascript/tests/basics.js1
-rw-r--r--test/javascript/tests/batch_save.js11
-rw-r--r--test/javascript/tests/bulk_docs.js1
-rw-r--r--test/javascript/tests/coffee.js1
-rw-r--r--test/javascript/tests/compact.js1
-rw-r--r--test/javascript/tests/config.js1
-rw-r--r--test/javascript/tests/conflicts.js1
-rw-r--r--test/javascript/tests/copy_doc.js1
-rw-r--r--test/javascript/tests/invalid_docids.js1
-rw-r--r--test/javascript/tests/large_docs.js1
-rw-r--r--test/javascript/tests/lots_of_docs.js1
-rw-r--r--test/javascript/tests/multiple_rows.js1
-rw-r--r--test/javascript/tests/reduce.js1
-rw-r--r--test/javascript/tests/uuids.js3
-rw-r--r--test/javascript/tests/view_collation.js5
24 files changed, 97 insertions, 69 deletions
diff --git a/test/javascript/cli_runner.js b/test/javascript/cli_runner.js
index 5d7a98021..73467626b 100644
--- a/test/javascript/cli_runner.js
+++ b/test/javascript/cli_runner.js
@@ -26,6 +26,10 @@ function runTest() {
quit(2);
}
+ if(couchTests.elixir) {
+ quit(3);
+ }
+
for(var name in couchTests) {
count++;
}
diff --git a/test/javascript/run b/test/javascript/run
index ebcdef9b8..ac49e3ace 100755
--- a/test/javascript/run
+++ b/test/javascript/run
@@ -55,6 +55,8 @@ def mkformatter(tests):
return green + "pass" + clear
elif rval == 2:
return orange + "skipped" + clear
+ elif rval == 3:
+ return green + "ported to elixir" + clear
else:
return red + "fail" + clear
@@ -166,7 +168,7 @@ def main():
fmt = mkformatter(tests)
for test in tests:
result = run_couchjs(test, fmt)
- if result == 0 or result == 2:
+ if result == 0 or result == 2 or result == 3:
passed += 1
else:
failed += 1
diff --git a/test/javascript/tests/all_docs.js b/test/javascript/tests/all_docs.js
index 64524d845..a360fb9ca 100644
--- a/test/javascript/tests/all_docs.js
+++ b/test/javascript/tests/all_docs.js
@@ -10,6 +10,7 @@
// License for the specific language governing permissions and limitations under
// the License.
+couchTests.elixir = true;
couchTests.all_docs = function(debug) {
var db_name = get_random_db_name();
var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"}, {w: 3});
@@ -79,7 +80,7 @@ couchTests.all_docs = function(debug) {
})[0];
TEquals("1", deleted_doc.id, "deletes");
- // (remember old seq)
+ // (remember old seq)
var orig_doc = changes.results.filter(function(row) {
return row.id == "3"
})[0];
diff --git a/test/javascript/tests/attachment_names.js b/test/javascript/tests/attachment_names.js
index d2083963a..4e9217c1a 100644
--- a/test/javascript/tests/attachment_names.js
+++ b/test/javascript/tests/attachment_names.js
@@ -10,6 +10,7 @@
// License for the specific language governing permissions and limitations under
// the License.
+couchTests.elixir = true;
couchTests.attachment_names = function(debug) {
var db_name = get_random_db_name();
var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"}, {w: 3});
diff --git a/test/javascript/tests/attachment_paths.js b/test/javascript/tests/attachment_paths.js
index 059977130..048640d0c 100644
--- a/test/javascript/tests/attachment_paths.js
+++ b/test/javascript/tests/attachment_paths.js
@@ -10,6 +10,7 @@
// License for the specific language governing permissions and limitations under
// the License.
+couchTests.elixir = true;
couchTests.attachment_paths = function(debug) {
if (debug) debugger;
var r_db_name = get_random_db_name()
diff --git a/test/javascript/tests/attachment_ranges.js b/test/javascript/tests/attachment_ranges.js
index e052713c2..37700ecdf 100644
--- a/test/javascript/tests/attachment_ranges.js
+++ b/test/javascript/tests/attachment_ranges.js
@@ -14,6 +14,7 @@ function cacheBust() {
return "?anti-cache=" + String(Math.round(Math.random() * 1000000));
};
+couchTests.elixir = true;
couchTests.attachment_ranges = function(debug) {
var db_name = get_random_db_name();
var db = new CouchDB(db_name, {
@@ -132,7 +133,7 @@ couchTests.attachment_ranges = function(debug) {
TEquals("ext", xhr.responseText);
TEquals("3", xhr.getResponseHeader("Content-Length"));
TEquals("bytes 26-28/29", xhr.getResponseHeader("Content-Range"));
-
+
// backward range is 416
var xhr = CouchDB.request("GET", "/" + db_name + "/bin_doc/foo.txt" + cacheBust(), {
headers: {
diff --git a/test/javascript/tests/attachment_views.js b/test/javascript/tests/attachment_views.js
index a322d7c40..7be32a9c1 100644
--- a/test/javascript/tests/attachment_views.js
+++ b/test/javascript/tests/attachment_views.js
@@ -10,6 +10,7 @@
// License for the specific language governing permissions and limitations under
// the License.
+couchTests.elixir = true;
couchTests.attachment_views= function(debug) {
var db_name = get_random_db_name()
diff --git a/test/javascript/tests/attachments.js b/test/javascript/tests/attachments.js
index 73de018f6..09c6acd8a 100644
--- a/test/javascript/tests/attachments.js
+++ b/test/javascript/tests/attachments.js
@@ -10,6 +10,7 @@
// License for the specific language governing permissions and limitations under
// the License.
+couchTests.elixir = true;
couchTests.attachments= function(debug) {
var db_name = get_random_db_name();
var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
@@ -301,7 +302,7 @@ couchTests.attachments= function(debug) {
T(db.save(bin_doc6).ok == true);
// wrong rev pos specified
-
+
// stub out the attachment with the wrong revpos
bin_doc6._attachments["foo.txt"] = { stub: true, revpos: 10};
try {
diff --git a/test/javascript/tests/attachments_multipart.js b/test/javascript/tests/attachments_multipart.js
index e15cb57c7..c36083f8a 100644
--- a/test/javascript/tests/attachments_multipart.js
+++ b/test/javascript/tests/attachments_multipart.js
@@ -10,14 +10,15 @@
// License for the specific language governing permissions and limitations under
// the License.
+couchTests.elixir = true;
couchTests.attachments_multipart= function(debug) {
var db_name = get_random_db_name()
var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
db.createDb();
if (debug) debugger;
-
+
// mime multipart
-
+
var xhr = CouchDB.request("PUT", "/" + db_name + "/multipart", {
headers: {"Content-Type": "multipart/related;boundary=\"abc123\""},
body:
@@ -55,39 +56,39 @@ couchTests.attachments_multipart= function(debug) {
"this is 19 chars lo" +
"\r\n--abc123--epilogue"
});
-
+
var result = JSON.parse(xhr.responseText);
-
+
T(result.ok);
-
-
-
+
+
+
TEquals(201, xhr.status, "should send 201 Accepted");
-
+
xhr = CouchDB.request("GET", "/" + db_name + "/multipart/foo.txt");
-
+
T(xhr.responseText == "this is 21 chars long");
-
+
xhr = CouchDB.request("GET", "/" + db_name + "/multipart/bar.txt");
-
+
T(xhr.responseText == "this is 20 chars lon");
-
+
xhr = CouchDB.request("GET", "/" + db_name + "/multipart/baz.txt");
-
+
T(xhr.responseText == "this is 19 chars lo");
-
+
// now edit an attachment
-
+
var doc = db.open("multipart", {att_encoding_info: true});
var firstrev = doc._rev;
-
+
T(doc._attachments["foo.txt"].stub == true);
T(doc._attachments["bar.txt"].stub == true);
T(doc._attachments["baz.txt"].stub == true);
TEquals("undefined", typeof doc._attachments["foo.txt"].encoding);
TEquals("undefined", typeof doc._attachments["bar.txt"].encoding);
TEquals("gzip", doc._attachments["baz.txt"].encoding);
-
+
//lets change attachment bar
delete doc._attachments["bar.txt"].stub; // remove stub member (or could set to false)
delete doc._attachments["bar.txt"].digest; // remove the digest (it's for the gzip form)
@@ -95,7 +96,7 @@ couchTests.attachments_multipart= function(debug) {
doc._attachments["bar.txt"].follows = true;
//lets delete attachment baz:
delete doc._attachments["baz.txt"];
-
+
var xhr = CouchDB.request("PUT", "/" + db_name + "/multipart", {
headers: {"Content-Type": "multipart/related;boundary=\"abc123\""},
body:
@@ -109,16 +110,16 @@ couchTests.attachments_multipart= function(debug) {
"\r\n--abc123--"
});
TEquals(201, xhr.status);
-
+
xhr = CouchDB.request("GET", "/" + db_name + "/multipart/bar.txt");
-
+
T(xhr.responseText == "this is 18 chars l");
-
+
xhr = CouchDB.request("GET", "/" + db_name + "/multipart/baz.txt");
T(xhr.status == 404);
-
+
// now test receiving multipart docs
-
+
function getBoundary(xhr) {
var ctype = CouchDB.xhrheader(xhr, "Content-Type");
var ctypeArgs = ctype.split("; ").slice(1);
@@ -127,7 +128,7 @@ couchTests.attachments_multipart= function(debug) {
if (ctypeArgs[i].indexOf("boundary=") == 0) {
boundary = ctypeArgs[i].split("=")[1];
if (boundary.charAt(0) == '"') {
- // stringified boundary, parse as json
+ // stringified boundary, parse as json
// (will maybe not if there are escape quotes)
boundary = JSON.parse(boundary);
}
@@ -135,22 +136,22 @@ couchTests.attachments_multipart= function(debug) {
}
return boundary;
}
-
+
function parseMultipart(xhr) {
var boundary = getBoundary(xhr);
var mimetext = CouchDB.xhrbody(xhr);
// strip off leading boundary
var leading = "--" + boundary + "\r\n";
var last = "\r\n--" + boundary + "--";
-
+
// strip off leading and trailing boundary
var leadingIdx = mimetext.indexOf(leading) + leading.length;
var trailingIdx = mimetext.indexOf(last);
mimetext = mimetext.slice(leadingIdx, trailingIdx);
-
+
// now split the sections
var sections = mimetext.split(new RegExp("\\r\\n--" + boundary));
-
+
// spilt out the headers for each section
for(var i=0; i < sections.length; i++) {
var section = sections[i];
@@ -160,20 +161,20 @@ couchTests.attachments_multipart= function(debug) {
var headers = {};
for(var j=0; j<headersraw.length; j++) {
var tmp = headersraw[j].split(": ");
- headers[tmp[0]] = tmp[1];
+ headers[tmp[0]] = tmp[1];
}
sections[i] = {"headers":headers, "body":body};
}
-
+
return sections;
}
-
-
+
+
xhr = CouchDB.request("GET", "/" + db_name + "/multipart?attachments=true",
{headers:{"accept": "multipart/related,*/*;"}});
-
+
T(xhr.status == 200);
-
+
// parse out the multipart
var sections = parseMultipart(xhr);
TEquals("790", xhr.getResponseHeader("Content-Length"),
@@ -199,30 +200,30 @@ couchTests.attachments_multipart= function(debug) {
"Content-Disposition should be bar.txt section[2]");
var doc = JSON.parse(sections[0].body);
-
+
T(doc._attachments['foo.txt'].follows == true);
T(doc._attachments['bar.txt'].follows == true);
-
+
T(sections[1].body == "this is 21 chars long");
TEquals("this is 18 chars l", sections[2].body, "should be 18 chars long");
-
+
// now get attachments incrementally (only the attachments changes since
// a certain rev).
-
+
xhr = CouchDB.request("GET", "/" + db_name + "/multipart?atts_since=[\"" + firstrev + "\"]",
{headers:{"accept": "multipart/related, */*"}});
-
+
T(xhr.status == 200);
var sections = parseMultipart(xhr);
-
+
T(sections.length == 2);
-
+
var doc = JSON.parse(sections[0].body);
-
+
T(doc._attachments['foo.txt'].stub == true);
T(doc._attachments['bar.txt'].follows == true);
-
+
TEquals("this is 18 chars l", sections[1].body, "should be 18 chars long 2");
// try the atts_since parameter together with the open_revs parameter
@@ -259,39 +260,39 @@ couchTests.attachments_multipart= function(debug) {
T(innerSections[2].body === "this is 18 chars l");
// try it with a rev that doesn't exist (should get all attachments)
-
+
xhr = CouchDB.request("GET", "/" + db_name + "/multipart?atts_since=[\"1-2897589\"]",
{headers:{"accept": "multipart/related,*/*;"}});
-
+
T(xhr.status == 200);
-
+
var sections = parseMultipart(xhr);
-
+
T(sections.length == 3);
-
+
var doc = JSON.parse(sections[0].body);
-
+
T(doc._attachments['foo.txt'].follows == true);
T(doc._attachments['bar.txt'].follows == true);
-
+
T(sections[1].body == "this is 21 chars long");
TEquals("this is 18 chars l", sections[2].body, "should be 18 chars long 3");
// try it with a rev that doesn't exist, and one that does
-
+
xhr = CouchDB.request("GET", "/" + db_name + "/multipart?atts_since=[\"1-2897589\",\"" + firstrev + "\"]",
{headers:{"accept": "multipart/related,*/*;"}});
-
+
T(xhr.status == 200);
-
+
var sections = parseMultipart(xhr);
-
+
T(sections.length == 2);
-
+
var doc = JSON.parse(sections[0].body);
-
+
T(doc._attachments['foo.txt'].stub == true);
T(doc._attachments['bar.txt'].follows == true);
-
+
TEquals("this is 18 chars l", sections[1].body, "should be 18 chars long 4");
// check that with the document multipart/mixed API it's possible to receive
diff --git a/test/javascript/tests/basics.js b/test/javascript/tests/basics.js
index a36b3035d..edf96927c 100644
--- a/test/javascript/tests/basics.js
+++ b/test/javascript/tests/basics.js
@@ -11,6 +11,7 @@
// the License.
// Do some basic tests.
+couchTests.elixir = true;
couchTests.basics = function(debug) {
if (debug) debugger;
diff --git a/test/javascript/tests/batch_save.js b/test/javascript/tests/batch_save.js
index b6e40ab58..1f85b1293 100644
--- a/test/javascript/tests/batch_save.js
+++ b/test/javascript/tests/batch_save.js
@@ -10,6 +10,7 @@
// License for the specific language governing permissions and limitations under
// the License.
+couchTests.elixir = true;
couchTests.batch_save = function(debug) {
var db_name = get_random_db_name()
var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
@@ -19,19 +20,19 @@ couchTests.batch_save = function(debug) {
var i
for(i=0; i < 100; i++) {
T(db.save({_id:i.toString(),a:i,b:i}, {batch : "ok"}).ok);
-
+
// test that response is 202 Accepted
T(db.last_req.status == 202);
}
-
+
for(i=0; i < 100; i++) {
// attempt to save the same document a bunch of times
T(db.save({_id:"foo",a:i,b:i}, {batch : "ok"}).ok);
-
+
// test that response is 202 Accepted
T(db.last_req.status == 202);
}
-
+
while(db.allDocs().total_rows != 101){};
// repeat the tests for POST
@@ -42,7 +43,7 @@ couchTests.batch_save = function(debug) {
});
T(JSON.parse(resp.responseText).ok);
}
-
+
while(db.allDocs().total_rows != 201){};
// cleanup
diff --git a/test/javascript/tests/bulk_docs.js b/test/javascript/tests/bulk_docs.js
index ae8a08742..7e65ae30e 100644
--- a/test/javascript/tests/bulk_docs.js
+++ b/test/javascript/tests/bulk_docs.js
@@ -10,6 +10,7 @@
// License for the specific language governing permissions and limitations under
// the License.
+couchTests.elixir = true;
couchTests.bulk_docs = function(debug) {
var db_name = get_random_db_name();
var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
diff --git a/test/javascript/tests/coffee.js b/test/javascript/tests/coffee.js
index 13f05b849..747bacf93 100644
--- a/test/javascript/tests/coffee.js
+++ b/test/javascript/tests/coffee.js
@@ -11,6 +11,7 @@
// the License.
// test basic coffeescript functionality
+couchTests.elixir = true;
couchTests.coffee = function(debug) {
var db_name = get_random_db_name();
var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
diff --git a/test/javascript/tests/compact.js b/test/javascript/tests/compact.js
index 8c8beb4b9..2b9dd21f0 100644
--- a/test/javascript/tests/compact.js
+++ b/test/javascript/tests/compact.js
@@ -10,6 +10,7 @@
// License for the specific language governing permissions and limitations under
// the License.
+couchTests.elixir = true;
couchTests.compact = function(debug) {
var db_name = get_random_db_name();
var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
diff --git a/test/javascript/tests/config.js b/test/javascript/tests/config.js
index a9dce637f..889cbd0a6 100644
--- a/test/javascript/tests/config.js
+++ b/test/javascript/tests/config.js
@@ -10,6 +10,7 @@
// License for the specific language governing permissions and limitations under
// the License.
+couchTests.elixir = true;
couchTests.config = function(debug) {
if (debug) debugger;
diff --git a/test/javascript/tests/conflicts.js b/test/javascript/tests/conflicts.js
index 81b3d8df7..7b5e02093 100644
--- a/test/javascript/tests/conflicts.js
+++ b/test/javascript/tests/conflicts.js
@@ -11,6 +11,7 @@
// the License.
// Do some edit conflict detection tests
+couchTests.elixir = true;
couchTests.conflicts = function(debug) {
var db_name = get_random_db_name();
var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
diff --git a/test/javascript/tests/copy_doc.js b/test/javascript/tests/copy_doc.js
index 9d8ed54ad..708fe5360 100644
--- a/test/javascript/tests/copy_doc.js
+++ b/test/javascript/tests/copy_doc.js
@@ -10,6 +10,7 @@
// License for the specific language governing permissions and limitations under
// the License.
+couchTests.elixir = true;
couchTests.copy_doc = function(debug) {
var db_name = get_random_db_name();
var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
diff --git a/test/javascript/tests/invalid_docids.js b/test/javascript/tests/invalid_docids.js
index 0e5c70c85..74f0e4f9c 100644
--- a/test/javascript/tests/invalid_docids.js
+++ b/test/javascript/tests/invalid_docids.js
@@ -10,6 +10,7 @@
// License for the specific language governing permissions and limitations under
// the License.
+couchTests.elixir = true;
couchTests.invalid_docids = function(debug) {
var db_name = get_random_db_name();
var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
diff --git a/test/javascript/tests/large_docs.js b/test/javascript/tests/large_docs.js
index 7528e9a87..bc9d22c84 100644
--- a/test/javascript/tests/large_docs.js
+++ b/test/javascript/tests/large_docs.js
@@ -10,6 +10,7 @@
// License for the specific language governing permissions and limitations under
// the License.
+couchTests.elixir = true;
couchTests.large_docs = function(debug) {
var db_name = get_random_db_name();
var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
diff --git a/test/javascript/tests/lots_of_docs.js b/test/javascript/tests/lots_of_docs.js
index 024284ce2..dc1486aa4 100644
--- a/test/javascript/tests/lots_of_docs.js
+++ b/test/javascript/tests/lots_of_docs.js
@@ -11,6 +11,7 @@
// the License.
// test saving a semi-large quanitity of documents and do some view queries.
+couchTests.elixir = true;
couchTests.lots_of_docs = function(debug) {
var db_name = get_random_db_name();
var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
diff --git a/test/javascript/tests/multiple_rows.js b/test/javascript/tests/multiple_rows.js
index 0056e591f..5bac8abc1 100644
--- a/test/javascript/tests/multiple_rows.js
+++ b/test/javascript/tests/multiple_rows.js
@@ -10,6 +10,7 @@
// License for the specific language governing permissions and limitations under
// the License.
+couchTests.elixir = true;
couchTests.multiple_rows = function(debug) {
var db_name = get_random_db_name();
var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
diff --git a/test/javascript/tests/reduce.js b/test/javascript/tests/reduce.js
index 9c373e4b1..6b8ea189c 100644
--- a/test/javascript/tests/reduce.js
+++ b/test/javascript/tests/reduce.js
@@ -10,6 +10,7 @@
// License for the specific language governing permissions and limitations under
// the License.
+couchTests.elixir = true;
couchTests.reduce = function(debug) {
var db_name = get_random_db_name();
var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
diff --git a/test/javascript/tests/uuids.js b/test/javascript/tests/uuids.js
index d53a80ce6..cbf5e8e2a 100644
--- a/test/javascript/tests/uuids.js
+++ b/test/javascript/tests/uuids.js
@@ -10,6 +10,7 @@
// License for the specific language governing permissions and limitations under
// the License.
+couchTests.elixir = true;
couchTests.uuids = function(debug) {
var etags = [];
var testHashBustingHeaders = function(xhr) {
@@ -19,7 +20,7 @@ couchTests.uuids = function(debug) {
var newetag = xhr.getResponseHeader("ETag");
T(etags.indexOf(newetag) < 0);
etags[etags.length] = newetag;
-
+
// Removing the time based tests as they break easily when
// running CouchDB on a remote server in regards to the browser
// running the Futon test suite.
diff --git a/test/javascript/tests/view_collation.js b/test/javascript/tests/view_collation.js
index 51e74ff9e..7391fc85a 100644
--- a/test/javascript/tests/view_collation.js
+++ b/test/javascript/tests/view_collation.js
@@ -10,6 +10,7 @@
// License for the specific language governing permissions and limitations under
// the License.
+couchTests.elixir = true;
couchTests.view_collation = function(debug) {
var db_name = get_random_db_name();
var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
@@ -103,12 +104,12 @@ couchTests.view_collation = function(debug) {
var rows = db.query(queryFun, null, {endkey : "b",
descending:true, inclusive_end:false}).rows;
T(rows[rows.length-1].key == "B");
-
+
var rows = db.query(queryFun, null, {
endkey : "b", endkey_docid: "10",
inclusive_end:false}).rows;
T(rows[rows.length-1].key == "aa");
-
+
var rows = db.query(queryFun, null, {
endkey : "b", endkey_docid: "11",
inclusive_end:false}).rows;