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

Function TestClientClosesCleanly

internal/proxy/proxy_test.go:534–554  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

532}
533
534func TestClientClosesCleanly(t *testing.T) {
535 in := &proxy.Config{
536 Addr: "127.0.0.1",
537 Port: 24013,
538 Instances: []proxy.InstanceConnConfig{
539 {Name: "proj:reg:inst"},
540 },
541 }
542 c, err := proxy.NewClient(context.Background(), &fakeDialer{}, testLogger, in, nil)
543 if err != nil {
544 t.Fatalf("proxy.NewClient error want = nil, got = %v", err)
545 }
546 go c.Serve(context.Background(), func() {})
547
548 conn := tryTCPDial(t, "127.0.0.1:24013")
549 _ = conn.Close()
550
551 if err := c.Close(); err != nil {
552 t.Fatalf("c.Close() error = %v", err)
553 }
554}
555
556func TestClosesWithError(t *testing.T) {
557 in := &proxy.Config{

Callers

nothing calls this directly

Calls 5

ServeMethod · 0.95
CloseMethod · 0.95
NewClientFunction · 0.92
tryTCPDialFunction · 0.85
CloseMethod · 0.45

Tested by

no test coverage detected