friendsofgo / killgrave

Simple way to generate mock servers written in Go
https://friendsofgo.github.io/killgrave/
MIT License
498 stars 94 forks source link

Add logging and recording of requests #170

Open tateexon opened 2 weeks ago

tateexon commented 2 weeks ago

Added two new command line arguments:

This is needed for cases when a test needs access to what is posted as a request to the mock but we don't know the exact data, like a hash that was posted but need that hash later on in the test to post to another service. We don't need the responses dumped because the test should have access to the imposters they are using and thus already have access to that data.

I think this also covers what was originally wanted in https://github.com/friendsofgo/killgrave/issues/100 but maybe not exactly how it was imagined there.

I added a few changes to the Makefile and Dockerfile to make local testing a bit easier.

I made the request writer use a channel and run in a go function so it wouldn't run into issues of multiple concurrent requests trying to write into the dump file at once.

I fully realize this could cause the dump file to get very very large if this is used incorrectly in something like a load test but I am not sure how to handle that better outside of doing some kind of rotating log. I would hope people wouldn't use it for a case like that but I don't know what all the kinds of users of the tool are. I welcome all suggestions.

tateexon commented 2 weeks ago

@joanlopez I would like your thoughts on this please!

iljapavlovs commented 1 week ago

upvote for this feature, really missing this essential feature! @joanlopez

tateexon commented 1 week ago

@aperezg @joanlopez is there anything else I need to do before this can get reviewed?

joanlopez commented 1 week ago

@aperezg @joanlopez is there anything else I need to do before this can get reviewed?

It's fine for now, @tateexon - just trying to book some time to review it carefully! Thanks! 🙇🏻

tateexon commented 1 week ago

Sounds good. I will continue with my fork for now to unblock my QA team.

tateexon commented 4 days ago

I think I have hit all the review comments so far. Anything else @asad-urrahman ? Thanks for the reviews so far!