feat(sources/alloydb,cloudsqlpg,cloudsqlmysql,cloudsqlmssql): Support PSC connection (#1686)

Support PSC connection to these sources
This commit is contained in:
Wenxin Du
2025-10-10 16:16:21 -04:00
committed by GitHub
parent 8faf37667e
commit 9d2bf79bec
10 changed files with 121 additions and 31 deletions

View File

@@ -113,6 +113,34 @@ func TestParseFromYamlCloudSQLPg(t *testing.T) {
},
},
},
{
desc: "psc ipType",
in: `
sources:
my-pg-instance:
kind: cloud-sql-postgres
project: my-project
region: my-region
instance: my-instance
ipType: psc
database: my_db
user: my_user
password: my_pass
`,
want: server.SourceConfigs{
"my-pg-instance": cloudsqlpg.Config{
Name: "my-pg-instance",
Kind: cloudsqlpg.SourceKind,
Project: "my-project",
Region: "my-region",
Instance: "my-instance",
IPType: "psc",
Database: "my_db",
User: "my_user",
Password: "my_pass",
},
},
},
}
for _, tc := range tcs {
t.Run(tc.desc, func(t *testing.T) {
@@ -152,7 +180,7 @@ func TestFailParseFromYaml(t *testing.T) {
user: my_user
password: my_pass
`,
err: "unable to parse source \"my-pg-instance\" as \"cloud-sql-postgres\": ipType invalid: must be one of \"public\", or \"private\"",
err: "unable to parse source \"my-pg-instance\" as \"cloud-sql-postgres\": ipType invalid: must be one of \"public\", \"private\", or \"psc\"",
},
{
desc: "extra field",