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

@aws-cdk/integ-tests-alpha: SingletonFunctions used for test assertions should set a CloudWatch log group retention policy #29260

Closed
2 tasks
jvalore-medallia opened this issue Feb 26, 2024 · 2 comments · Fixed by #29277
Assignees
Labels
@aws-cdk/assertions Related to the @aws-cdk/assertv2 package effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p1

Comments

@jvalore-medallia
Copy link

Describe the feature

Currently if you perform a test like

import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests-alpha';

const integ = new IntegTest(app, 'Example', {
  testCases: [testStack],
  assertionStack: new cdk.Stack(app, 'assertions', { synthesizer }),
});

const invoke = integ.assertions.invokeFunction({
  functionName: 'some:lambda:arn',
  payload: '{}'
});

The stack deletes itself after a test, but CloudWatch log groups named like

/aws/lambda/assertions-SingletonFunction{random id}

and are set to never expire, so end up cluttering up your aws account and need manual cleanup.

Use Case

Test results are not needed forever and should have some default retention policy, or at least a way to set them.

Proposed Solution

Include a default retention policy for SingletonFunction CloudWatch log groups.

Other Information

nodejs dependencies:

    "@aws-cdk/integ-runner": "^2.129.0-alpha.0",
    "@aws-cdk/integ-tests-alpha": "2.129.0-alpha.0",
    "aws-cdk": "2.129.0",

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.129.0

Environment details (OS name and version, etc.)

Mac. Node 20. cdk 2.129.0

@jvalore-medallia jvalore-medallia added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Feb 26, 2024
@github-actions github-actions bot added the @aws-cdk/assertions Related to the @aws-cdk/assertv2 package label Feb 26, 2024
@pahud pahud changed the title @aws-cdk/integ-tests-alpha: SingletonFunctions used for test assertions should set a CloudWatch leg group retention policy @aws-cdk/integ-tests-alpha: SingletonFunctions used for test assertions should set a CloudWatch log group retention policy Feb 27, 2024
@pahud
Copy link
Contributor

pahud commented Feb 27, 2024

I guess this is because by default lambda.Function will create a built-in log group that never expires unless a custom loggroup is specified here.

Yes it would be great to have the log retention policy support for that.

@pahud pahud added p1 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Feb 27, 2024
@GavinZZ GavinZZ self-assigned this Feb 27, 2024
@mergify mergify bot closed this as completed in #29277 Mar 15, 2024
mergify bot pushed a commit that referenced this issue Mar 15, 2024
…tack (#29277)

### Issue # (if applicable)

Closes #29260

### Reason for this change

CloudWatch log groups created by the integ tests are set to never expire, so end up cluttering up your aws account and need manual cleanup.

### Description of changes

Added custom log group with log group retention

### Description of how you validated changes

All existing tests and new tests pass.

### Checklist
- [ ] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/assertions Related to the @aws-cdk/assertv2 package effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants