Commit 41bd240
committed
sweepbatcher: assert close-during-add run exit
TestSweepBatcherCloseDuringAdding previously started Batcher.Run in a
detached goroutine and called test assertions from that goroutine. The
test only waited for the add/cancel workers, so a Run-side shutdown
error could be missed or reported unreliably.
Route the Run result through a channel and wait for it in the main test
goroutine. While waiting, keep draining spend registrations so shutdown
cannot deadlock on mock notifier traffic.
This makes the existing shutdown-race test cover both sides of the race:
AddSweep callers may exit with cancellation, and Batcher.Run must also
terminate with an expected shutdown error.1 parent d94755c commit 41bd240
1 file changed
Lines changed: 21 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4208 | 4208 | | |
4209 | 4209 | | |
4210 | 4210 | | |
| 4211 | + | |
4211 | 4212 | | |
4212 | | - | |
4213 | | - | |
| 4213 | + | |
4214 | 4214 | | |
4215 | 4215 | | |
4216 | 4216 | | |
| |||
4276 | 4276 | | |
4277 | 4277 | | |
4278 | 4278 | | |
4279 | | - | |
4280 | | - | |
4281 | | - | |
| 4279 | + | |
| 4280 | + | |
4282 | 4281 | | |
4283 | | - | |
4284 | | - | |
4285 | | - | |
4286 | | - | |
4287 | | - | |
4288 | | - | |
4289 | | - | |
4290 | | - | |
| 4282 | + | |
| 4283 | + | |
4291 | 4284 | | |
4292 | 4285 | | |
4293 | | - | |
4294 | | - | |
4295 | | - | |
| 4286 | + | |
| 4287 | + | |
| 4288 | + | |
| 4289 | + | |
| 4290 | + | |
| 4291 | + | |
| 4292 | + | |
| 4293 | + | |
| 4294 | + | |
| 4295 | + | |
| 4296 | + | |
| 4297 | + | |
| 4298 | + | |
| 4299 | + | |
| 4300 | + | |
4296 | 4301 | | |
4297 | 4302 | | |
4298 | 4303 | | |
| |||
0 commit comments