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

Function TestPostgresCustomerCAS

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

Source from the content-addressed store, hash-verified

300}
301
302func TestPostgresCustomerCAS(t *testing.T) {
303 if testing.Short() {
304 t.Skip("skipping Postgres integration tests")
305 }
306 requirePostgresVars(t)
307 if *postgresCustomerCASConnName == "" {
308 t.Fatal("'postgres_customer_cas_conn_name' not set")
309 }
310 if *postgresCustomerCASPass == "" {
311 t.Fatal("'postgres_customer_cas_pass' not set")
312 }
313 if *postgresCustomerCASDomain == "" {
314 t.Fatal("'postgres_customer_cas_domain' not set")
315 }
316
317 defaultDSN := fmt.Sprintf("host=localhost user=%s password=%s database=%s sslmode=disable",
318 *postgresUser, *postgresCustomerCASPass, *postgresDB)
319
320 tcs := []struct {
321 desc string
322 dsn string
323 args []string
324 }{
325 {
326 desc: "using customer CAS default",
327 args: []string{*postgresCustomerCASConnName},
328 dsn: defaultDSN,
329 },
330 {
331 desc: "using valid domain name",
332 args: []string{*postgresCustomerCASDomain},
333 dsn: defaultDSN,
334 },
335 }
336 for _, tc := range tcs {
337 t.Run(tc.desc, func(t *testing.T) {
338 proxyConnTest(t, AddIPTypeFlag(tc.args), "pgx", tc.dsn)
339 })
340 }
341}
342
343func TestPostgresHealthCheck(t *testing.T) {
344 if testing.Short() {

Callers

nothing calls this directly

Calls 3

requirePostgresVarsFunction · 0.85
proxyConnTestFunction · 0.85
AddIPTypeFlagFunction · 0.85

Tested by

no test coverage detected