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

Function lbConfigFor

service_config_test.go:43–61  ·  view source on GitHub ↗
(t *testing.T, name string, cfg serviceconfig.LoadBalancingConfig)

Source from the content-addressed store, hash-verified

41}
42
43func lbConfigFor(t *testing.T, name string, cfg serviceconfig.LoadBalancingConfig) serviceconfig.LoadBalancingConfig {
44 if name == "" {
45 name = "pick_first"
46 cfg = struct {
47 serviceconfig.LoadBalancingConfig
48 }{}
49 }
50 d := []map[string]any{{name: cfg}}
51 strCfg, err := json.Marshal(d)
52 t.Logf("strCfg = %v", string(strCfg))
53 if err != nil {
54 t.Fatalf("Error parsing config: %v", err)
55 }
56 parsedCfg, err := gracefulswitch.ParseConfig(strCfg)
57 if err != nil {
58 t.Fatalf("Error parsing config: %v", err)
59 }
60 return parsedCfg
61}
62
63func runParseTests(t *testing.T, testCases []parseTestCase) {
64 t.Helper()

Callers 7

TestParseLBConfigMethod · 0.85
TestParseLoadBalancerMethod · 0.85
TestParseWaitForReadyMethod · 0.85
TestParseTimeOutMethod · 0.85
TestParseMsgSizeMethod · 0.85
TestParseRetryPolicyMethod · 0.85

Calls 4

ParseConfigFunction · 0.92
MarshalMethod · 0.65
LogfMethod · 0.65
FatalfMethod · 0.65

Tested by

no test coverage detected