Repository navigation
feat(integ-runner): unstable resolved-snapshots writes each deployed stack's resolved template to the snapshot - #2087
Draft
iankhou wants to merge 1 commit into
Conversation
1 task
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## feat/toolkit-lib-evaluate-action #2087 +/- ##
====================================================================
- Coverage 92.11% 92.07% -0.04%
====================================================================
Files 82 82
Lines 13194 13194
Branches 1879 1878 -1
====================================================================
- Hits 12153 12149 -4
- Misses 1003 1007 +4
Partials 38 38
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…stack's resolved template to the snapshot
With `--unstable=resolved-snapshots`, after a test case is deployed and before it is destroyed, integ-runner
evaluates the test stacks with toolkit-lib's evaluate action and writes `<stackName>.resolved.json` next to
the stack's template in the snapshot directory.
The resolved template is normalized so it is the same for every deployment of the test: generated physical
ids (and the names inside URL/ARN ids and the generated parts of composite ids) become `${LogicalId}`,
`${LogicalId.Name}` and `${LogicalId[n]}`, and the stack id, account, region and partition become pseudo
parameter placeholders. Names the template chooses itself are kept.
iankhou
force-pushed
the
feat/integ-runner-resolved-snapshots
branch
from
October 23, 2026 17:42
f5da9ba to
ad2314c
Compare
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reason for this change
An integ test's snapshot records the synthesized template, but not what was actually deployed: parameter and SSM values, conditions,
Fn::If, references and attributes are only known after deployment. To check deployed resources against their intended configuration (for example in an AWS service emulator), we need that ground truth stored with each integ test.Stack (review the earlier ones first):
evaluateaction (now also returns each stack's id and physical resource ids)Description of changes
New unstable feature
--unstable=resolved-snapshots. When enabled, after a test case's stacks are deployed and before they are destroyed, integ-runner evaluates the test stacks with toolkit-lib'sevaluateaction and writes<stackName>.resolved.jsoninto the snapshot directory, next to<stackName>.template.json. The assertion stack is not evaluated.The file holds the evaluated
ResourcesandOutputs, the expressions that could not be evaluated, resources with account-wide settings (AWS::ApiGateway::Account), and nested stacks. It is normalized so it is the same for every deployment of the test, in any account or region:${LogicalId}; the name at the end of a URL or ARN physical id becomes${LogicalId.Name}(e.g. a queue's name), and the generated parts of|-separated ids become${LogicalId[n]}${AWS::StackId},${AWS::AccountId},${AWS::Region}and${AWS::Partition}(taken from the stack id, no extra calls)StageName: prod) are keptExample (a Lambda function and an alarm on an SQS queue):
The files are written after the snapshot is synthesized, which replaces the snapshot directory; a snapshot updated without deploying therefore drops them rather than leaving stale ones. Snapshot verification compares only the stack templates, so the files don't affect it.
Other changes:
ICdkgets anevaluatemethod, implemented by the toolkit-lib engine (which enables toolkit-lib's unstableevaluatefeature), andCdkTestApp.evaluate.Known limitations (follow-ups)
RootResourceIdused as aParentId, are not normalized yet. The fix is forevaluateto report which expression produced each value, so the normalizer can put the expression back.Describe any new or updated permissions being added
None beyond what
evaluatereads:cloudformation:DescribeStacks,cloudformation:ListStackResources,cloudformation:GetTemplate, and Cloud ControlGetResourcefor attributes it cannot derive.Description of how you validated changes
.resolved.jsonfiles.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license