File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -151,7 +151,12 @@ async def check_pod_quota(self):
151151 }
152152 return usage
153153
154- async def get (self ):
154+ async def check_all (self ):
155+ """Runs all health checks and returns a tuple (overall, checks).
156+
157+ `overall` is a bool representing the overall status of the service
158+ `checks` contains detailed information on each check's result
159+ """
155160 checks = []
156161 check_futures = []
157162
@@ -176,7 +181,15 @@ async def get(self):
176181 overall = all (
177182 check ["ok" ] for check in checks if check ["service" ] != "Pod quota"
178183 )
184+ return overall , checks
185+
186+ async def get (self ):
187+ overall , checks = await self .check_all ()
179188 if not overall :
180189 self .set_status (503 )
181-
182190 self .write ({"ok" : overall , "checks" : checks })
191+
192+ async def head (self ):
193+ overall , checks = await self .check_all ()
194+ if not overall :
195+ self .set_status (503 )
Original file line number Diff line number Diff line change @@ -27,3 +27,7 @@ async def test_basic_health(app):
2727 quota_check ["total_pods" ]
2828 == quota_check ["build_pods" ] + quota_check ["user_pods" ]
2929 )
30+
31+ # HEAD requests should work as well
32+ r = await async_requests .head (app .url + "/health" )
33+ assert r .status_code == 200
You can’t perform that action at this time.
0 commit comments