Skip to content

chore(toolkit-lib): use pre-built cdk.out fixtures in deploy and diff tests for speed#1301

Merged
mrgrain merged 1 commit intomainfrom
mrgrain/perf/toolkit-lib/use-cdk-out-fixtures-in-tests
Apr 2, 2026
Merged

chore(toolkit-lib): use pre-built cdk.out fixtures in deploy and diff tests for speed#1301
mrgrain merged 1 commit intomainfrom
mrgrain/perf/toolkit-lib/use-cdk-out-fixtures-in-tests

Conversation

@mrgrain
Copy link
Copy Markdown
Contributor

@mrgrain mrgrain commented Apr 1, 2026

Speeds up deploy.test.ts and diff.test.ts by eliminating ~34 redundant CDK app syntheses per test run.

Each builderFixture call was running a full synthesis through fromAssemblyBuilder, loading aws-cdk-lib modules, creating temp directories, acquiring file locks, and resolving the default AWS environment. None of these tests actually test synthesis — they only care about the resulting CloudFormation templates and manifest metadata.

All builderFixture calls are replaced with cdkOutFixture, which reads pre-built cdk.out directories from disk via fromAssemblyDirectory. A new gen-fixture projen task and script (scripts/gen-fixture-cdk-out.ts) are added to generate and regenerate these fixtures using Toolkit.fromAssemblyBuilder, ensuring the output is identical to what the tests were previously synthesizing at runtime.


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 Apr 1, 2026
@mrgrain mrgrain changed the title perf(toolkit-lib): use pre-built cdk.out fixtures in deploy and diff tests chore(toolkit-lib): use pre-built cdk.out fixtures in deploy and diff tests Apr 1, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

Total lines changed 4012 is greater than 1000. Please consider breaking this PR down.

@mrgrain mrgrain marked this pull request as ready for review April 1, 2026 12:42
@mrgrain mrgrain added the pr/exempt-size-check Skips PR size check label Apr 1, 2026
@aws-cdk-automation aws-cdk-automation requested a review from a team April 1, 2026 12:42
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.20%. Comparing base (ae062a9) to head (33426cf).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1301   +/-   ##
=======================================
  Coverage   88.19%   88.20%           
=======================================
  Files          73       73           
  Lines       10386    10386           
  Branches     1410     1409    -1     
=======================================
+ Hits         9160     9161    +1     
+ Misses       1199     1198    -1     
  Partials       27       27           
Flag Coverage Δ
suite.unit 88.20% <ø> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p2 pr/exempt-size-check Skips PR size check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants