MCPcopy Create free account
hub / github.com/bytebase/bytebase / TestCloudSQLDialOptions

Function TestCloudSQLDialOptions

backend/plugin/db/util/connection_test.go:72–90  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

70}
71
72func TestCloudSQLDialOptions(t *testing.T) {
73 tests := []struct {
74 name string
75 ipType storepb.DataSource_CloudSQLIPType
76 wantLen int
77 }{
78 {"unspecified defaults to public", storepb.DataSource_CLOUD_SQL_IP_TYPE_UNSPECIFIED, 0},
79 {"public", storepb.DataSource_PUBLIC, 0},
80 {"private", storepb.DataSource_PRIVATE, 1},
81 {"psc", storepb.DataSource_PSC, 1},
82 }
83 for _, tc := range tests {
84 t.Run(tc.name, func(t *testing.T) {
85 if got := cloudSQLDialOptions(&storepb.DataSource{CloudSqlIpType: tc.ipType}); len(got) != tc.wantLen {
86 t.Errorf("cloudSQLDialOptions(%v) = %d options, want %d", tc.ipType, len(got), tc.wantLen)
87 }
88 })
89 }
90}

Callers

nothing calls this directly

Calls 3

cloudSQLDialOptionsFunction · 0.85
ErrorfMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected