clientv3: send frst down() func after recieving first notified addr

This ensures the ordering of down and up calls.
This commit is contained in:
fanmin shi 2017-03-09 12:13:42 -08:00
parent 8baaa06cce
commit 310641630e

View File

@ -95,10 +95,11 @@ func TestBalancerGetBlocking(t *testing.T) {
go func() {
// ensure sb.Up() will be called after sb.Get() to see if Up() releases blocking Get()
time.Sleep(time.Millisecond * 100)
downC <- sb.Up(grpc.Address{Addr: endpoints[1]})
f := sb.Up(grpc.Address{Addr: endpoints[1]})
if addrs := <-sb.Notify(); len(addrs) != 1 {
t.Errorf("first Up() should have triggered balancer to send the first connected address via Notify chan so that other connections can be closed")
}
downC <- f
}()
addrFirst, putFun, err := sb.Get(context.Background(), blockingOpts)
if err != nil {