-
Notifications
You must be signed in to change notification settings - Fork 4k
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(kinesisfirehose-alpha): refactor integ tests with assertions #32560
chore(kinesisfirehose-alpha): refactor integ tests with assertions #32560
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.
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #32560 +/- ##
=======================================
Coverage 78.86% 78.86%
=======================================
Files 108 108
Lines 7165 7165
Branches 1319 1319
=======================================
Hits 5651 5651
Misses 1330 1330
Partials 184 184
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
||
const app = new cdk.App(); | ||
|
||
const stack = new cdk.Stack(app, 'aws-cdk-firehose-delivery-stream-source-stream'); | ||
const stack = new cdk.Stack(app, 'aws-cdk-firehose-delivery-stream-source-stream', { env: { region: 'us-east-1' } }); |
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.
What is the reason for picking us-east-1
specifically?
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.
There were some issues I ran into with making the api calls where it would not be able to find the resource unless the specific region was set. This was resolved when I had it run it a single region and this is also seen in some other integ tests.
|
||
const bucket = new s3.Bucket(stack, 'Bucket', { | ||
bucketName: 'firehose-delivery-stream-source-stream-bucket', |
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.
If we don't have to, I suggest not to use a hardcoded name because once someone creates a bucket with this, this test will fail to run.
I see the bucketName is referenced for integTest.assertions.awsApiCall
. I believe the integ test will auto set up the export for the bucket name, then import to the assertion stack. So we shouldn't need a hardcoded name.
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.
This is because I was seeing this error:
Error: Resolution error: Resolution error: Resolution error: Cannot use resource 'aws-cdk-firehose-delivery-stream-s3-all-properties/Bucket' in a cross-environment fashion, the resource's physical name must be explicit set or use PhysicalName.GENERATE_IF_NEEDED.
but setting PhysicalName.GENERATE_IF_NEEDED
for the resource names was not working. I can try to test it again though because I may have been dealing with multiple issues at the time when I was seeing that error.
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.
Ok tried replacing it with PhysicalName.GENERATE_IF_NEEDED
and got the same error as before.
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.
Ic. Thanks for the details. I don't think this is blocking anyways.
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.
Actually I managed to change it. It seems like it was because I had set the region specifically that it was requiring me to provide a physical name. I think the region thing was some other issue but it's no longer happening so I can remove both.
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.
Thank you for looking further into the problem!
Bucket: bucket.bucketName, | ||
MaxKeys: 1, | ||
}).expect(ExpectedResult.objectLike({ | ||
KeyCount: 1, |
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.
Should we assert that the "testData123"
data is indeed in the bucket?
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 don't think it's necessary since the bucket is empty otherwise and also the object ends up being encrypted or something so the actual object stored will be different from just the string "testData123".
totalTimeout: cdk.Duration.minutes(10), | ||
}); | ||
|
||
if (s3ApiCall instanceof AwsApiCall && s3ApiCall.waiterProvider) { |
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.
Why do we need this if
condition? I am not clear because s3ApiCall
is always assigned the same value.
Another way to ask my question: When would this if
condition evaluate to false?
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'm not sure, but this is re-used in other integ test cases like here: https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-scheduler-targets-alpha/test/integ.kinesis-data-firehose-put-record.ts#L63-L68.
The s3ApiCall
should always be an instance of AwsApiCall
and I believe it will have the waterProvider
set when you use the .waitForAssertions()
call.
Adding/updating tests should be a |
|
||
const bucket = new s3.Bucket(stack, 'Bucket', { | ||
bucketName: 'firehose-delivery-stream-source-stream-bucket', |
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.
Ic. Thanks for the details. I don't think this is blocking anyways.
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). |
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). |
This pull request has been removed from the queue for the following reason: Pull request #32560 has been dequeued. The pull request could not be merged. This could be related to an activated branch protection or ruleset rule that prevents us from merging. (detail: 4 of 6 required status checks are expected.). You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. If you want to requeue this pull request, you need to post a comment with the text: |
@Mergifyio update |
☑️ Nothing to do
|
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). |
Comments on closed issues and PRs are hard for our team to see. |
Description of changes
Add assertions to firehose and firehose-destinations integ tests.
No assertions were added to
integ.delivery-stream.ts
because the same case is being covered by theinteg.s3-bucket.lit.ts
andinteg.delviery-stream.source-stream.ts
tests.Description of how you validated changes
integ tests
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license