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

Function buildBasicRLSConfig

balancer/rls/helpers_test.go:122–142  ·  view source on GitHub ↗

buildBasicRLSConfig constructs a basic service config for the RLS LB policy with header matching rules. This expects the passed child policy name to have been registered by the caller.

(childPolicyName, rlsServerAddress string)

Source from the content-addressed store, hash-verified

120// with header matching rules. This expects the passed child policy name to
121// have been registered by the caller.
122func buildBasicRLSConfig(childPolicyName, rlsServerAddress string) *e2e.RLSConfig {
123 return &e2e.RLSConfig{
124 RouteLookupConfig: &rlspb.RouteLookupConfig{
125 GrpcKeybuilders: []*rlspb.GrpcKeyBuilder{
126 {
127 Names: []*rlspb.GrpcKeyBuilder_Name{{Service: "grpc.testing.TestService"}},
128 Headers: []*rlspb.NameMatcher{
129 {Key: "k1", Names: []string{"n1"}},
130 {Key: "k2", Names: []string{"n2"}},
131 },
132 },
133 },
134 LookupService: rlsServerAddress,
135 LookupServiceTimeout: durationpb.New(defaultTestTimeout),
136 CacheSizeBytes: 1024,
137 },
138 RouteLookupChannelServiceConfig: `{"loadBalancingConfig": [{"pick_first": {}}]}`,
139 ChildPolicy: &internalserviceconfig.BalancerConfig{Name: childPolicyName},
140 ChildPolicyConfigTargetFieldName: e2e.RLSChildPolicyTargetNameField,
141 }
142}
143
144// buildBasicRLSConfigWithChildPolicy constructs a very basic service config for
145// the RLS LB policy. It also registers a test LB policy which is capable of

Calls

no outgoing calls

Tested by

no test coverage detected