go-vcr icon indicating copy to clipboard operation
go-vcr copied to clipboard

[recorder] add option to load cassette from embed.Fs

Open johnshiver opened this issue 3 years ago • 2 comments

Describe your changes

I want a way to load fixtures from an embedded filesystem, so I can use the recorder for my integration tests but also to create fakes that I use while my process is running (development / sandbox mode / etc)

This PR adds an option to create a recorder with an embedded filesystem, and if set optionally loads the cassette from it.

I didn't spend much time making the code nice, it is a little messy for my taste but it does work. If there is support for the idea Im happy to make any adjustments necessary to get the PR merged.

Checklist before requesting a review

tests pass

johnshiver avatar Mar 07 '23 22:03 johnshiver

Hey @johnshiver ,

Thanks for the PR! I'll try to review it tomorrow and provide some feedback. Thanks again!

dnaeon avatar Mar 08 '23 18:03 dnaeon

Codecov Report

Merging #83 (0d189b6) into v3 (035acaf) will decrease coverage by 4.08%. The diff coverage is 48.43%.

:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##               v3      #83      +/-   ##
==========================================
- Coverage   77.69%   73.61%   -4.08%     
==========================================
  Files           1        1              
  Lines         278      326      +48     
==========================================
+ Hits          216      240      +24     
- Misses         48       72      +24     
  Partials       14       14              
Impacted Files Coverage Δ
recorder/recorder.go 73.61% <48.43%> (-4.08%) :arrow_down:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov-commenter avatar Mar 08 '23 19:03 codecov-commenter