Commit ee91632
authored
Upgrade django-health-check from pinned git commit to PyPI 3.24.0 (#3556)
* Upgrade django-health-check from pinned git commit to PyPI 3.24.0
Replaces the stale codingjoe/django-health-check@53f9bdc3 (dev build of
3.20.1) git dependency with the newest PyPI release compatible with
Django==4.2.30: 3.24.0. 4.0.0+ requires Django>=5.2 so isn't available
here yet. Verified the settings.py integration (bare check class names
in HEALTH_CHECK["SUBSETS"], contrib.migrations/celery_ping/redis/db_heartbeat
apps, health_check.urls include) is unaffected other than new
deprecation warnings for APIs slated for removal in v4.
* Fix silently-broken health check SUBSETS matching after 3.24.0 bump
The previous commit upgraded django-health-check from a stale git pin to
PyPI 3.24.0, which (unbeknownst at the time) silently broke this repo's
HEALTH_CHECK["SUBSETS"] configuration: 3.24.0's health_check/__init__.py
now does `Cache.__qualname__ = "Cache"` (and similarly for Database) as
a global, process-wide mutation of the shared CacheBackend/
DatabaseHeartBeatCheck classes, so their dataclass-generated __repr__ no
longer matches the bare class names ("CacheBackend", "DatabaseHeartBeatCheck")
used in SUBSETS. Confirmed empirically: only "MigrationsHealthCheck" (the
one check with no reprable fields and no top-level alias) still matched;
Cache, Database, Redis, and CeleryPing were silently excluded from every
subset, meaning /health/liveness/, /health/readiness/, and most of
/health/startup/ and /health/full/ were vacuously always-200 regardless of
actual DB/cache/redis/celery status. This was a regression introduced by
the dependency bump, not a pre-existing issue: the old pinned commit's
health_check/__init__.py did no such aliasing.
Also, every one of the old INSTALLED_APPS contrib sub-apps
(health_check.contrib.{redis,db_heartbeat,celery_ping,migrations}) emits
its own DeprecationWarning at app-ready time pointing at this exact fix:
'checks are now configured via HealthCheckView... add the appropriate
check to your HealthCheckView.checks.'
Replaces the whole SUBSETS + INSTALLED_APPS-registration mechanism with
the explicit, non-fragile HealthCheckView(checks=[...]) API (already
available in 3.24.0, not just v4), matching the pattern already used in
mitxonline/micromasters/ocw-studio/mitxpro. Also fixes the CacheBackend
check to target the "redis" cache alias instead of the always-available
in-memory "default" alias, which made it a no-op regardless of the
SUBSETS bug.
Verified live via Django's test client: /health/liveness/ returns
200 {"Database(alias='default')": "OK"} against sqlite, and
/health/readiness/ correctly returns a 500 ServiceUnavailable when
pointed at an unreachable Redis instead of silently passing.
* Add bare /health/ route and URL-resolution tests
Addresses Copilot review feedback: the rewritten urls_healthcheck.py
only defined /health/{startup,liveness,readiness,full}/ subset routes,
dropping the bare /health/ index that include("health_check.urls")
previously provided. Added it back, mapped to the full check list.
Also adds main/urls_healthcheck_test.py asserting all five paths
resolve to HealthCheckView. Resolves directly against the
main.urls_healthcheck sub-urlconf (via get_resolver) rather than
django.urls.resolve() against the full project urlconf, since the
latter transitively imports the tika client (via learning_resources'
ETL utils) for the first time in a fresh test process, which triggers
a pkg_resources.declare_namespace() DeprecationWarning that this repo's
autouse warnings-as-errors fixture turns into a failure -- a
pre-existing, unrelated issue in the tika dependency, not something to
paper over by scoping down what this test actually needs to exercise.1 parent 0bca7e4 commit ee91632
6 files changed
Lines changed: 89 additions & 47 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | 143 | | |
149 | 144 | | |
150 | 145 | | |
151 | 146 | | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | 147 | | |
186 | 148 | | |
187 | 149 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | 157 | | |
161 | 158 | | |
162 | 159 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments