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 :clean record mode for cleaning unused HTTP interactions from cassettes #888

Closed
wants to merge 2 commits into from

Conversation

bazay
Copy link

@bazay bazay commented May 26, 2021

Adds a new record mode :clean to actively check for unused HTTP interactions and automatically removes them from existing cassettes.
This helps reduce cassette file size as well as provide a clear picture of actual requests being made for a cassette.

Caveats

  • Clears unused HTTP interactions in a cassette file. This may have unintended consequences for cassette files used by a number of different examples but only use a subset of the HTTP interactions.

Additional Notes

  • This feature works similarly to the configuration option clean_outdated_http_interactions however that requires re_record_interval which will have the result of clearing used http interactions that might be old but still valid.

bazay added 2 commits May 26, 2021 15:37
Adds a new record mode :clean to actively check for unused HTTP interactions and automatically removes them from existing cassettes.
This helps reduce cassette file size as well as provide a clear picture of actual requests being made for a cassette.
There is a caveat to clean mode where a single cassette file may contain multiple HTTP interactions
for different specs where such specs may only use a subset of HTTP interactions contained within
that particular cassette. This will cause such specs to fail when running in :none record mode so
it's better to warn the user that their specs will continue to fail if the 'allow_unused_http_interactions'
config value is set to 'false'.

The developer can then take steps to create separate cassettes for specs using different HTTP interactions
to ensure 'allow_unused_http_interactions' validation can be satisfied.
@bazay bazay changed the title Add record mode for cleaning unused HTTP interactions from cassettes Add :clean record mode for cleaning unused HTTP interactions from cassettes May 27, 2021
@ryanseys
Copy link
Contributor

#946 is now merged which implements this functionality, albeit a different approach.

Not yet released, but we can likely close this.

@bazay
Copy link
Author

bazay commented Nov 14, 2022

@ryanseys thanks for notifying. Great to have this functionality either way 👍

@bazay bazay closed this Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants