Unit testing gRPC client/server with xDS?
See original GitHub issueš,
PR #7620 (issue #7605) introduced the io.grpc.xds.bootstrap
property as an alternative to the GRPC_XDS_BOOTSTRAP
env var. This makes it possible to programmatically provide the xDS config (i.e. via System.setProperty
). However, it by no means make it simple to unit test client/servers using xDS.
I see a need for unit tests with a transient xDS server running as part of the test (i.e. io.envoyproxy.controlplane:java-control-plane
or similar) to allow clients to discover a server via xDS, all within a unit test.
While this works in single test isolation having multiple such tests running in parallell seems problematic given that these test then either need to use the same bootstrap config and thus the same host:port
for xDS across all tests or risk concurrency issues when multiple tests want to use their own bootstrap config and point to it using System.setProperty
.
Does my reasoning make sense or am I coming at this the wrong way? Is there an approach on how to unit test gRPC with xDS that I simply missed?
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (10 by maintainers)
Top GitHub Comments
Weāve come to agreement. Java and Go will allow you to inject the bootstrap into a new XdsNameResolver instance and have the user register it. C core will have a channel argument for passing in the bootstrap. It is unspecified and an implementation decision whether XdsClients will be shared between channels.
More concretely for Java, something like
I honestly donāt know if we want to put the method on XdsNameResolverProvider or somewhere else.
This hasnāt been forgotten about. We have a potential solution but it is making C nervous and they want more time to find alternatives. Thatās been dragging on because thereās been limited āfreeā time, but at this point weāve afforded them two additional weeks to try to come up with alternative ideas. Weāll default to the current approach that has been cooking if nothing comes from that.