diff options
author | Eric Avdey <eiri@eiri.ca> | 2019-11-22 15:15:45 -0400 |
---|---|---|
committer | Paul J. Davis <paul.joseph.davis@gmail.com> | 2020-03-02 12:26:22 -0600 |
commit | 5aeb21ce1d86c8e0e5c0c4b7bd8c188816a5de75 (patch) | |
tree | 5605e26934a72be2d6d65d07dd830d48384870fc | |
parent | 6ff0a112899a8a04d65fb3155b69540862be8c0a (diff) | |
download | couchdb-5aeb21ce1d86c8e0e5c0c4b7bd8c188816a5de75.tar.gz |
Change end-point /_up to check fdb connectivity
-rw-r--r-- | src/chttpd/src/chttpd_misc.erl | 11 | ||||
-rw-r--r-- | 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 6e0d8cea2..f245875f2 100644 --- a/src/chttpd/src/chttpd_misc.erl +++ b/src/chttpd/src/chttpd_misc.erl @@ -291,12 +291,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 21e05dfcf..f4f95689a 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] |