-
Notifications
You must be signed in to change notification settings - Fork 150
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
test(all): move e2e tests to cdk v2 #676
Conversation
9ad3353
to
8e71980
Compare
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 great @flochaz, super excited about this PR. It has been a long time coming :)
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 Florian for the PR!
/* eslint-disable @typescript-eslint/ban-ts-comment */ | ||
/* eslint-disable @typescript-eslint/explicit-function-return-type */ | ||
/* eslint-disable @typescript-eslint/member-ordering */ | ||
/* eslint-disable @typescript-eslint/explicit-member-accessibility */ | ||
/* eslint-disable @typescript-eslint/member-delimiter-style */ | ||
/* eslint-disable newline-before-return */ | ||
/* eslint-disable func-style */ |
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.
Suggestion: rather than adding this list of linting exceptions what about addressing opportunities for improving our linting rules in a separated space/issue?
Interesting article:
https://stackoverflow.blog/2020/07/20/linters-arent-in-your-way-theyre-on-your-side/
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 went through these rules and I think they are fine as it is for global level.
This file is only exceptional since it's duplicated from an other project. I prefer to just disable lint in this file and keep it exactly as it is for ease of maintenance.
@@ -0,0 +1,223 @@ | |||
// This file is duplicating CloudFormationDeployments define in https://github.com/aws/aws-cdk/blob/master/packages/aws-cdk/lib/api/cloudformation-deployments.ts |
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.
Minor: since a branch version's may mutate, referring to a commit rather than a branch will make sure the link will work in the future
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 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 assume that there is no change here? Do we do this to expose a private class?
@@ -0,0 +1,223 @@ | |||
// This file is duplicating CloudFormationDeployments define in https://github.com/aws/aws-cdk/blob/master/packages/aws-cdk/lib/api/cloudformation-deployments.ts |
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.
Nit:
// This file is duplicating CloudFormationDeployments define in https://github.com/aws/aws-cdk/blob/master/packages/aws-cdk/lib/api/cloudformation-deployments.ts | |
// This file is duplicating CloudFormationDeployments defined in https://github.com/aws/aws-cdk/blob/master/packages/aws-cdk/lib/api/cloudformation-deployments.ts |
packages/commons/tsconfig.json
Outdated
@@ -12,6 +12,7 @@ | |||
"inlineSourceMap": true, | |||
"moduleResolution": "node", | |||
"resolveJsonModule": true, | |||
"useUnknownInCatchVariables": 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.
According to the documentation:
This pattern ensures that error handling code becomes more comprehensive because you cannot guarantee that the object being thrown is a Error subclass ahead of time.
What is the benefit of this approach instead of explicitly checking the types of the Errors? Example:
try {
// something
} catch (e: unknown) {
if (err instanceof Error) {
// something
}
}
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.
Apart from Sara's comment, I'm ok with this change.
Duplicating a class to make it public concerns me on the maintenance effort.
But I think that this is a better option than calling subprocess.run('cdk')
. We need to keep an eye on this and see how often it breaks. (vs. the effort to implement a robust call to cdk
)
@@ -0,0 +1,223 @@ | |||
// This file is duplicating CloudFormationDeployments define in https://github.com/aws/aws-cdk/blob/master/packages/aws-cdk/lib/api/cloudformation-deployments.ts |
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 assume that there is no change here? Do we do this to expose a private class?
/* eslint-disable @typescript-eslint/ban-ts-comment */ | ||
/* eslint-disable @typescript-eslint/explicit-function-return-type */ | ||
/* eslint-disable @typescript-eslint/member-ordering */ | ||
/* eslint-disable @typescript-eslint/explicit-member-accessibility */ | ||
/* eslint-disable @typescript-eslint/member-delimiter-style */ | ||
/* eslint-disable newline-before-return */ | ||
/* eslint-disable func-style */ |
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 went through these rules and I think they are fine as it is for global level.
This file is only exceptional since it's duplicated from an other project. I prefer to just disable lint in this file and keep it exactly as it is for ease of maintenance.
Moving to @Tanemahuta implementation suggested here aws/aws-cdk#18667 (comment) ... so much easier |
8e71980
to
17847e1
Compare
17847e1
to
1e1bcbc
Compare
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 much nicer than the other version. The abstraction is very beautiful.
From what I see, the only risk is that the cx-api
is changed (for synthesizing the stack artifact).
I doubt if they’ll change CloudFormationDeployments
, SdkProvider
, and DeployStackResult
soon.
@@ -59,9 +59,9 @@ | |||
"@typescript-eslint/eslint-plugin": "^5.12.1", | |||
"@typescript-eslint/parser": "^5.12.1", | |||
"archiver": "^5.3.0", |
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.
Is this still needed? I think it's used by cdk to create the asset archives but just checking.
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.
indeed might not be needed. will merge that one to let @ijemmy work and give it a try through another PR
Description of your changes
Move all end to end test to cdk v2.
Details
[OUTDATED] Details
Thanks to @3p3r work and especially this line https://github.com/3p3r/cdk-web/blob/main/cdk-web.webpack.config.js#L132 I've been able to isolate the needed work around to aws/aws-cdk#18211 issue by duplicating CloudFormationDeployments class and rewrite isAssetManifestArtifact function to
How to verify this change
https://github.com/awslabs/aws-lambda-powertools-typescript/actions/runs/2026670475
Related issues, RFCs
aws/aws-cdk#18211
PR status
Is this ready for review?: NO
Is it a breaking change?: NO
Checklist
Breaking change checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.