benchttp / engine

Benchttp library in Go to run performance tests on HTTP endpoints.
Other
4 stars 1 forks source link

feat: use free port #38

Closed moreirathomas closed 2 years ago

moreirathomas commented 2 years ago

Description

Resolves the related issue by implementing the first solution suggested there. The child process (engine) finds any free port and notifies its parent of the one it found.

This allows for quicker port finding by simply asking the os (see below) instead of trying within a range and locking the port in the parent process until the child is ready to be spawned.

Finding a free port is done by asking the os for port "0", which the os interprets as "use any available port".

Pass the command line flag --auto-port=false to disable free port finding and instead use the port defined in .env.development.

Changes

Notes

Resolves benchttp/desktop#6

GregoryAlbouy commented 2 years ago

Oh sorry last suggestion: could we rename any-port to auto-port and default it to false?

Up to you for the final choice on both suggestions, else you can merge directly.

moreirathomas commented 2 years ago

Oh sorry last suggestion: could we rename any-port to auto-port and default it to false?

Up to you for the final choice on both suggestions, else you can merge directly.

I did the renaming because I agree it is more explicit, however I chose to keep the default to true because it is how it is meant to be use in its default usecase.

I will merge as soon as the review is green :)

GregoryAlbouy commented 2 years ago

I chose to keep the default to true because it is how it is meant to be use in its default usecase.

It's the default usage by the desktop app, but considering the server as a standalone it makes a bit more sense to me to use the most basic features by default 🙂