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

chore(kinesisfirehose-alpha): refactor integ tests with assertions #32560

Merged
merged 4 commits into from
Dec 18, 2024

Conversation

paulhcsun
Copy link
Contributor

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 the integ.s3-bucket.lit.ts and integ.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

@github-actions github-actions bot added the p2 label Dec 18, 2024
@aws-cdk-automation aws-cdk-automation requested a review from a team December 18, 2024 01:14
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Dec 18, 2024
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a 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.

@paulhcsun paulhcsun added the pr-linter/exempt-readme The PR linter will not require README changes label Dec 18, 2024
@aws-cdk-automation aws-cdk-automation dismissed their stale review December 18, 2024 01:18

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

Copy link

codecov bot commented Dec 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.86%. Comparing base (2d1e718) to head (3e450bd).

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           
Flag Coverage Δ
suite.unit 78.86% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
packages/aws-cdk 78.86% <ø> (ø)

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Dec 18, 2024

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' } });
Copy link
Contributor

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?

Copy link
Contributor Author

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',
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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,
Copy link
Contributor

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?

Copy link
Contributor Author

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) {
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Dec 18, 2024
@samson-keung
Copy link
Contributor

Adding/updating tests should be a chore instead of feat I think?

@paulhcsun paulhcsun changed the title feat(kinesisfirehose-alpha): refactor integ tests with assertions chore(kinesisfirehose-alpha): refactor integ tests with assertions Dec 18, 2024
@paulhcsun paulhcsun removed the pr-linter/exempt-readme The PR linter will not require README changes label Dec 18, 2024

const bucket = new s3.Bucket(stack, 'Bucket', {
bucketName: 'firehose-delivery-stream-source-stream-bucket',
Copy link
Contributor

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.

Copy link
Contributor

mergify bot commented Dec 18, 2024

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).

Copy link
Contributor

mergify bot commented Dec 18, 2024

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).

Copy link
Contributor

mergify bot commented Dec 18, 2024

This pull request has been removed from the queue for the following reason: pull request dequeued.

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 requeue

@paulhcsun
Copy link
Contributor Author

@Mergifyio update

Copy link
Contributor

mergify bot commented Dec 18, 2024

update

☑️ Nothing to do

  • #commits-behind > 0 [📌 update requirement]
  • -closed [📌 update requirement]
  • -conflict [📌 update requirement]
  • queue-position = -1 [📌 update requirement]

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 3e450bd
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link
Contributor

mergify bot commented Dec 18, 2024

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).

@mergify mergify bot merged commit 1bbab84 into aws:main Dec 18, 2024
19 checks passed
Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
contribution/core This is a PR that came from AWS. p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants