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

Function TestPostgresGcloudAuth

tests/postgres_test.go:213–244  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

211}
212
213func TestPostgresGcloudAuth(t *testing.T) {
214 if testing.Short() {
215 t.Skip("skipping Postgres integration tests")
216 }
217 if v := os.Getenv("IP_TYPE"); v == "private" || v == "psc" {
218 t.Skipf("skipping test because IP_TYPE is set to %v", v)
219 }
220 requirePostgresVars(t)
221
222 tcs := []struct {
223 desc string
224 args []string
225 }{
226 {
227 desc: "gcloud user authentication",
228 args: []string{"--gcloud-auth", *postgresConnName},
229 },
230 {
231 desc: "gcloud user authentication with impersonation",
232 args: []string{
233 "--gcloud-auth",
234 "--impersonate-service-account", *impersonatedUser,
235 *postgresConnName},
236 },
237 }
238 for _, tc := range tcs {
239 t.Run(tc.desc, func(t *testing.T) {
240 proxyConnTest(t, AddIPTypeFlag(tc.args), "pgx", postgresDSN())
241 })
242 }
243
244}
245
246func TestPostgresIAMDBAuthn(t *testing.T) {
247 if testing.Short() {

Callers

nothing calls this directly

Calls 4

requirePostgresVarsFunction · 0.85
proxyConnTestFunction · 0.85
AddIPTypeFlagFunction · 0.85
postgresDSNFunction · 0.85

Tested by

no test coverage detected