Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use InProcessServerBuilder for testing #213

Open
asarkar opened this issue Aug 31, 2020 · 5 comments
Open

Use InProcessServerBuilder for testing #213

asarkar opened this issue Aug 31, 2020 · 5 comments

Comments

@asarkar
Copy link

asarkar commented Aug 31, 2020

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.

@jntakpe
Copy link
Contributor

jntakpe commented Sep 1, 2020

Actually I struggled with that, indeed it'd be nice if the framework manages a proper way to mock Grpc services

@asarkar
Copy link
Author

asarkar commented Sep 1, 2020

grpc-spring-boot-starter does this using a property.

@asarkar
Copy link
Author

asarkar commented Nov 17, 2020

@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?

@graemerocher
Copy link
Contributor

Seems reasonable

@outlndrr
Copy link

outlndrr commented Oct 2, 2024

Any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants