aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.62k stars 3.91k forks source link

(integ-runner): (Snapshot serializer to ignore certain fields) #31299

Open webratz opened 1 month ago

webratz commented 1 month ago

Describe the feature

The snapshots created by the integ-runner contain the full templates. There is certain fields that are changing (eg. tags, stack metadata, asset ids) that should not trigger a new test. In normal snapshots tests we use for example https://github.com/hupe1980/jest-cdk-snapshot to avoid adding these volatile fields to the snapshot, but I have found no way to do the same for integration tests.

Use Case

This feature would help us to avoid unneccessary re-runs of integration stacks for unrelated changes.

Proposed Solution

There already seems to be some logic for the template. A way to hook into that, or extending it, to cover use cases like ignoring metadata, assets or tags.

Other Information

No response

Acknowledgements

CDK version used

2.153

Environment details (OS name and version, etc.)

debian - unrelevant

pahud commented 1 month ago

There is certain fields that are changing (eg. tags, stack metadata, asset ids) that should not trigger a new test.

Yes I basically agree with you on this point. Feel free to submit your PR and the team would take a look when it's ready. Thank you.

webratz commented 1 month ago

Do you have any guidance on where would be a good place to implement this? Probably makes sense to briefly align on the basic structure before I have a closer look into this