Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] Make TestReadRotatingFiles more robust on Windows #36032

Conversation

pjanotti
Copy link
Contributor

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.

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)

@pjanotti pjanotti added the Run Windows Enable running windows test on a PR label Oct 28, 2024
@github-actions github-actions bot requested a review from djaglowski October 28, 2024 23:02
@pjanotti pjanotti changed the title Make TestReadRotatingFiles more robust on Windows [chore] Make TestReadRotatingFiles more robust on Windows Oct 28, 2024
@pjanotti pjanotti added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Oct 28, 2024
…ithub.com:pjanotti/opentelemetry-service-contrib into make-TestReadRotatingFiles-more-robust-on-Windows
@pjanotti pjanotti marked this pull request as ready for review October 29, 2024 17:10
@pjanotti pjanotti requested a review from a team as a code owner October 29, 2024 17:10
@dmitryax dmitryax merged commit 18b9b88 into open-telemetry:main Oct 29, 2024
174 checks passed
@github-actions github-actions bot added this to the next release milestone Oct 29, 2024
@pjanotti pjanotti deleted the make-TestReadRotatingFiles-more-robust-on-Windows branch October 30, 2024 00:03
zzhlogin pushed a commit to zzhlogin/opentelemetry-collector-contrib-aws that referenced this pull request Nov 12, 2024
…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)
```
sbylica-splunk pushed a commit to sbylica-splunk/opentelemetry-collector-contrib that referenced this pull request Dec 17, 2024
…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)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
receiver/filelog Run Windows Enable running windows test on a PR Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants