micronaut-grpc
micronaut-grpc copied to clipboard
Use InProcessServerBuilder for testing
Micronaut gRPC creates a NettyServerBuilder
automatically. How do I use an InProcessServerBuilder for testing?
One way is to set grpc.server.enabled=false
, and then create the Server
myself.
Server server = InProcessServerBuilder.forName(uniqueName)
.directExecutor()
.addService(new MyService())
.build().start();
But then, I've to start and stop it. It'd be nice to have the framework manage it on my behalf instead.
Actually I struggled with that, indeed it'd be nice if the framework manages a proper way to mock Grpc services
grpc-spring-boot-starter does this using a property.
@graemerocher I'm willing to submit PR for this, but there will have to be internal design changes. I looked at the code, and it assumes NettyServerBuilder
. I'm thinking something like shown in this ticket, so that the builder can be configured using external properties.
Do you've any thoughts on this?
Seems reasonable
Any updates on this?