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 18:03:00 UTC

[couchdb] branch prototype/fdb-layer updated: 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
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/prototype/fdb-layer by this push:
     new 2eb1dee  Implement setting and getting _revs_limit
2eb1dee is described below

commit 2eb1deed47c74106480380f39e89ef340e5f6328
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