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/16 22:15:42 UTC

[41/50] couchdb commit: updated refs/heads/master to e8e03b6

JS test: update view_errors.js for 2.0


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/45588920
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/45588920
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/45588920

Branch: refs/heads/master
Commit: 45588920afd4b143e9122ec428d5f896fb81ecf2
Parents: bb5d625
Author: Jan Lehnardt <ja...@apache.org>
Authored: Wed Dec 16 20:49:34 2015 +0100
Committer: Jan Lehnardt <ja...@apache.org>
Committed: Wed Dec 16 20:49:34 2015 +0100

----------------------------------------------------------------------
 test/javascript/tests/view_errors.js | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/45588920/test/javascript/tests/view_errors.js
----------------------------------------------------------------------
diff --git a/test/javascript/tests/view_errors.js b/test/javascript/tests/view_errors.js
index e8bd08e..b53a3c7 100644
--- a/test/javascript/tests/view_errors.js
+++ b/test/javascript/tests/view_errors.js
@@ -11,16 +11,16 @@
 // the License.
 
 couchTests.view_errors = function(debug) {
-  var db = new CouchDB("test_suite_db", {"X-Couch-Full-Commit":"true"});
-  db.deleteDb();
+  var db_name = get_random_db_name();
+  var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
   db.createDb();
   if (debug) debugger;
 
-  run_on_modified_server(
-    [{section: "couchdb",
-      key: "os_process_timeout",
-      value: "500"}],
-    function() {
+  // run_on_modified_server(
+  //   [{section: "couchdb",
+  //     key: "os_process_timeout",
+  //     value: "500"}],
+  //   function() {
       var doc = {integer: 1, string: "1", array: [1, 2, 3]};
       T(db.save(doc).ok);
 
@@ -48,7 +48,7 @@ couchTests.view_errors = function(debug) {
       T(results.rows[0].key[1] == null);
       
       // querying a view with invalid params should give a resonable error message
-      var xhr = CouchDB.request("POST", "/test_suite_db/_temp_view?startkey=foo", {
+      var xhr = CouchDB.request("POST", "/" + db_name + "/_all_docs?startkey=foo", {
         headers: {"Content-Type": "application/json"},
         body: JSON.stringify({language: "javascript",
           map : "function(doc){emit(doc.integer)}"
@@ -57,7 +57,7 @@ couchTests.view_errors = function(debug) {
       T(JSON.parse(xhr.responseText).error == "bad_request");
 
       // content type must be json
-      var xhr = CouchDB.request("POST", "/test_suite_db/_temp_view", {
+      var xhr = CouchDB.request("POST", "/" + db_name + "/_all_docs", {
         headers: {"Content-Type": "application/x-www-form-urlencoded"},
         body: JSON.stringify({language: "javascript",
           map : "function(doc){}"
@@ -158,7 +158,7 @@ couchTests.view_errors = function(debug) {
       }
 
       // Check error responses for invalid multi-get bodies.
-      var path = "/test_suite_db/_design/test/_view/no_reduce";
+      var path = "/" + db_name + "/_design/test/_view/no_reduce";
       var xhr = CouchDB.request("POST", path, {body: "[]"});
       T(xhr.status == 400);
       result = JSON.parse(xhr.responseText);
@@ -172,7 +172,7 @@ couchTests.view_errors = function(debug) {
       T(result.reason == "`keys` member must be a array.");
 
       // if the reduce grows to fast, throw an overflow error
-      var path = "/test_suite_db/_design/testbig/_view/reduce_too_big";
+      var path = "/" + db_name + "/_design/testbig/_view/reduce_too_big";
       xhr = CouchDB.request("GET", path);
       T(xhr.status == 500);
       result = JSON.parse(xhr.responseText);
@@ -185,5 +185,8 @@ couchTests.view_errors = function(debug) {
           T(e.error == "query_parse_error");
           T(e.reason.match(/no rows can match/i));
       }
-    });
+    // });
+
+  // cleanup
+  db.deleteDb();
 };