Description
ReportLoad method
on the xDS client returns a struct, and the load store only exposes method to report load data, but not to verify the reported load data. Since, lrsclient PerClusterReporter
is not an interface that we can implement for grpc tests, implementing entire LRS implementation is not possible currently.
The picker in clusterImpl has a wrapper for loadStore of type loadReporter which is an interface https://github.com/purnesh42H/grpc-go/blob/generic-xds-client-migrate-internal-e2e/xds/internal/balancer/clusterimpl/picker.go#L86. ClusterImpl sets this field to a wrapper that uses lrsclient.LoadStore to report stats. So, we override the picker's loadStore in our tests (xds/balancer/clusterimpl/balancer_test.go) with the test loadReporter that allows us to count and fetch stats but the underneath lrsclient.LoadStore
is unused after override. Also, we are only able to override in picker but not in clusterimpl which is still using the original load store.
We should simplify the clusterimpl and picker logic to be able to use a load store wrapper that can be overriden in the test throughout.