Giter Site home page Giter Site logo

go-replayers's Introduction

Build Status godoc Go Report Card

Go Tools for Recording and Replaying RPCs

This repo contains two tools for testing network clients by recording real interactions with servers, then playing back the server responses later. These record/replay proxies let you run an "integration" test that accesses a backend and record the interaction. Subsequent runs of the test can replay the server's responses without actually contacting the server, turning the integration test into a fast and inexpensive unit test.

To use a record/replay proxy:

  1. Write a test that interacts with an actual backend.
  2. Run the test using the proxy in record mode. The result will be a file of client-server interactions.
  3. Run the test again using the proxy in replay mode, pointing at the recorded file. The proxy accepts requests and replays the matching server responses.

httpreplay

The httpreplay proxy works with HTTP traffic. You can use the httpreplay package directly from Go code, or you can run the httpr command at httpreplay/cmd/httpr and use a client written in any language.

grpcreplay

The grpcreplay package works with gRPC traffic. There is no corresponding command.

go-replayers's People

Contributors

daulet avatar jba avatar nafisfaysal avatar phaus avatar pravinchandar avatar vangent avatar wyattanderson avatar zchee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-replayers's Issues

FR: httpr better support for process shutdown on Windows

On Windows it is impossible to flush the recording to disk when not in the same terminal. For example, Stop-Process -Name "..." causes the immediate termination of httpr whereas the same command sent to mitmdump (part of mitmproxy) allows it to perform flushing actions.

Perhaps an easier solution is to add a flag to immediately write requests to disk

Binding to :<port> causing warning on macOS

πŸ‘‹ @jba,

Binding to a port without a host will cause the following warning if the binary is not codesigned on macOS:

Screen Shot 2020-04-30 at 6 01 21 PM

I’m not certain whether it’s possible to specify the host anywhere, but it would be nice to not have the warning pop up in tests that are using this (anecdotally, clicking β€œDeny” has no negative effect on the test 🀷).

Support for Compute Service?

I have seen that in the test files you use storage tool for GCP. I am trying to test Compute Service but I can't find a way. Is it possible? Or FullScopeControl is a must?

Troubleshooting "request not found" error

I followed the examples in the documentation and successfully recorded my grpc request. However, when I tried to replay the .replay file by sending the exact same request, I received a replayer: request not found: message_id:"test" message_body:"test" error. What is the best way to troubleshoot this, and how can I open the .replay file to check what was recorded?

Option to take `fs.FS` for `NewReplayer`

The httpreplay.Replayer should have a New function that can take an fs.FS. This way it can be used with normal files, or it can be used with an embed.FS which would be helpful for unit testing. That is, the replay file can be embedded into application and a Replayer can be built with that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.