-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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(cloudwatch): correct CompositeAlarm.fromCompositeAlarmName ARN format #24604
Conversation
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.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
Exemption Request: Fix is in resource import, which isn't visible in stack output except if doign some other usage. All in all, not sure what is the best way to test the fix, as there were no tests for the original functionality (which is obviously why it was broken in the first place). Somebody more knowledgeable could give me a hint. |
This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state. |
@nakedible-p Can you mark this PR ready for review? @pahud Can we create an exemption for the linter? |
This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state. |
1 similar comment
This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state. |
This PR has been in the CHANGES REQUESTED state for 3 weeks, and looks abandoned. To keep this PR from being closed, please continue work on it. If not, it will automatically be closed in a week. |
Hi
You will need to submit an integration test file change and re-generate the snapshot.
And I see some file conflicting you will need to resolve to pass the check before the maintainers can come in for initial review. |
d2fe6fa
to
9d10492
Compare
Hi Pahud Pull request now marked ready for review. And as explained above, I don't know how to get the integration test thing fixed, as there are no integration tests for imports in this module.
The fix is trivial, but I do need assistance on how to write a test that didn't exist in the first place. |
Neither of those is an integration test ( |
@nakedible-p We should add this change for Regarding integration tests, you can refer this guide and an example here On a high level it could look like what we have below where we create two stacks (one producer and one consumer) import * as cw from 'aws-cdk-lib/aws-cloudwatch';
import * as cdk from 'aws-cdk-lib/core';
import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests-alpha';
const ALARM_NAME = "SomeAlarmName";
const COMPOSITE_ALARM_NAME = "SomeCompositeAlarmName";
class ProducerStack extends cdk.Stack {
constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const alarm = new cw.Alarm(this, "SomeAlarm", {...});
const compositeAlarm = new cw.CompositeAlarm(this, "SomeCompositeAlarm", {...});
}
}
class ConsumerStack extends cdk.Stack {
constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const importedAlarm = cw.Alarm.fromAlarmName(this, "ImportedSomeAlarm", ALARM_NAME);
const importedCompositeAlarm = cw.CompositeAlarm.fromCompositeAlarmName(this, "ImportedSomeAlarm", COMPOSITE_ALARM_NAME);
// create a new composite alarm from the two imported alarms above.
const compositeAlarm = new cw.CompositeAlarm(this, "SomeCompositeAlarm", {...});
}
}
const app = new cdk.App();
const producerStack = new ProducerStack(app, 'alarm-import-producer-integ');
const consumerStack = new ConsumerStack(app, 'alarm-import-consumer-integ');
consumerStack.addDependency(producerStack);
const testCase = new IntegTest(app, 'ImportAlarms', {
testCases: [producerStack, consumerStack],
});
// Add assertions here that the new compositeAlarm in consumerStack exists.
testCase.assertions
.awsApiCall('CloudWatch', 'DescribeAlarms', {...})
.expect(ExpectedResult.objectLike(...)); |
To clarify:
I'm not interested in:
If you can help me in exactly what commands I need to run on a freshly checked out repository in order to run integration tests on (Sorry, no coffee this morning yet) |
I agree and that's why I requested @pahud to override that pr-rule for this change since I have typically not seen any service module having integ-tests for importing resources. I provided the above reference since you said you needed some assistance in writing them. I am okay in not having integ-tests for this change and have appropriate coverage with just unit-tests. But I would really love to see the same API added to Alarm to be consistent even though they were not consistent to being with. Then again this is not something which should block this fix to be merged but a mere request. @pahud What are you thoughts on this? |
Hold your horses - after some coffee, I found out the following:
|
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
How about it now?
Also, it seems that it is already known that the integration tests document is out of date: #24958 |
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.
LGTM!
Thanks a lot for going the extra mile to add the functionality to Alarm and corresponding missing unit tests as well!
Do I need to do something else to push this through, or will the AWS reviewers just pick this up when they have the time? |
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.
Thanks for the PR!
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
I think auto merge failed because of commit c174a49 Should I manually update the branch, or will someone else handle it from here? |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Fixes #24594.