Skip to content

Commit b76fb44

Browse files
committed
Fixes tests
1 parent 9bbf8f3 commit b76fb44

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

services/web/server/tests/unit/test_healthcheck.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,17 @@
2525
)
2626
from simcore_service_webserver.rest import setup_rest
2727
from simcore_service_webserver.security import setup_security
28+
from yarl import URL
2829

2930
logger = logging.getLogger(__name__)
3031

32+
def health_check_path(api_version_prefix) -> URL:
33+
return f"/{api_version_prefix}/health"
34+
3135

3236
async def health_check_emulator(
3337
client,
34-
api_version_prefix,
38+
health_check_path,
3539
*,
3640
min_num_checks=2,
3741
start_period: int = 0,
@@ -41,7 +45,7 @@ async def health_check_emulator(
4145
):
4246
# Follows docker's health check protocol
4347
# SEE https://docs.docker.com/engine/reference/builder/#healthcheck
44-
checkpoint: Coroutine = client.get(f"/{api_version_prefix}/")
48+
checkpoint: Coroutine = client.get(health_check_path)
4549

4650
check_count = 0
4751

@@ -144,7 +148,7 @@ def test_diagnostics_setup(client):
144148
assert "envelope" in app.middlewares[2].__middleware_name__
145149

146150
async def test_healthy_app(client, api_version_prefix):
147-
resp = await client.get(f"/{api_version_prefix}/")
151+
resp = await client.get(f"/{api_version_prefix}/health")
148152

149153
data, error = await assert_status(resp, web.HTTPOk)
150154

@@ -156,13 +160,13 @@ async def test_healthy_app(client, api_version_prefix):
156160

157161

158162
async def test_unhealthy_app_with_slow_callbacks(client, api_version_prefix):
159-
resp = await client.get(f"/{api_version_prefix}/")
163+
resp = await client.get(f"/{api_version_prefix}/health")
160164
await assert_status(resp, web.HTTPOk)
161165

162166
resp = await client.get("/slow") # emulates a very slow handle!
163167
await assert_status(resp, web.HTTPOk)
164168

165-
resp = await client.get(f"/{api_version_prefix}/")
169+
resp = await client.get(f"/{api_version_prefix}/health")
166170
await assert_status(resp, web.HTTPServiceUnavailable)
167171

168172

0 commit comments

Comments
 (0)