MCPcopy
hub / github.com/grpc/grpc-go / clusterWithLBConfiguration

Function clusterWithLBConfiguration

test/xds/xds_client_custom_lb_test.go:75–87  ·  view source on GitHub ↗

clusterWithLBConfiguration returns a cluster resource with the proto message passed Marshaled to an any and specified through the load_balancing_policy field.

(t *testing.T, clusterName, edsServiceName string, secLevel e2e.SecurityLevel, m proto.Message)

Source from the content-addressed store, hash-verified

73// passed Marshaled to an any and specified through the load_balancing_policy
74// field.
75func clusterWithLBConfiguration(t *testing.T, clusterName, edsServiceName string, secLevel e2e.SecurityLevel, m proto.Message) *v3clusterpb.Cluster {
76 cluster := e2e.DefaultCluster(clusterName, edsServiceName, secLevel)
77 cluster.LoadBalancingPolicy = &v3clusterpb.LoadBalancingPolicy{
78 Policies: []*v3clusterpb.LoadBalancingPolicy_Policy{
79 {
80 TypedExtensionConfig: &v3corepb.TypedExtensionConfig{
81 TypedConfig: testutils.MarshalAny(t, m),
82 },
83 },
84 },
85 }
86 return cluster
87}
88
89// TestWRRLocality tests RPC distribution across a scenario with 5 backends,
90// with 2 backends in a locality with weight 1, and 3 backends in a second

Callers 1

TestWrrLocalityMethod · 0.70

Calls 2

DefaultClusterFunction · 0.92
MarshalAnyFunction · 0.92

Tested by

no test coverage detected