Connect to main app socket on health check

This commit is contained in:
steve-chavez
2022-01-04 20:12:52 -05:00
committed by Steve Chavez
parent cc900787de
commit bba6e96fd3
4 changed files with 74 additions and 17 deletions
+17
View File
@@ -773,3 +773,20 @@ def test_admin_not_found(defaultenv):
with run(env=defaultenv, adminport=freeport()) as postgrest:
response = postgrest.admin.get("/notfound")
assert response.status_code == 404
def test_admin_health_dependent_on_main_app(defaultenv):
"Should get a failure from the admin health endpoint if the main app also fails"
env = {
**defaultenv,
"PGRST_ADMIN_SERVER_PORT": "3001",
}
with run(env=env, port=None) as postgrest:
# delete the unix socket to make the main app fail
os.remove(env["PGRST_SERVER_UNIX_SOCKET"])
response = requests.get(
f"http://localhost:{env['PGRST_ADMIN_SERVER_PORT']}/health"
)
assert response.status_code == 503