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: improve localstack test performance #184
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,8 @@ export const clientConfig = { | |
|
||
const CF = new CloudFormation(clientConfig); | ||
|
||
// Inspiration for the current approach: https://github.com/aws/aws-cdk/pull/18667#issuecomment-1075348390 | ||
// Writeup on performance improvements: https://github.com/functionless/functionless/pull/184#issuecomment-1144767427 | ||
export const deployStack = async (app: App, stack: Stack) => { | ||
const cloudAssembly = await asyncSynth(app); | ||
|
||
|
@@ -42,15 +44,10 @@ export const deployStack = async (app: App, stack: Stack) => { | |
sdkProvider, | ||
}); | ||
|
||
const assembly = new cxapi.CloudAssembly(cloudAssembly.directory); | ||
const stackArtifact = cxapi.CloudFormationStackArtifact.fromManifest( | ||
assembly, | ||
stack.artifactId, | ||
cloudAssembly.getStackArtifact(stack.artifactId).manifest | ||
) as cxapi.CloudFormationStackArtifact; | ||
|
||
await cfn.deployStack({ | ||
stack: stackArtifact, | ||
stack: cloudAssembly.getStackArtifact( | ||
stack.artifactId | ||
) as unknown as cxapi.CloudFormationStackArtifact, | ||
Comment on lines
+48
to
+50
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How does this work? What is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cloud assembly is what CDK calls the output of a stack synth. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Original inspiration: aws/aws-cdk#18667 (comment) |
||
force: true, | ||
}); | ||
}; | ||
|
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 the problem that localstack uses CDK 1.x ?
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.
Nah, there is no localstack here (except for SDK props hack above). This is all CDK.
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.
right but presumably we only do this to meet localstacks expected CDK 1.x input?
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.
Ohh, no, cdk is running locally and localstack only sees the cfn. This is all because CDK doesn't support (aka makes it hard as fuck) to synth and deploy programmatically.