Explorar el Código

clientv3: close balancer to avoid goroutine leak in balancer_test.go

fanmin shi hace 9 años
padre
commit
7a25257fb2
Se han modificado 1 ficheros con 2 adiciones y 0 borrados
  1. 2 0
      clientv3/balancer_test.go

+ 2 - 0
clientv3/balancer_test.go

@@ -29,6 +29,7 @@ var (
 
 func TestBalancerGetUnblocking(t *testing.T) {
 	sb := newSimpleBalancer(endpoints)
+	defer sb.Close()
 	if addrs := <-sb.Notify(); len(addrs) != len(endpoints) {
 		t.Errorf("Initialize newSimpleBalancer should have triggered Notify() chan, but it didn't")
 	}
@@ -72,6 +73,7 @@ func TestBalancerGetUnblocking(t *testing.T) {
 
 func TestBalancerGetBlocking(t *testing.T) {
 	sb := newSimpleBalancer(endpoints)
+	defer sb.Close()
 	if addrs := <-sb.Notify(); len(addrs) != len(endpoints) {
 		t.Errorf("Initialize newSimpleBalancer should have triggered Notify() chan, but it didn't")
 	}