You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2019/09/16 17:48:58 UTC
[couchdb] 01/01: Implement setting and getting _revs_limit
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch prototype/fdb-layer-revs_limit
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit ebf809de449d19697de07b01ce354d18261d83ce
Author: Nick Vatamaniuc <va...@apache.org>
AuthorDate: Mon Sep 16 13:48:31 2019 -0400
Implement setting and getting _revs_limit
---
src/chttpd/src/chttpd_db.erl | 4 ++--
test/elixir/test/basics_test.exs | 17 +++++++++++++++++
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/src/chttpd/src/chttpd_db.erl b/src/chttpd/src/chttpd_db.erl
index a1f1212..5a7f060 100644
--- a/src/chttpd/src/chttpd_db.erl
+++ b/src/chttpd/src/chttpd_db.erl
@@ -744,11 +744,11 @@ db_req(#httpd{path_parts=[_,<<"_security">>]}=Req, _Db) ->
db_req(#httpd{method='PUT',path_parts=[_,<<"_revs_limit">>],user_ctx=Ctx}=Req,
Db) ->
Limit = chttpd:json_body(Req),
- ok = fabric:set_revs_limit(Db, Limit, [{user_ctx,Ctx}]),
+ ok = fabric2_db:set_revs_limit(Db, Limit),
send_json(Req, {[{<<"ok">>, true}]});
db_req(#httpd{method='GET',path_parts=[_,<<"_revs_limit">>]}=Req, Db) ->
- send_json(Req, fabric:get_revs_limit(Db));
+ send_json(Req, fabric2_db:get_revs_limit(Db));
db_req(#httpd{path_parts=[_,<<"_revs_limit">>]}=Req, _Db) ->
send_method_not_allowed(Req, "PUT,GET");
diff --git a/test/elixir/test/basics_test.exs b/test/elixir/test/basics_test.exs
index d5deaf7..a14035d 100644
--- a/test/elixir/test/basics_test.exs
+++ b/test/elixir/test/basics_test.exs
@@ -492,4 +492,21 @@ defmodule BasicsTest do
assert Map.has_key?(resp.body, "update_seq")
end
+ @tag :with_db
+ test "Check _revs_limit", context do
+ db_name = context[:db_name]
+
+ resp = Couch.get("/#{db_name}/_revs_limit")
+ assert resp.status_code == 200
+ assert resp.body == 1000
+
+ body = "999"
+ resp = Couch.put("/#{db_name}/_revs_limit", body: "999")
+ assert resp.status_code == 200
+ assert resp.body["ok"] == true
+
+ resp = Couch.get("/#{db_name}/_revs_limit")
+ assert resp.status_code == 200
+ assert resp.body == 999
+ end
end