-
Notifications
You must be signed in to change notification settings - Fork 153
improv(tests): adopt aws cdk cli lib #1633
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
Conversation
Integration test, using the new module, ran successfully: https://github.com/aws-powertools/powertools-lambda-typescript/actions/runs/5682665966 |
Also, SonarCloud is going to most probably bring up a ton of findings because the PR touches many existing files that have a lot of code. I will happily address any finding on the newly added code ( |
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! The new cli interface looks clean and we finally have a dedicated place for the testing lib.
I have left only one small comment.
I agree, let's address the changes in a dedicated PR. |
SonarCloud Quality Gate failed.
|
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.
🚀
Description of your changes
This PR introduces a new
testing
utility that at the moment contains only a new class calledTestStack
. This class is a simple wrapper around the@aws-cdk/cli-lib-alpha
module and provides only the minimum amount of methods needed to synth, deploy, and destroy a CDK Stack.This driver behind this change, as detailed in the linked issue, stems from the reliance of our current integration/e2e tests on an internal CDK command line which has changed in a recent release and thus has locked us out of newer and patched versions of CDK.
Since our first implementation of the integration tests over a year ago, CDK has released a new package (
@aws-cdk/cli-lib-alpha
) that allows to interact with the CLI programmatically, and that can replace our current implementation. Even though the package is in alpha, we consider this still to be an improvement over reliance on internal API, and we hope that through our usage we can help shape the package.As mentioned above, this is the second PR that tries to apply this change. The previous PR was much larger in scope and in addition to introducing the new CLI wrapper, it also added a ton of new utilities. After discussing internally we have however decided to leave these changes out and work on a RFC before attempting to implement them.
The changes in this PR constitute a stop-gap solution that allows us to move away from the internal CDK API and access current versions of CDK. Once the RFC mentioned will be out and discussed, I am open to decommission the changes introduced this PR in favor of a more solid implementation.
While working on the PR I prioritized keeping changes in the codebase as low as possible, even though there are several areas (i.e. standard resource factories) that could have resulted in a more streamlined implementation.
Detailed list of changes:
aws-cdk
-related (i.e.http-proxy
,vm2
, etc.) dependencies from the projectcdk-cli
util fromcommons
[1]aws-cdk-lib
as dependency scoped to the testing moduleaws-cdk
&aws-cdk-lib
as scoped dependencies to the layers package [2]tracer
e2e tests to use the new package + added the new package asdevDependency
logger
e2e tests to use the new package + added the new package asdevDependency
metrics
e2e tests to use the new package + added the new package asdevDependency
idempotency
e2e tests to use the new package + added the new package asdevDependency
parameters
e2e tests to use the new package + added the new package asdevDependency
layers
e2e tests to use the new package + added the new package asdevDependency
[3]Notes:
[1] This was an internal module that was never published to npm, so I don't think it constitutes a breaking change
[2] Since the CLI is used as an actual CLI in the CI for this package, we don't need the additional dependencies and we are not relying on any internal
[3] The diff here is slightly higher compared to the other packages because this e2e test deploys two CDK apps/stacks
Related issues, RFCs
Issue number: #1623
Checklist
Breaking change checklist
Is it a breaking change?: NO
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.