@@ -263,85 +263,34 @@ func TestMaxConcurrentDialsOptions(t *testing.T) {
263263 maxConcurrentDials int
264264 expectedConcurrentDials int
265265 }{
266- // Zero value tests - MaxConcurrentDials should be set to PoolSize
267- {
268- name : "zero value with default pool size" ,
269- poolSize : 0 , // will become 10 * GOMAXPROCS in init()
270- maxConcurrentDials : 0 ,
271- expectedConcurrentDials : 0 , // will be set to PoolSize in init()
272- },
266+ // Edge cases and invalid values - negative/zero values set to PoolSize
273267 {
274- name : "positive value with default pool size" ,
275- poolSize : 0 , // will become 10 * GOMAXPROCS in init()
276- maxConcurrentDials : 5 ,
277- expectedConcurrentDials : 5 , // should remain 5 if < calculated PoolSize
268+ name : "negative value gets set to pool size" ,
269+ poolSize : 10 ,
270+ maxConcurrentDials : - 1 ,
271+ expectedConcurrentDials : 10 , // negative values are set to PoolSize
278272 },
273+ // Zero value tests - MaxConcurrentDials should be set to PoolSize
279274 {
280- name : "zero value with minimum pool size" ,
275+ name : "zero value with positive pool size" ,
281276 poolSize : 1 ,
282277 maxConcurrentDials : 0 ,
283278 expectedConcurrentDials : 1 , // MaxConcurrentDials = PoolSize when 0
284279 },
285- {
286- name : "zero value with small pool size" ,
287- poolSize : 5 ,
288- maxConcurrentDials : 0 ,
289- expectedConcurrentDials : 5 , // MaxConcurrentDials = PoolSize when 0
290- },
291- {
292- name : "zero value with large pool size" ,
293- poolSize : 100 ,
294- maxConcurrentDials : 0 ,
295- expectedConcurrentDials : 100 , // MaxConcurrentDials = PoolSize when 0
296- },
297-
298280 // Explicit positive value tests
299281 {
300282 name : "explicit value within limit" ,
301283 poolSize : 10 ,
302284 maxConcurrentDials : 3 ,
303285 expectedConcurrentDials : 3 , // should remain unchanged when < PoolSize
304286 },
305- {
306- name : "explicit value equal to pool size" ,
307- poolSize : 8 ,
308- maxConcurrentDials : 8 ,
309- expectedConcurrentDials : 8 , // should remain unchanged when = PoolSize
310- },
311- {
312- name : "explicit minimum value" ,
313- poolSize : 10 ,
314- maxConcurrentDials : 1 ,
315- expectedConcurrentDials : 1 , // minimum valid value
316- },
317-
318287 // Capping tests - values exceeding PoolSize should be capped
319288 {
320289 name : "value exceeding pool size" ,
321290 poolSize : 5 ,
322291 maxConcurrentDials : 10 ,
323292 expectedConcurrentDials : 5 , // should be capped at PoolSize
324293 },
325- {
326- name : "large value exceeding small pool" ,
327- poolSize : 2 ,
328- maxConcurrentDials : 1000 ,
329- expectedConcurrentDials : 2 , // should be capped at PoolSize
330- },
331-
332- // Edge cases and invalid values - negative/zero values set to PoolSize
333- {
334- name : "negative value gets set to pool size" ,
335- poolSize : 10 ,
336- maxConcurrentDials : - 1 ,
337- expectedConcurrentDials : 10 , // negative values are set to PoolSize
338- },
339- {
340- name : "large negative value gets set to pool size" ,
341- poolSize : 3 ,
342- maxConcurrentDials : - 100 ,
343- expectedConcurrentDials : 3 , // negative values are set to PoolSize
344- },
345294 }
346295
347296 for _ , tc := range testCases {
@@ -352,19 +301,6 @@ func TestMaxConcurrentDialsOptions(t *testing.T) {
352301 }
353302 opts .init ()
354303
355- if tc .expectedConcurrentDials == 0 {
356- // For default pool size case, set expected value based on input
357- if tc .poolSize == 0 {
358- if tc .maxConcurrentDials == 0 {
359- tc .expectedConcurrentDials = opts .PoolSize // MaxConcurrentDials = PoolSize when 0
360- } else {
361- // For positive maxConcurrentDials with default PoolSize,
362- // it should remain unchanged if <= calculated PoolSize
363- tc .expectedConcurrentDials = tc .maxConcurrentDials
364- }
365- }
366- }
367-
368304 if opts .MaxConcurrentDials != tc .expectedConcurrentDials {
369305 t .Errorf ("MaxConcurrentDials: got %v, expected %v (PoolSize=%v)" ,
370306 opts .MaxConcurrentDials , tc .expectedConcurrentDials , opts .PoolSize )
0 commit comments