summaryrefslogtreecommitdiff
path: root/share/www/script/test/view_errors.js
diff options
context:
space:
mode:
authorJohn Christopher Anderson <jchris@apache.org>2009-05-04 22:06:12 +0000
committerJohn Christopher Anderson <jchris@apache.org>2009-05-04 22:06:12 +0000
commit2d0503e3bb0c50c99670c01272ee8c1fe7710f8d (patch)
treeabde95fef91189736e89c4ea5c3ae277e6ff46e7 /share/www/script/test/view_errors.js
parent7c05a60479bacc7acbf6f704285a4ab2981ba02b (diff)
reduce_limit error is thrown when the reduce function output is not small enough compared to the input. Errors can be switched off using the config API.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@771466 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script/test/view_errors.js')
-rw-r--r--share/www/script/test/view_errors.js26
1 files changed, 23 insertions, 3 deletions
diff --git a/share/www/script/test/view_errors.js b/share/www/script/test/view_errors.js
index 12225e67..1a613c04 100644
--- a/share/www/script/test/view_errors.js
+++ b/share/www/script/test/view_errors.js
@@ -75,13 +75,26 @@ couchTests.view_errors = function(debug) {
_id:"_design/test",
language: "javascript",
views: {
- no_reduce: {map:"function(doc) {emit(doc._id, null);}"},
- with_reduce: {map:"function (doc) {emit(doc.integer, doc.integer)};",
- reduce:"function (keys, values) { return sum(values); };"},
+ "no_reduce": {map:"function(doc) {emit(doc._id, null);}"},
+ "with_reduce": {
+ map:"function (doc) {emit(doc.integer, doc.integer)};",
+ reduce:"function (keys, values) { return sum(values); };"}
}
};
T(db.save(designDoc).ok);
+ var designDoc2 = {
+ _id:"_design/testbig",
+ language: "javascript",
+ views: {
+ "reduce_too_big" : {
+ map:"function (doc) {emit(doc.integer, doc.integer)};",
+ reduce:"function (keys, values) { var chars = []; for (var i=0; i < 1000; i++) {chars.push('wazzap');};return chars; };"}
+ }
+ };
+ T(db.save(designDoc2).ok);
+
+
try {
db.view("test/no_reduce", {group: true});
T(0 == 1);
@@ -117,4 +130,11 @@ couchTests.view_errors = function(debug) {
result = JSON.parse(xhr.responseText);
T(result.error == "bad_request");
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";
+ xhr = CouchDB.request("GET", path);
+ T(xhr.status == 500);
+ result = JSON.parse(xhr.responseText);
+ T(result.error == "reduce_overflow_error");
};