MCPcopy Index your code
hub / github.com/GoogleCloudPlatform/cloud-sql-proxy / tryTCPDial

Function tryTCPDial

internal/proxy/proxy_test.go:490–509  ·  view source on GitHub ↗
(t *testing.T, addr string)

Source from the content-addressed store, hash-verified

488}
489
490func tryTCPDial(t *testing.T, addr string) net.Conn {
491 attempts := 10
492 var (
493 conn net.Conn
494 err error
495 )
496 for i := 0; i < attempts; i++ {
497 conn, err = net.Dial("tcp", addr)
498 if err != nil {
499 time.Sleep(100 * time.Millisecond)
500 continue
501 }
502 // Give the socket some time to finish the connection.
503 time.Sleep(100 * time.Millisecond)
504 return conn
505 }
506
507 t.Fatalf("failed to dial in %v attempts: %v", attempts, err)
508 return nil
509}
510
511func TestClientCloseWaitsForActiveConnections(t *testing.T) {
512 in := &proxy.Config{

Callers 4

TestClientClosesCleanlyFunction · 0.85
TestClosesWithErrorFunction · 0.85
TestClientConnCountFunction · 0.85

Calls 1

DialMethod · 0.65

Tested by

no test coverage detected