Commit 7e48dc8
Fix CI on the v0.16 JMAP branch: ruff format + offline test setUp (#1205)
* Fix CI on the v0.16 JMAP branch: ruff format + offline test setUp
Two independent CI failures on features/628-v016-stalwart-upgrade.
1. `ruff format --check` rejected the commented-out body of
`BaseJMAP._debug_dump` (`#with` -> `# with`). Left the dead scaffold in
place; only the comment spacing changed.
2. All 10 tests in `test_clients/test_jmap.py` errored in `setUp`.
`MailClientAdminJMAP.__init__` calls `_get_user_client`, which builds a
real `JMAPClient` and eagerly fetches `/.well-known/jmap` over HTTP. Both
test classes constructed the real client before installing
`MockJMapClient`, so every test raised ConnectionError -- the
`validate-accounts` job only starts postgres/redis/accounts/vite-dev, so
there is no Stalwart to reach.
Added `build_admin_client()`, which patches `_get_user_client` for the
duration of construction to return a `MockJMapClient` (session read from
the existing fixture). `TestCreateDkim` no longer needs to reassign
`.client` afterwards.
Verified in the container with the exact CI commands: `ruff check` clean,
`ruff format --check` clean (159 files), and `manage.py test
thunderbird_accounts` -> Ran 533 tests, OK.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* Fix run-e2e-tests-local: point legacy Stalwart env at renamed service
The e2e job's "Wait for local services" gate (`curl --fail http://localhost:8087/health`)
returned HTTP 500 until retries were exhausted.
Root cause: with the default flag (STALWART_ADMIN_API_USE_JMAP=false) the app uses the
legacy client, whose get_telemetry() hits STALWART_BASE_API_URL. That was still
http://stalwart:8080, but #1131 renamed the compose service `stalwart` -> `stalwart_legacy`
with no network alias, so the hostname no longer resolves. get_telemetry() then raised
requests.exceptions.ConnectionError; infra/views.py::__check_stalwart catches only
HTTPError (a sibling class), so it escaped and health_check returned 500 instead of its
usual 200-with-per-service-status.
Fix: point STALWART_BASE_API_URL / STALWART_BASE_JMAP_URL at stalwart_legacy in
.env.example and .env.test, and update boot-docker-deps.sh which still started the removed
`stalwart` service.
Note: this leaves the /health error-handling as-is on purpose. A reachable Stalwart that
returns 401/404 raises HTTPError, which __check_stalwart already catches; only an
unresolvable host produced the 500. Broadening the except to RequestException would also
change prod behaviour (the accounts ECS task would stop self-recycling on a downstream
outage, since the ALB /health check would no longer see a 500), so that is left as a
separate decision.
Verified locally with the full compose stack (postgres, kcpostgres, redis, keycloak,
stalwart_legacy, accounts):
curl --fail http://localhost:8087/health -> HTTP 200 (all services healthy:true)
curl --fail http://localhost:9000/health/ready -> HTTP 200
ruff check / ruff format --check -> clean
manage.py test thunderbird_accounts -> Ran 533 tests, OK
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Arron Atchison <aatchison@thunderbird.net>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>1 parent 4368062 commit 7e48dc8
4 files changed
Lines changed: 24 additions & 8 deletions
File tree
- src/thunderbird_accounts/mail/tests/test_clients
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
92 | | - | |
| 91 | + | |
| 92 | + | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
86 | | - | |
| 85 | + | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
Lines changed: 19 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
40 | 57 | | |
41 | 58 | | |
42 | 59 | | |
| |||
48 | 65 | | |
49 | 66 | | |
50 | 67 | | |
51 | | - | |
| 68 | + | |
52 | 69 | | |
53 | 70 | | |
54 | 71 | | |
55 | 72 | | |
56 | 73 | | |
57 | 74 | | |
58 | | - | |
| 75 | + | |
59 | 76 | | |
60 | | - | |
61 | 77 | | |
62 | 78 | | |
63 | 79 | | |
| |||
0 commit comments