Fadelis / grpcmock

A gRPC Java testing tool to easily mock endpoints of gRPC services for IT or Unit testing
http://grpcmock.org
Apache License 2.0
144 stars 13 forks source link

Failed to start gRPC mock server #12

Closed jduan-highnote closed 2 years ago

jduan-highnote commented 2 years ago

We have lots of tests that start gRPC mock servers. Even though they all set the port to 0 so a random port is selected, there's still a chance that two tests try to use the same random port. See the screenshot below.

Is there a way to configure the mock server so it retries a few times when seeing such an error? Thanks!

Cursor_and_Build_Scan™_for__platform-bennet__on_Jan_31_2022_at_8_07_53_PM_PST___Gradle_Enterprise
Fadelis commented 2 years ago

Currently there's no such feature. Do you create so many gRPC mock servers for unit or it testing? Since if it's for unit testing you might want to try using InProcessGrpcMockExtension

jduan-highnote commented 2 years ago

Thanks for your quick response! I'll give the InProcessGrpcMockExtension a try. I might also add retries when the server fails to bind to a port.

Fadelis commented 2 years ago

Closing, since there's no further discussions.