Skip to content

xds/balancer: Refactor usage of loadStore in clusterimpl and its picker to easily plugin a test load reporter for verifying report stats in balancer tests #8366

Open
@purnesh42H

Description

@purnesh42H

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: xDSIncludes everything xDS related, including LB policies used with xDS.Type: Internal CleanupRefactors, etc

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions