Skip to content

Conversation

@jsoriano
Copy link
Member

@jsoriano jsoriano commented Nov 27, 2023

We record requests in some tests so we can reproduce them without having running services.

We use our own framework now, that has some limitations. It can only record GET requests, and
it can only record one response for any request, so it cannot be used for tests where the state changes.

Give a try to https://pkg.go.dev/gopkg.in/dnaeon/go-vcr.v3 for this purpose.

With go-vcr, each session is stored in a file, called "cassette", that stores the sequence of interactions. By
default it matches requests per method and per URL, and each interaction is only matched once, so multiple
requests to the same endpoint can be recorded with different responses. This seems to be enough for
all the cases we have now.

@jsoriano jsoriano requested a review from a team November 27, 2023 19:58
@jsoriano jsoriano marked this pull request as ready for review November 27, 2023 20:02
@jsoriano
Copy link
Member Author

/test

Copy link
Contributor

@mrodm mrodm left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks!

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @jsoriano

@jsoriano jsoriano merged commit a4eca5e into elastic:main Nov 28, 2023
@jsoriano jsoriano deleted the record-with-vcr branch November 28, 2023 12:03
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.

3 participants