Commit 6da58bf
test(webapp): stop CI-fatal env-Redis dials in unit tests — force lazyConnect + stub runtime Redis singletons
The setup-file mocks of the six eager worker/engine singletons were not
enough: CI shards still flooded ECONNREFUSED/maxRetries. Two further
classes of env-Redis usage survived them, reproduced locally by running
the failing shards with REDIS_PORT pointed at a dead port:
1. Import-time construction: ~15 more singletons (platform cache,
billing-limit reconcile queue, alerts rate limiter, DevPresence,
auto-increment counter, s2 token cache, v1 streams cache, ...)
build ioredis clients at module import, and ioredis dials on
construction. A global ioredis mock now forces lazyConnect: true so
clients only dial on first command — testcontainer-backed tests are
unaffected (their first command connects as before).
2. Runtime commands inside code under test: tracePubSub.publish()
(eventRepository writes), alertsRateLimiter.check() (deliverAlert)
and the task metadata cache each issue commands against
env-configured Redis mid-test; every command burns ~20 reconnect
cycles before its error surfaces, which times the tests out. These
three modules are now stubbed (metadata cache pinned to its Noop
implementation, which is what CI's unset env resolves to anyway).
Verified: webapp shards 2/5/6/8 (the ones failing on the pr06+ stack)
run green with Redis pointed at a dead port, and shards 2/8 stay green
against live Redis (store-routing suites still exercise the real run
store).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent d5415e8 commit 6da58bf
1 file changed
Lines changed: 85 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
45 | 130 | | |
46 | 131 | | |
47 | 132 | | |
| |||
0 commit comments