-
Notifications
You must be signed in to change notification settings - Fork 31
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 flaky cloudwatchlogs test #455
Conversation
test/cloudwatchlogs/resources/config_log_infrequent_access.json
Outdated
Show resolved
Hide resolved
@@ -249,6 +249,9 @@ func TestLogGroupClass(t *testing.T) { | |||
|
|||
for _, param := range cloudWatchLogGroupClassTestParameters { | |||
t.Run(param.testName, func(t *testing.T) { | |||
// add instance id to ensure that running integration tests concurrently doesn't cause tests | |||
// to operate and validate with the same log groups and lead to flaky results | |||
param.logGroupName += "-" + instanceId | |||
defer awsservice.DeleteLogGroupAndStream(param.logGroupName, instanceId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mentioned in another comment, but we should update the logGroupName passed to DeleteLogGroupAndStream
as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch @dricross.
defer awsservice.DeleteLogGroupAndStream(param.logGroupName, instanceId) | |
defer awsservice.DeleteLogGroupAndStream(param.logGroupName += "-" + instanceId, instanceId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this should have already been handled since I was using +=
here but I rewrote it to make it more clear now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah good point, I missed that. Thanks Varun!
I think with that we don't really need to change log retention at all then since the log group and stream gets deleted. Though it also doesn't hurt to set it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah missed that too. Yeah, keeping the log retention doesn't hurt.
@@ -249,6 +249,9 @@ func TestLogGroupClass(t *testing.T) { | |||
|
|||
for _, param := range cloudWatchLogGroupClassTestParameters { | |||
t.Run(param.testName, func(t *testing.T) { | |||
// add instance id to ensure that running integration tests concurrently doesn't cause tests | |||
// to operate and validate with the same log groups and lead to flaky results | |||
param.logGroupName += "-" + instanceId | |||
defer awsservice.DeleteLogGroupAndStream(param.logGroupName, instanceId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch @dricross.
defer awsservice.DeleteLogGroupAndStream(param.logGroupName, instanceId) | |
defer awsservice.DeleteLogGroupAndStream(param.logGroupName += "-" + instanceId, instanceId) |
Changes:
|
Description of the issue
TestLogGroupClass
uses fixed log group names in the tests. When multiple integration tests are run concurrently in the same account, they're all trying to operate and validate with the same log groups, leading to flaky behavior.Description of changes
The log groups created now have the instance id appended to the end of the name, ensuring there is no overlap. I've also added a 7-day log group retention policy in the agent configs.
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
Integration Test: https://github.com/aws/amazon-cloudwatch-agent/actions/runs/12958277627