Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[chore] Make TestReadRotatingFiles more robust on Windows (open-telem…
…etry#36032) Make the remove operation an "eventually required" since on Windows you can't delete if there are still handles opened to the file. This should prevent failures like https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/11559461472/job/32174166127#step:8:259 see below. On my box multiple runs were failing but that higher frequency of failures was probably to the usage of antivirus software, this change made it to pass consistently on my box. ```terminal D:/a/opentelemetry-collector-contrib/opentelemetry-collector-contrib/.tools/gotestsum --rerun-fails=1 --packages="./..." -- -race -timeout 600s -parallel 4 --tags="" ✖ . (1.777s) === Failed === FAIL: . TestReadRotatingFiles/CopyTruncate (2.73s) filelog_test.go:194: Error Trace: D:/a/opentelemetry-collector-contrib/opentelemetry-collector-contrib/receiver/filelogreceiver/filelog_test.go:194 Error: Received unexpected error: remove C:\Users\RUNNER~1\AppData\Local\Temp\TestReadRotatingFilesCopyTruncate3537600095\001\test-backup.log: The process cannot access the file because it is being used by another process. Test: TestReadRotatingFiles/CopyTruncate === FAIL: . TestReadRotatingFiles (0.00s) === FAIL: . TestReadRotatingFiles/CopyTruncate (re-run 1) (1.63s) filelog_test.go:194: Error Trace: D:/a/opentelemetry-collector-contrib/opentelemetry-collector-contrib/receiver/filelogreceiver/filelog_test.go:194 Error: Received unexpected error: remove C:\Users\RUNNER~1\AppData\Local\Temp\TestReadRotatingFilesCopyTruncate134417[272](https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/11559461472/job/32174166127#step:8:273)3\001\test-backup.log: The process cannot access the file because it is being used by another process. Test: TestReadRotatingFiles/CopyTruncate === FAIL: . TestReadRotatingFiles (re-run 1) (0.00s) ```
- Loading branch information