Commit 9f00fcd
committed
chore(tests): stop leaking channels on cleanup failure
The CI test suite creates ~94 channels per run (~50 sync + ~44 async)
across fixtures and explicit cases, but cleanup historically ran
through three escape hatches that silently leaked channels into the
shared test app:
1. channel fixture used client.delete_channels([cid], hard_delete=True),
which returns a task_id immediately. When the task queue is backed
up (the same backend slowness that breaks test_delete_channels) the
fixture says 'done' before the delete actually fires.
2. Every cleanup path swallowed exceptions: except Exception: pass.
Failures invisible.
3. test_query_drafts (sync + async) created a second channel,
channel2, and did not delete it on the failure path.
Stale channels drift across runs and eventually break unrelated tests
that query the shared app expecting clean state.
Three fixes:
* Swap client.delete_channels for the synchronous channel.delete(hard=True)
HTTP DELETE in every fixture. No task_id race; the channel is gone
before the fixture returns.
* Log cleanup exceptions to stderr ('[cleanup] channel <cid> failed:
...'). Visible in CI logs, doesn't fail the test.
* Add a session-scoped, autouse=True sweep that queries channels tagged
{'test': True, 'language': 'python'} at start and end of the run and
hard-deletes whatever is still hanging around. Self-healing across
runs; tag test_query_drafts's channel2 so the sweep catches it too.1 parent cb36a31 commit 9f00fcd
4 files changed
Lines changed: 306 additions & 150 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
29 | 38 | | |
30 | 39 | | |
31 | 40 | | |
32 | 41 | | |
33 | 42 | | |
34 | 43 | | |
35 | 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 | + | |
36 | 90 | | |
37 | 91 | | |
38 | 92 | | |
| |||
85 | 139 | | |
86 | 140 | | |
87 | 141 | | |
| 142 | + | |
| 143 | + | |
88 | 144 | | |
89 | | - | |
90 | | - | |
91 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
92 | 148 | | |
93 | 149 | | |
94 | 150 | | |
| |||
107 | 163 | | |
108 | 164 | | |
109 | 165 | | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
114 | 170 | | |
115 | 171 | | |
116 | 172 | | |
| |||
120 | 176 | | |
121 | 177 | | |
122 | 178 | | |
123 | | - | |
124 | | - | |
| 179 | + | |
| 180 | + | |
125 | 181 | | |
126 | 182 | | |
127 | 183 | | |
| |||
145 | 201 | | |
146 | 202 | | |
147 | 203 | | |
148 | | - | |
149 | | - | |
| 204 | + | |
| 205 | + | |
150 | 206 | | |
151 | 207 | | |
152 | 208 | | |
| |||
155 | 211 | | |
156 | 212 | | |
157 | 213 | | |
158 | | - | |
159 | | - | |
160 | | - | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
161 | 217 | | |
162 | 218 | | |
163 | 219 | | |
164 | 220 | | |
165 | 221 | | |
166 | 222 | | |
167 | 223 | | |
168 | | - | |
169 | | - | |
| 224 | + | |
| 225 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
103 | 94 | | |
| 95 | + | |
104 | 96 | | |
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 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | 97 | | |
146 | | - | |
147 | | - | |
148 | | - | |
| 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 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
0 commit comments