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

Fix TestLogsFileRecreate. #310

Merged
merged 3 commits into from
Nov 11, 2021
Merged

Fix TestLogsFileRecreate. #310

merged 3 commits into from
Nov 11, 2021

Conversation

adam-mateen
Copy link
Contributor

Description of the issue

TestLogsFileRecreate() intermittently fails on Windows OS.
example: https://github.com/aws/amazon-cloudwatch-agent/runs/4156147013?check_suite_focus=true

There are actually 2 issues.
First is that there is a for loop that will does not end until Go does a panic.
Second, the delay between deleting the monitored temp file and recreating it is a fixed 100 ms.
These 2 changes are minimally required.

Description of changes

The loop will timeout after 10 seconds if the LogSrc is not found, instead of Panic after 10 minutes.
The fixed delay between deleting and recreating the temp file has been increased from 100ms to 1 second.

I added some info messages to describe what the test is doing.
I was just going to add code comments, but logging what the test is doing makes it easier to correlate with what the functions being tested are doing and correlate with if/when errors occur.

License

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Tests

make release

@codecov-commenter
Copy link

codecov-commenter commented Nov 10, 2021

Codecov Report

Merging #310 (dd123b4) into master (fa25580) will decrease coverage by 0.22%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #310      +/-   ##
==========================================
- Coverage   57.05%   56.82%   -0.23%     
==========================================
  Files         353      354       +1     
  Lines       16181    16276      +95     
==========================================
+ Hits         9232     9249      +17     
- Misses       6405     6483      +78     
  Partials      544      544              
Impacted Files Coverage Δ
...dwatch-agent/translator/cmdutil/userutil_darwin.go 10.52% <0.00%> (ø)
...tch-agent/plugins/outputs/cloudwatch/cloudwatch.go 74.50% <0.00%> (+0.98%) ⬆️
...oudwatch-agent/plugins/inputs/logfile/tailersrc.go 84.94% <0.00%> (+1.61%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fa25580...dd123b4. Read the comment docs.

Copy link
Contributor

@SaxyPandaBear SaxyPandaBear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jhnlsn jhnlsn merged commit cc117af into master Nov 11, 2021
@jhnlsn jhnlsn deleted the fix-TestLogsFileRecreate branch November 11, 2021 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants