Commit 2e7adc7
test(memory): fix flaky TestRebuildDoesNotSerializeRecall cleanup race
The test launches the blocked-rebuild goroutine and returned right after
close(release), so the rebuild's index-gob writes (saveLocked) could land in
t.TempDir AFTER the test function returned, racing the TempDir RemoveAll
cleanup — CI failed with 'directory not empty'. (Product code unaffected;
purely a test-teardown ordering bug.)
Fix: a deferred releaseBackend()+<-g1 unblocks the backend and waits for the
rebuild goroutine to finish on every exit path (deferred funcs run before
t.Cleanup), so the index is fully written before TempDir is removed. Verified
50x under -race.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent 4a2b665 commit 2e7adc7
1 file changed
Lines changed: 17 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
204 | | - | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
205 | 216 | | |
206 | 217 | | |
207 | 218 | | |
208 | 219 | | |
209 | 220 | | |
210 | 221 | | |
211 | | - | |
212 | | - | |
213 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
214 | 225 | | |
215 | 226 | | |
216 | 227 | | |
| |||
227 | 238 | | |
228 | 239 | | |
229 | 240 | | |
230 | | - | |
231 | 241 | | |
232 | 242 | | |
233 | 243 | | |
234 | | - | |
235 | | - | |
| 244 | + | |
| 245 | + | |
236 | 246 | | |
0 commit comments