25
25
)
26
26
from simcore_service_webserver .rest import setup_rest
27
27
from simcore_service_webserver .security import setup_security
28
+ from yarl import URL
28
29
29
30
logger = logging .getLogger (__name__ )
30
31
32
+ def health_check_path (api_version_prefix ) -> URL :
33
+ return f"/{ api_version_prefix } /health"
34
+
31
35
32
36
async def health_check_emulator (
33
37
client ,
34
- api_version_prefix ,
38
+ health_check_path ,
35
39
* ,
36
40
min_num_checks = 2 ,
37
41
start_period : int = 0 ,
@@ -41,7 +45,7 @@ async def health_check_emulator(
41
45
):
42
46
# Follows docker's health check protocol
43
47
# 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 )
45
49
46
50
check_count = 0
47
51
@@ -144,7 +148,7 @@ def test_diagnostics_setup(client):
144
148
assert "envelope" in app .middlewares [2 ].__middleware_name__
145
149
146
150
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 " )
148
152
149
153
data , error = await assert_status (resp , web .HTTPOk )
150
154
@@ -156,13 +160,13 @@ async def test_healthy_app(client, api_version_prefix):
156
160
157
161
158
162
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 " )
160
164
await assert_status (resp , web .HTTPOk )
161
165
162
166
resp = await client .get ("/slow" ) # emulates a very slow handle!
163
167
await assert_status (resp , web .HTTPOk )
164
168
165
- resp = await client .get (f"/{ api_version_prefix } /" )
169
+ resp = await client .get (f"/{ api_version_prefix } /health " )
166
170
await assert_status (resp , web .HTTPServiceUnavailable )
167
171
168
172
0 commit comments