(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestTryDial_AppliesDialTimeoutWhenSet(t *testing.T) { |
| 12 | p := NewConnPool(&Options{ |
| 13 | Dialer: func(ctx context.Context) (net.Conn, error) { |
| 14 | if _, ok := ctx.Deadline(); !ok { |
| 15 | return nil, errors.New("expected deadline in tryDial") |
| 16 | } |
| 17 | c1, c2 := net.Pipe() |
| 18 | _ = c2.Close() |
| 19 | return c1, nil |
| 20 | }, |
| 21 | PoolSize: 1, |
| 22 | MaxConcurrentDials: 1, |
| 23 | DialTimeout: 200 * time.Millisecond, |
| 24 | }) |
| 25 | defer p.Close() |
| 26 | |
| 27 | p.tryDial() |
| 28 | } |
| 29 | |
| 30 | func TestTryDial_DoesNotApplyDialTimeoutWhenDisabled(t *testing.T) { |
| 31 | p := NewConnPool(&Options{ |
nothing calls this directly
no test coverage detected