@@ -125,6 +125,54 @@ describe('pick_first load balancing policy', () => {
125
125
subchannels [ 0 ] . transitionToState ( ConnectivityState . READY ) ;
126
126
} ) ;
127
127
} ) ;
128
+ it ( 'Should report READY when a subchannel other than the first connects' , done => {
129
+ const channelControlHelper = createChildChannelControlHelper (
130
+ baseChannelControlHelper ,
131
+ {
132
+ updateState : updateStateCallBackForExpectedStateSequence (
133
+ [ ConnectivityState . CONNECTING , ConnectivityState . READY ] ,
134
+ done
135
+ ) ,
136
+ }
137
+ ) ;
138
+ const pickFirst = new PickFirstLoadBalancer ( channelControlHelper ) ;
139
+ pickFirst . updateAddressList (
140
+ [
141
+ { addresses : [ { host : 'localhost' , port : 1 } ] } ,
142
+ { addresses : [ { host : 'localhost' , port : 2 } ] } ,
143
+ ] ,
144
+ config
145
+ ) ;
146
+ process . nextTick ( ( ) => {
147
+ subchannels [ 1 ] . transitionToState ( ConnectivityState . READY ) ;
148
+ } ) ;
149
+ } ) ;
150
+ it ( 'Should report READY when a subchannel other than the first in the same endpoint connects' , done => {
151
+ const channelControlHelper = createChildChannelControlHelper (
152
+ baseChannelControlHelper ,
153
+ {
154
+ updateState : updateStateCallBackForExpectedStateSequence (
155
+ [ ConnectivityState . CONNECTING , ConnectivityState . READY ] ,
156
+ done
157
+ ) ,
158
+ }
159
+ ) ;
160
+ const pickFirst = new PickFirstLoadBalancer ( channelControlHelper ) ;
161
+ pickFirst . updateAddressList (
162
+ [
163
+ {
164
+ addresses : [
165
+ { host : 'localhost' , port : 1 } ,
166
+ { host : 'localhost' , port : 2 } ,
167
+ ] ,
168
+ } ,
169
+ ] ,
170
+ config
171
+ ) ;
172
+ process . nextTick ( ( ) => {
173
+ subchannels [ 1 ] . transitionToState ( ConnectivityState . READY ) ;
174
+ } ) ;
175
+ } ) ;
128
176
it ( 'Should report READY when updated with a subchannel that is already READY' , done => {
129
177
const channelControlHelper = createChildChannelControlHelper (
130
178
baseChannelControlHelper ,
0 commit comments