X Tutup
The Wayback Machine - https://web.archive.org/web/20231223214200/https://github.com/localstack/localstack/pull/9775
Skip to content
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

Add option to capture raw snapshots when running tests #9775

Merged
merged 1 commit into from Dec 1, 2023

Conversation

dominikschubert
Copy link
Member

@dominikschubert dominikschubert commented Nov 29, 2023

Motivation

A useful util for debugging snapshots. RAW snapshots are the RAW untransformed recorded content . In contrast to normal snapshots these should not be committed (see gitignore) and should only be used for debugging & exploration purposes.

Changes

  • Introduces RAW snapshot mode: Set SNAPSHOT_RAW=1 or use the CLI argument --snapshot-raw to enable this mode. When enabled it will save a separate JSON file next to the normal snapshots with the "raw", i.e. untransformed recorded contents.

Testing

Set SNAPSHOT_RAW=1 and execute a snapshot test

@dominikschubert dominikschubert self-assigned this Nov 29, 2023
@dominikschubert dominikschubert added the semver: patch Non-breaking bugfix PR which can be contained in patch releases label Nov 29, 2023
@coveralls
Copy link

Coverage Status

coverage: 84.137% (-0.02%) from 84.153%
when pulling e249a0e on snapshot-raw
into 23127d8 on master.

Copy link
Contributor

@bentsku bentsku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! I think this is a nice addition that can be really helpful when debugging snapshots and trying to understand why some parts are different, or why some transformers are not behaving like we expect them too.

It still marked as POC, but I'd up for merging this as is, as it's only opt-in and a nice tool.

It's also very nice that it keeps the ResponseMetadata, as sometimes some headers are not parsed/in the specs so we can quickly see if boto is missing something.

I now see what you meant with saving raw LocalStack snapshots too, to be able to full compare them. Maybe this would be a good addition 🤔

@dominikschubert dominikschubert marked this pull request as ready for review November 29, 2023 22:13
@dominikschubert dominikschubert changed the title POC: Raw snapshots Add option to capture raw snapshot mode when running tests Nov 29, 2023
@dominikschubert dominikschubert changed the title Add option to capture raw snapshot mode when running tests Add option to capture raw snapshots when running tests Nov 29, 2023
Copy link

LocalStack Community integration with Pro

       2 files         2 suites   1h 8m 50s ⏱️
2 372 tests 2 058 ✔️ 314 💤 0
2 373 runs  2 058 ✔️ 315 💤 0

Results for commit e249a0e.

@dominikschubert dominikschubert merged commit b4723ce into master Dec 1, 2023
34 of 35 checks passed
@dominikschubert dominikschubert deleted the snapshot-raw branch December 1, 2023 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: patch Non-breaking bugfix PR which can be contained in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants
X Tutup