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

Method TestParseLoadBalancer

service_config_test.go:145–191  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

143}
144
145func (s) TestParseLoadBalancer(t *testing.T) {
146 testcases := []parseTestCase{
147 {
148 scjs: `{
149 "loadBalancingPolicy": "round_robin",
150 "methodConfig": [
151 {
152 "name": [
153 {
154 "service": "foo",
155 "method": "Bar"
156 }
157 ],
158 "waitForReady": true
159 }
160 ]
161}`,
162 wantSC: &ServiceConfig{
163 Methods: map[string]MethodConfig{
164 "/foo/Bar": {
165 WaitForReady: newBool(true),
166 },
167 },
168 lbConfig: lbConfigFor(t, "round_robin", nil),
169 },
170 wantErr: false,
171 },
172 {
173 scjs: `{
174 "loadBalancingPolicy": 1,
175 "methodConfig": [
176 {
177 "name": [
178 {
179 "service": "foo",
180 "method": "Bar"
181 }
182 ],
183 "waitForReady": false
184 }
185 ]
186}`,
187 wantErr: true,
188 },
189 }
190 runParseTests(t, testcases)
191}
192
193func (s) TestParseWaitForReady(t *testing.T) {
194 testcases := []parseTestCase{

Callers

nothing calls this directly

Calls 3

newBoolFunction · 0.85
lbConfigForFunction · 0.85
runParseTestsFunction · 0.85

Tested by

no test coverage detected