grpc-go
grpc-go copied to clipboard
Add test for custom xDS resource subscription
It seems we have missing test coverage due to the failure in internal bug b/427286972. We should make sure we have proper coverage here.
The xDS client accepts a list of supported resource types as part of its configuration at creation time here: https://github.com/grpc/grpc-go/blob/e8167363406cc5a2da7befab1bfc5e4c21bdd264/internal/xds/clients/xdsclient/xdsconfig.go#L60
We need a simple test where
- We define a custom xDS resource type implementation
- Create an xDS client with the above resource type implementation in the configuration passed to it
- Configure a resource of this type in the management server
- Create a watch for the above resource type from the xDS client
- Verify that the resource can be successfully parsed and the update is returned to the watcher
We would also need to have tests for error cases, where resource parsing fails.