MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/cloud-sql-proxy / TestClosesWithError

Function TestClosesWithError

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

Source from the content-addressed store, hash-verified

554}
555
556func TestClosesWithError(t *testing.T) {
557 in := &proxy.Config{
558 Addr: "127.0.0.1",
559 Port: 24014,
560 Instances: []proxy.InstanceConnConfig{
561 {Name: "proj:reg:inst"},
562 },
563 }
564 c, err := proxy.NewClient(context.Background(), &errorDialer{}, testLogger, in, nil)
565 if err != nil {
566 t.Fatalf("proxy.NewClient error want = nil, got = %v", err)
567 }
568 go c.Serve(context.Background(), func() {})
569
570 conn := tryTCPDial(t, "127.0.0.1:24014")
571 defer conn.Close()
572
573 if err = c.Close(); err == nil {
574 t.Fatal("c.Close() should error, got nil")
575 }
576}
577
578func TestMultiErrorFormatting(t *testing.T) {
579 tcs := []struct {

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