7

go-vcr v3

 2 years ago
source link: http://dnaeon.github.io/go-vcr-v3/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

go-vcr v3

A new version of go-vcr has been released today.

With v3 of go-vcr some long standing issues have been fixed, the API has been cleaned up, and additional utility methods for introspecting the recorder have been added.

NOTE: This release is not backwards-compatible with previous versions of the cassettes used by go-vcr. If you are upgrading to v3 you should re-create your test cassettes.

A summary of changes for this release:

  • API has been refactored and cleaned up
  • Custom recorder options are now specified as recorder.Options
  • The recorder modes which are now supported are ModeRecordOnly, ModeRecordOnce, ModeReplayOnly, ModeReplayWithNewEpisodes and ModePassthrough. Please refer to the API documentation for more details on their use cases
  • In order to create recorders with custom options you should use the recorder.NewWithOptions function from now on
  • The default mode of the recorder is now ModeRecordOnce
  • ModeDisabled has been removed and is now replaced by ModePassthrough
  • Cassette format has been changed and the supported version of the cassette from now on is v2.
  • Additional fields have been added to the cassette to allow developers to create more complex matchers based on the existing fields
  • Each interaction in the cassette now has a unique integer id, specifying the position of the interaction in the cassette
  • Utility method on the recorder can now return a pre-configured HTTP client with the recorder’s transport - GetDefaultClient()
  • CI/CD pipeline has been transferred to Github actions
  • Closed out some long standing issues
  • Extended and refactored test cases

Make sure to check the v3 examples and included test cases for examples on the new API and usage.

Written on August 19, 2022

Recommend

  • 2
    • blog.arkency.com 3 years ago
    • Cache

    3 tips to tune your VCR in tests

    In this post I describe 3 things that have grown my trust in VCR. These are: decompressing stored responses not allowing unused mocks disabling VCR where not explicitly needed Read on...

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK