feat: add extremely basic /health endpoint (#396)

* Add extremely basic /health endpoint

* Replace robot-sounds with Ok.

* add test case for /health endpoint

* Apply suggestion to _app.py:
- remove dot from Ok response in health endpoint

* Fix tests for the health endpoint

* Formatting _app.py
This commit is contained in:
Dmitrii Orlov 2022-07-26 23:28:48 +02:00 committed by GitHub
parent 640a74872b
commit 61e44871d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

@ -82,6 +82,11 @@ def log_error(http_error):
log.info(config.log_err_frmt, vars(http_error)) log.info(config.log_err_frmt, vars(http_error))
@app.route("/health")
def health():
return "Ok"
@app.route("/favicon.ico") @app.route("/favicon.ico")
def favicon(): def favicon():
return HTTPError(404) return HTTPError(404)

@ -188,6 +188,12 @@ def test_packages_empty(testapp):
assert len(resp.html("a")) == 0 assert len(resp.html("a")) == 0
def test_health(testapp):
resp = testapp.get("/health")
assert resp.status_int == 200
assert "Ok" in resp
def test_favicon(testapp): def test_favicon(testapp):
testapp.get("/favicon.ico", status=404) testapp.get("/favicon.ico", status=404)