Commit b92c8e2
committed
Fix TestMendFunctionDirect race condition on macOS CI
Add explicit file system synchronization to fix flaky tests failing on macOS CI but passing locally.
The issue was a race condition between file operations (truncate/rename) and subsequent verification reads.
Changes:
- Add defer reader.Close() in analyzeWARCFile to properly clean up gzip decompressor state
- Add file.Sync() in truncateFile to ensure truncation is persisted before subsequent reads
- Add syncDirectory() helper and call it after rename to ensure metadata is persisted
- Add 'path' package import for directory path manipulation
This ensures file operations complete before verification reads files, eliminating platform-specific timing differences.1 parent 4170a1c commit b92c8e2
1 file changed
+28
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
200 | 201 | | |
201 | 202 | | |
202 | 203 | | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
203 | 211 | | |
204 | 212 | | |
205 | 213 | | |
| |||
294 | 302 | | |
295 | 303 | | |
296 | 304 | | |
| 305 | + | |
297 | 306 | | |
298 | 307 | | |
299 | 308 | | |
| |||
377 | 386 | | |
378 | 387 | | |
379 | 388 | | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
380 | 403 | | |
381 | 404 | | |
382 | 405 | | |
| |||
388 | 411 | | |
389 | 412 | | |
390 | 413 | | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
391 | 419 | | |
392 | 420 | | |
393 | 421 | | |
| |||
0 commit comments