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

Function TestSQLServerGcloudAuth

tests/sqlserver_test.go:149–179  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

147}
148
149func TestSQLServerGcloudAuth(t *testing.T) {
150 if testing.Short() {
151 t.Skip("skipping SQL Server integration tests")
152 }
153 if v := os.Getenv("IP_TYPE"); v == "private" || v == "psc" {
154 t.Skipf("skipping test because IP_TYPE is set to %v", v)
155 }
156 requireSQLServerVars(t)
157
158 tcs := []struct {
159 desc string
160 args []string
161 }{
162 {
163 desc: "gcloud user authentication",
164 args: []string{"--gcloud-auth", *sqlserverConnName},
165 },
166 {
167 desc: "gcloud user authentication with impersonation",
168 args: []string{
169 "--gcloud-auth",
170 "--impersonate-service-account", *impersonatedUser,
171 *sqlserverConnName},
172 },
173 }
174 for _, tc := range tcs {
175 t.Run(tc.desc, func(t *testing.T) {
176 proxyConnTest(t, AddIPTypeFlag(tc.args), "sqlserver", sqlserverDSN())
177 })
178 }
179}
180
181func TestSQLServerHealthCheck(t *testing.T) {
182 if testing.Short() {

Callers

nothing calls this directly

Calls 4

requireSQLServerVarsFunction · 0.85
proxyConnTestFunction · 0.85
AddIPTypeFlagFunction · 0.85
sqlserverDSNFunction · 0.85

Tested by

no test coverage detected