diff options
author | Eric Avdey <eiri@eiri.ca> | 2019-11-22 15:15:45 -0400 |
---|---|---|
committer | Eric Avdey <eiri@eiri.ca> | 2019-11-22 15:40:12 -0400 |
commit | 3c2b92c032f234666454925c911b01e1b781af2e (patch) | |
tree | 6831fe7a21bbbc12d2c85e083073bea7f6c2d8e5 | |
parent | be22ef9decd9b4f9a6f1704d274f7f67aaed9686 (diff) | |
download | couchdb-3c2b92c032f234666454925c911b01e1b781af2e.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 11d2c5b72..186ec9ff0 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 dda2a0c15..f0f9e3a57 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] |