You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ei...@apache.org on 2019/11/22 19:40:23 UTC
[couchdb] branch prototype/fdb-layer updated: Change end-point /_up
to check fdb connectivity
This is an automated email from the ASF dual-hosted git repository.
eiri 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 3c2b92c Change end-point /_up to check fdb connectivity
3c2b92c is described below
commit 3c2b92c032f234666454925c911b01e1b781af2e
Author: Eric Avdey <ei...@eiri.ca>
AuthorDate: Fri Nov 22 15:15:45 2019 -0400
Change end-point /_up to check fdb connectivity
---
src/chttpd/src/chttpd_misc.erl | 11 +++++------
test/elixir/test/basics_test.exs | 6 ++++++
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/chttpd/src/chttpd_misc.erl b/src/chttpd/src/chttpd_misc.erl
index 11d2c5b..186ec9f 100644
--- a/src/chttpd/src/chttpd_misc.erl
+++ b/src/chttpd/src/chttpd_misc.erl
@@ -498,12 +498,11 @@ handle_up_req(#httpd{method='GET'} = Req) ->
"nolb" ->
send_json(Req, 404, {[{status, nolb}]});
_ ->
- {ok, {Status}} = mem3_seeds:get_status(),
- case couch_util:get_value(status, Status) of
- ok ->
- send_json(Req, 200, {Status});
- seeding ->
- send_json(Req, 404, {Status})
+ try
+ fabric2_db:list_dbs([{limit, 0}]),
+ send_json(Req, 200, {[{status, ok}]})
+ catch error:{timeout, _} ->
+ send_json(Req, 404, {[{status, backend_unavailable}]})
end
end;
diff --git a/test/elixir/test/basics_test.exs b/test/elixir/test/basics_test.exs
index dda2a0c..f0f9e3a 100644
--- a/test/elixir/test/basics_test.exs
+++ b/test/elixir/test/basics_test.exs
@@ -18,6 +18,12 @@ defmodule BasicsTest do
assert Couch.get("/").body["couchdb"] == "Welcome", "Should say welcome"
end
+ test "Ready endpoint" do
+ resp = Couch.get("/_up")
+ assert resp.status_code == 200
+ assert resp.body["status"] == "ok"
+ end
+
@tag :with_db
test "PUT on existing DB should return 412 instead of 500", context do
db_name = context[:db_name]