@@ -79,19 +79,19 @@ func (s) TestExitIdle(t *testing.T) {
7979
8080 bf := stub.BalancerFuncs {
8181 Init : func (bd * stub.BalancerData ) {
82- bd .Data = lazy .NewBalancer (bd .ClientConn , bd .BuildOptions , balancer .Get (pickfirstleaf .Name ).Build )
82+ bd .ChildBalancer = lazy .NewBalancer (bd .ClientConn , bd .BuildOptions , balancer .Get (pickfirstleaf .Name ).Build )
8383 },
8484 ExitIdle : func (bd * stub.BalancerData ) {
85- bd .Data .(balancer. Balancer ) .ExitIdle ()
85+ bd .ChildBalancer .ExitIdle ()
8686 },
8787 ResolverError : func (bd * stub.BalancerData , err error ) {
88- bd .Data .(balancer. Balancer ) .ResolverError (err )
88+ bd .ChildBalancer .ResolverError (err )
8989 },
9090 UpdateClientConnState : func (bd * stub.BalancerData , ccs balancer.ClientConnState ) error {
91- return bd .Data .(balancer. Balancer ) .UpdateClientConnState (ccs )
91+ return bd .ChildBalancer .UpdateClientConnState (ccs )
9292 },
9393 Close : func (bd * stub.BalancerData ) {
94- bd .Data .(balancer. Balancer ) .Close ()
94+ bd .ChildBalancer .Close ()
9595 },
9696 }
9797 stub .Register (t .Name (), bf )
@@ -144,16 +144,16 @@ func (s) TestPicker(t *testing.T) {
144144
145145 bf := stub.BalancerFuncs {
146146 Init : func (bd * stub.BalancerData ) {
147- bd .Data = lazy .NewBalancer (bd .ClientConn , bd .BuildOptions , balancer .Get (pickfirstleaf .Name ).Build )
147+ bd .ChildBalancer = lazy .NewBalancer (bd .ClientConn , bd .BuildOptions , balancer .Get (pickfirstleaf .Name ).Build )
148148 },
149149 ExitIdle : func (* stub.BalancerData ) {
150150 t .Log ("Ignoring call to ExitIdle, calling the picker should make the lazy balancer exit IDLE state." )
151151 },
152152 UpdateClientConnState : func (bd * stub.BalancerData , ccs balancer.ClientConnState ) error {
153- return bd .Data .(balancer. Balancer ) .UpdateClientConnState (ccs )
153+ return bd .ChildBalancer .UpdateClientConnState (ccs )
154154 },
155155 Close : func (bd * stub.BalancerData ) {
156- bd .Data .(balancer. Balancer ) .Close ()
156+ bd .ChildBalancer .Close ()
157157 },
158158 }
159159
@@ -201,24 +201,24 @@ func (s) TestGoodUpdateThenResolverError(t *testing.T) {
201201
202202 childBF := stub.BalancerFuncs {
203203 Init : func (bd * stub.BalancerData ) {
204- bd .Data = balancer .Get (pickfirstleaf .Name ).Build (bd .ClientConn , bd .BuildOptions )
204+ bd .ChildBalancer = balancer .Get (pickfirstleaf .Name ).Build (bd .ClientConn , bd .BuildOptions )
205205 },
206206 UpdateClientConnState : func (bd * stub.BalancerData , ccs balancer.ClientConnState ) error {
207207 if resolverErrorReceived .HasFired () {
208208 t .Error ("Received resolver error before resolver state." )
209209 }
210210 resolverStateReceived = true
211- return bd .Data .(balancer. Balancer ) .UpdateClientConnState (ccs )
211+ return bd .ChildBalancer .UpdateClientConnState (ccs )
212212 },
213213 ResolverError : func (bd * stub.BalancerData , err error ) {
214214 if ! resolverStateReceived {
215215 t .Error ("Received resolver error before resolver state." )
216216 }
217217 resolverErrorReceived .Fire ()
218- bd .Data .(balancer. Balancer ) .ResolverError (err )
218+ bd .ChildBalancer .ResolverError (err )
219219 },
220220 Close : func (bd * stub.BalancerData ) {
221- bd .Data .(balancer. Balancer ) .Close ()
221+ bd .ChildBalancer .Close ()
222222 },
223223 }
224224
@@ -227,19 +227,19 @@ func (s) TestGoodUpdateThenResolverError(t *testing.T) {
227227
228228 topLevelBF := stub.BalancerFuncs {
229229 Init : func (bd * stub.BalancerData ) {
230- bd .Data = lazy .NewBalancer (bd .ClientConn , bd .BuildOptions , balancer .Get (childBalName ).Build )
230+ bd .ChildBalancer = lazy .NewBalancer (bd .ClientConn , bd .BuildOptions , balancer .Get (childBalName ).Build )
231231 },
232232 ExitIdle : func (* stub.BalancerData ) {
233233 t .Log ("Ignoring call to ExitIdle to delay lazy child creation until RPC time." )
234234 },
235235 ResolverError : func (bd * stub.BalancerData , err error ) {
236- bd .Data .(balancer. Balancer ) .ResolverError (err )
236+ bd .ChildBalancer .ResolverError (err )
237237 },
238238 UpdateClientConnState : func (bd * stub.BalancerData , ccs balancer.ClientConnState ) error {
239- return bd .Data .(balancer. Balancer ) .UpdateClientConnState (ccs )
239+ return bd .ChildBalancer .UpdateClientConnState (ccs )
240240 },
241241 Close : func (bd * stub.BalancerData ) {
242- bd .Data .(balancer. Balancer ) .Close ()
242+ bd .ChildBalancer .Close ()
243243 },
244244 }
245245
@@ -306,17 +306,17 @@ func (s) TestResolverErrorThenGoodUpdate(t *testing.T) {
306306
307307 childBF := stub.BalancerFuncs {
308308 Init : func (bd * stub.BalancerData ) {
309- bd .Data = balancer .Get (pickfirstleaf .Name ).Build (bd .ClientConn , bd .BuildOptions )
309+ bd .ChildBalancer = balancer .Get (pickfirstleaf .Name ).Build (bd .ClientConn , bd .BuildOptions )
310310 },
311311 UpdateClientConnState : func (bd * stub.BalancerData , ccs balancer.ClientConnState ) error {
312- return bd .Data .(balancer. Balancer ) .UpdateClientConnState (ccs )
312+ return bd .ChildBalancer .UpdateClientConnState (ccs )
313313 },
314314 ResolverError : func (bd * stub.BalancerData , err error ) {
315315 t .Error ("Received unexpected resolver error." )
316- bd .Data .(balancer. Balancer ) .ResolverError (err )
316+ bd .ChildBalancer .ResolverError (err )
317317 },
318318 Close : func (bd * stub.BalancerData ) {
319- bd .Data .(balancer. Balancer ) .Close ()
319+ bd .ChildBalancer .Close ()
320320 },
321321 }
322322
@@ -325,16 +325,16 @@ func (s) TestResolverErrorThenGoodUpdate(t *testing.T) {
325325
326326 topLevelBF := stub.BalancerFuncs {
327327 Init : func (bd * stub.BalancerData ) {
328- bd .Data = lazy .NewBalancer (bd .ClientConn , bd .BuildOptions , balancer .Get (childBalName ).Build )
328+ bd .ChildBalancer = lazy .NewBalancer (bd .ClientConn , bd .BuildOptions , balancer .Get (childBalName ).Build )
329329 },
330330 ExitIdle : func (* stub.BalancerData ) {
331331 t .Log ("Ignoring call to ExitIdle to delay lazy child creation until RPC time." )
332332 },
333333 UpdateClientConnState : func (bd * stub.BalancerData , ccs balancer.ClientConnState ) error {
334- return bd .Data .(balancer. Balancer ) .UpdateClientConnState (ccs )
334+ return bd .ChildBalancer .UpdateClientConnState (ccs )
335335 },
336336 Close : func (bd * stub.BalancerData ) {
337- bd .Data .(balancer. Balancer ) .Close ()
337+ bd .ChildBalancer .Close ()
338338 },
339339 }
340340
@@ -407,19 +407,19 @@ func (s) TestExitIdlePassthrough(t *testing.T) {
407407
408408 bf := stub.BalancerFuncs {
409409 Init : func (bd * stub.BalancerData ) {
410- bd .Data = lazy .NewBalancer (bd .ClientConn , bd .BuildOptions , balancer .Get (pickfirstleaf .Name ).Build )
410+ bd .ChildBalancer = lazy .NewBalancer (bd .ClientConn , bd .BuildOptions , balancer .Get (pickfirstleaf .Name ).Build )
411411 },
412412 ExitIdle : func (bd * stub.BalancerData ) {
413- bd .Data .(balancer. Balancer ) .ExitIdle ()
413+ bd .ChildBalancer .ExitIdle ()
414414 },
415415 ResolverError : func (bd * stub.BalancerData , err error ) {
416- bd .Data .(balancer. Balancer ) .ResolverError (err )
416+ bd .ChildBalancer .ResolverError (err )
417417 },
418418 UpdateClientConnState : func (bd * stub.BalancerData , ccs balancer.ClientConnState ) error {
419- return bd .Data .(balancer. Balancer ) .UpdateClientConnState (ccs )
419+ return bd .ChildBalancer .UpdateClientConnState (ccs )
420420 },
421421 Close : func (bd * stub.BalancerData ) {
422- bd .Data .(balancer. Balancer ) .Close ()
422+ bd .ChildBalancer .Close ()
423423 },
424424 }
425425 stub .Register (t .Name (), bf )
0 commit comments