Kaynağa Gözat

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

This ensures the ordering of down and up calls.
fanmin shi 8 yıl önce
ebeveyn
işleme
310641630e
1 değiştirilmiş dosya ile 2 ekleme ve 1 silme
  1. 2 1
      clientv3/balancer_test.go

+ 2 - 1
clientv3/balancer_test.go

@@ -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 {