@@ -267,7 +267,8 @@ func TestConnectionHook(t *testing.T) {
267
267
EndpointType : EndpointTypeAuto ,
268
268
MaxWorkers : 2 ,
269
269
HandoffQueueSize : 10 ,
270
- MaxHandoffRetries : 3 , // Explicit queue size to avoid 0-size queue
270
+ MaxHandoffRetries : 3 ,
271
+ HandoffTimeout : 1 * time .Second , // Shorter timeout for faster test
271
272
LogLevel : 2 ,
272
273
}
273
274
processor := NewPoolHook (failingDialer , "tcp" , config , nil )
@@ -293,7 +294,8 @@ func TestConnectionHook(t *testing.T) {
293
294
}
294
295
295
296
// Wait for handoff to complete and fail with proper timeout and polling
296
- timeout := time .After (2 * time .Second )
297
+ // Use longer timeout to account for handoff timeout + processing time
298
+ timeout := time .After (5 * time .Second )
297
299
ticker := time .NewTicker (10 * time .Millisecond )
298
300
defer ticker .Stop ()
299
301
@@ -305,14 +307,14 @@ func TestConnectionHook(t *testing.T) {
305
307
case <- timeout :
306
308
t .Fatal ("Timeout waiting for failed handoff to complete" )
307
309
case <- ticker .C :
308
- if _ , pending := processor .pending .Load (conn ); ! pending {
310
+ if _ , pending := processor .pending .Load (conn . GetID () ); ! pending {
309
311
handoffCompleted = true
310
312
}
311
313
}
312
314
}
313
315
314
316
// Connection should be removed from pending map after failed handoff
315
- if _ , pending := processor .pending .Load (conn ); pending {
317
+ if _ , pending := processor .pending .Load (conn . GetID () ); pending {
316
318
t .Error ("Connection should be removed from pending map after failed handoff" )
317
319
}
318
320
0 commit comments