From 9c4b49ec957b04b96641359a8ec0c428b4cf47de Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Tue, 31 Oct 2017 21:01:15 +0100 Subject: [PATCH] disable js tests that need the native query server --- share/www/script/test/changes.js | 199 +++++++++++++------------- share/www/script/test/erlang_views.js | 13 +- share/www/script/test/list_views.js | 17 +-- 3 files changed, 116 insertions(+), 113 deletions(-) diff --git a/share/www/script/test/changes.js b/share/www/script/test/changes.js index 0fba9f9fae0..55602d548ea 100644 --- a/share/www/script/test/changes.js +++ b/share/www/script/test/changes.js @@ -447,106 +447,107 @@ couchTests.changes = function(debug) { resp = JSON.parse(req.responseText); T(resp.results.length == 1, "filter=changes_filter/conflicted"); + // diabled because of https://github.com/apache/couchdb/pull/939 // test with erlang filter function - run_on_modified_server([{ - section: "native_query_servers", - key: "erlang", - value: "{couch_native_process, start_link, []}" - }], function() { - var erl_ddoc = { - _id: "_design/erlang", - language: "erlang", - filters: { - foo: - 'fun({Doc}, Req) -> ' + - ' case couch_util:get_value(<<"value">>, Doc) of' + - ' undefined -> false;' + - ' Value -> (Value rem 2) =:= 0;' + - ' _ -> false' + - ' end ' + - 'end.' - } - }; - - db.deleteDb(); - db.createDb(); - T(db.save(erl_ddoc).ok); - - var req = CouchDB.request("GET", "/test_suite_db/_changes?filter=erlang/foo"); - var resp = JSON.parse(req.responseText); - T(resp.results.length === 0); - - T(db.save({_id: "doc1", value : 1}).ok); - T(db.save({_id: "doc2", value : 2}).ok); - T(db.save({_id: "doc3", value : 3}).ok); - T(db.save({_id: "doc4", value : 4}).ok); - - var req = CouchDB.request("GET", "/test_suite_db/_changes?filter=erlang/foo"); - var resp = JSON.parse(req.responseText); - T(resp.results.length === 2); - T(resp.results[0].id === "doc2"); - T(resp.results[1].id === "doc4"); - - // test filtering on docids - // - - var options = { - headers: {"Content-Type": "application/json"}, - body: JSON.stringify({"doc_ids": ["something", "anotherthing", "andmore"]}) - }; - - var req = CouchDB.request("POST", "/test_suite_db/_changes?filter=_doc_ids", options); - var resp = JSON.parse(req.responseText); - T(resp.results.length === 0); - - T(db.save({"_id":"something", "bop" : "plankton"}).ok); - var req = CouchDB.request("POST", "/test_suite_db/_changes?filter=_doc_ids", options); - var resp = JSON.parse(req.responseText); - T(resp.results.length === 1); - T(resp.results[0].id === "something"); - - T(db.save({"_id":"anotherthing", "bop" : "plankton"}).ok); - var req = CouchDB.request("POST", "/test_suite_db/_changes?filter=_doc_ids", options); - var resp = JSON.parse(req.responseText); - T(resp.results.length === 2); - T(resp.results[0].id === "something"); - T(resp.results[1].id === "anotherthing"); - - var docids = JSON.stringify(["something", "anotherthing", "andmore"]), - req = CouchDB.request("GET", "/test_suite_db/_changes?filter=_doc_ids&doc_ids="+docids, options); - var resp = JSON.parse(req.responseText); - T(resp.results.length === 2); - T(resp.results[0].id === "something"); - T(resp.results[1].id === "anotherthing"); - - var req = CouchDB.request("GET", "/test_suite_db/_changes?filter=_design"); - var resp = JSON.parse(req.responseText); - T(resp.results.length === 1); - T(resp.results[0].id === "_design/erlang"); - - - if (!is_safari && xhr) { - // filter docids with continuous - xhr = CouchDB.newXhr(); - xhr.open("POST", CouchDB.proxyUrl("/test_suite_db/_changes?feed=continuous&timeout=500&since=7&filter=_doc_ids"), true); - xhr.setRequestHeader("Content-Type", "application/json"); - - xhr.send(options.body); - - T(db.save({"_id":"andmore", "bop" : "plankton"}).ok); - - waitForSuccess(function() { - if (xhr.readyState != 4) { - throw("still waiting"); - } - return true; - }, "andmore-only"); - - var line = JSON.parse(xhr.responseText.split("\n")[0]); - T(line.seq == 8); - T(line.id == "andmore"); - } - }); + // run_on_modified_server([{ + // section: "native_query_servers", + // key: "erlang", + // value: "{couch_native_process, start_link, []}" + // }], function() { + // var erl_ddoc = { + // _id: "_design/erlang", + // language: "erlang", + // filters: { + // foo: + // 'fun({Doc}, Req) -> ' + + // ' case couch_util:get_value(<<"value">>, Doc) of' + + // ' undefined -> false;' + + // ' Value -> (Value rem 2) =:= 0;' + + // ' _ -> false' + + // ' end ' + + // 'end.' + // } + // }; + // + // db.deleteDb(); + // db.createDb(); + // T(db.save(erl_ddoc).ok); + // + // var req = CouchDB.request("GET", "/test_suite_db/_changes?filter=erlang/foo"); + // var resp = JSON.parse(req.responseText); + // T(resp.results.length === 0); + // + // T(db.save({_id: "doc1", value : 1}).ok); + // T(db.save({_id: "doc2", value : 2}).ok); + // T(db.save({_id: "doc3", value : 3}).ok); + // T(db.save({_id: "doc4", value : 4}).ok); + // + // var req = CouchDB.request("GET", "/test_suite_db/_changes?filter=erlang/foo"); + // var resp = JSON.parse(req.responseText); + // T(resp.results.length === 2); + // T(resp.results[0].id === "doc2"); + // T(resp.results[1].id === "doc4"); + // + // // test filtering on docids + // // + // + // var options = { + // headers: {"Content-Type": "application/json"}, + // body: JSON.stringify({"doc_ids": ["something", "anotherthing", "andmore"]}) + // }; + // + // var req = CouchDB.request("POST", "/test_suite_db/_changes?filter=_doc_ids", options); + // var resp = JSON.parse(req.responseText); + // T(resp.results.length === 0); + // + // T(db.save({"_id":"something", "bop" : "plankton"}).ok); + // var req = CouchDB.request("POST", "/test_suite_db/_changes?filter=_doc_ids", options); + // var resp = JSON.parse(req.responseText); + // T(resp.results.length === 1); + // T(resp.results[0].id === "something"); + // + // T(db.save({"_id":"anotherthing", "bop" : "plankton"}).ok); + // var req = CouchDB.request("POST", "/test_suite_db/_changes?filter=_doc_ids", options); + // var resp = JSON.parse(req.responseText); + // T(resp.results.length === 2); + // T(resp.results[0].id === "something"); + // T(resp.results[1].id === "anotherthing"); + // + // var docids = JSON.stringify(["something", "anotherthing", "andmore"]), + // req = CouchDB.request("GET", "/test_suite_db/_changes?filter=_doc_ids&doc_ids="+docids, options); + // var resp = JSON.parse(req.responseText); + // T(resp.results.length === 2); + // T(resp.results[0].id === "something"); + // T(resp.results[1].id === "anotherthing"); + // + // var req = CouchDB.request("GET", "/test_suite_db/_changes?filter=_design"); + // var resp = JSON.parse(req.responseText); + // T(resp.results.length === 1); + // T(resp.results[0].id === "_design/erlang"); + // + // + // if (!is_safari && xhr) { + // // filter docids with continuous + // xhr = CouchDB.newXhr(); + // xhr.open("POST", CouchDB.proxyUrl("/test_suite_db/_changes?feed=continuous&timeout=500&since=7&filter=_doc_ids"), true); + // xhr.setRequestHeader("Content-Type", "application/json"); + // + // xhr.send(options.body); + // + // T(db.save({"_id":"andmore", "bop" : "plankton"}).ok); + // + // waitForSuccess(function() { + // if (xhr.readyState != 4) { + // throw("still waiting"); + // } + // return true; + // }, "andmore-only"); + // + // var line = JSON.parse(xhr.responseText.split("\n")[0]); + // T(line.seq == 8); + // T(line.id == "andmore"); + // } + // }); // COUCHDB-1037 - empty result for ?limit=1&filter=foo/bar in some cases T(db.deleteDb()); diff --git a/share/www/script/test/erlang_views.js b/share/www/script/test/erlang_views.js index 7eddab40258..3a27ae36958 100644 --- a/share/www/script/test/erlang_views.js +++ b/share/www/script/test/erlang_views.js @@ -11,6 +11,7 @@ // the License. couchTests.erlang_views = function(debug) { + return; // diabled because of https://github.com/apache/couchdb/pull/939 var db = new CouchDB("test_suite_db", {"X-Couch-Full-Commit":"false"}); db.deleteDb(); db.createDb(); @@ -40,7 +41,7 @@ couchTests.erlang_views = function(debug) { T(results.total_rows == 1); T(results.rows[0].key == 1); T(results.rows[0].value == "str1"); - + // check simple reduction - another doc with same key. var doc = {_id: "2", integer: 1, string: "str2"}; T(db.save(doc).ok); @@ -99,7 +100,7 @@ couchTests.erlang_views = function(debug) { db.deleteDb(); db.createDb(); var words = "foo bar abc def baz xxyz".split(/\s+/); - + var docs = []; for(var i = 0; i < 250; i++) { var body = []; @@ -115,16 +116,16 @@ couchTests.erlang_views = function(debug) { }); } T(db.bulkSave(docs).length, 250, "Saved big doc set."); - + var mfun = 'fun({Doc}) -> ' + 'Words = couch_util:get_value(<<"words">>, Doc), ' + 'lists:foreach(fun({Word}) -> ' + - 'WordString = couch_util:get_value(<<"word">>, Word), ' + - 'Count = couch_util:get_value(<<"count">>, Word), ' + + 'WordString = couch_util:get_value(<<"word">>, Word), ' + + 'Count = couch_util:get_value(<<"count">>, Word), ' + 'Emit(WordString , Count) ' + 'end, Words) ' + 'end.'; - + var rfun = 'fun(Keys, Values, RR) -> length(Values) end.'; var results = db.query(mfun, rfun, null, null, "erlang"); T(results.rows[0].key === null, "Returned a reduced value."); diff --git a/share/www/script/test/list_views.js b/share/www/script/test/list_views.js index ece81ea00c6..66f20bc22c1 100644 --- a/share/www/script/test/list_views.js +++ b/share/www/script/test/list_views.js @@ -221,7 +221,7 @@ couchTests.list_views = function(debug) { headers: {"if-none-match": etag} }); T(xhr.status == 304); - + // confirm ETag changes with different POST bodies xhr = CouchDB.request("POST", "/test_suite_db/_design/lists/_list/basicBasic/basicView", {body: JSON.stringify({keys:[1]})} @@ -240,7 +240,7 @@ couchTests.list_views = function(debug) { TEquals(10, resp.head.total_rows); TEquals(0, resp.head.offset); TEquals(11, resp.head.update_seq); - + T(resp.rows.length == 10); TEquals(resp.rows[0], {"id": "0","key": 0,"value": "0"}); @@ -414,7 +414,7 @@ couchTests.list_views = function(debug) { xhr = CouchDB.request("POST", url, { body: '{"keys":[-2,-4,-5,-7]}' }); - + T(xhr.status == 200, "multi key separate docs"); T(!(/Key: -3/.test(xhr.responseText))); T(/Key: -7/.test(xhr.responseText)); @@ -441,11 +441,12 @@ couchTests.list_views = function(debug) { } }; - run_on_modified_server([{ - section: "native_query_servers", - key: "erlang", - value: "{couch_native_process, start_link, []}" - }], erlViewTest); + // diabled because of https://github.com/apache/couchdb/pull/939 + // run_on_modified_server([{ + // section: "native_query_servers", + // key: "erlang", + // value: "{couch_native_process, start_link, []}" + // }], erlViewTest); // COUCHDB-1113 var ddoc = {