File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -859,12 +859,15 @@ func (s) TestUpdateAddresses_RetryFromFirstAddr(t *testing.T) {
859
859
defer lis3 .Close ()
860
860
861
861
closeServer2 := make (chan struct {})
862
+ exitCh := make (chan struct {})
862
863
server1ContactedFirstTime := make (chan struct {})
863
864
server1ContactedSecondTime := make (chan struct {})
864
865
server2ContactedFirstTime := make (chan struct {})
865
866
server2ContactedSecondTime := make (chan struct {})
866
867
server3Contacted := make (chan struct {})
867
868
869
+ defer close (exitCh )
870
+
868
871
// Launch server 1.
869
872
go func () {
870
873
// First, let's allow the initial connection to go READY. We need to do
@@ -888,12 +891,18 @@ func (s) TestUpdateAddresses_RetryFromFirstAddr(t *testing.T) {
888
891
// until balancer is built to process the addresses.
889
892
stateNotifications := testBalancerBuilder .nextStateNotifier ()
890
893
// Wait for the transport to become ready.
891
- for s := range stateNotifications {
892
- if s == connectivity .Ready {
893
- break
894
+ for {
895
+ select {
896
+ case st := <- stateNotifications :
897
+ if st == connectivity .Ready {
898
+ goto ready
899
+ }
900
+ case <- exitCh :
901
+ return
894
902
}
895
903
}
896
904
905
+ ready:
897
906
// Once it's ready, curAddress has been set. So let's close this
898
907
// connection prompting the first reconnect cycle.
899
908
conn1 .Close ()
You can’t perform that action at this time.
0 commit comments