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

Function TestSQLServerAuthentication

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

Source from the content-addressed store, hash-verified

79}
80
81func TestSQLServerAuthentication(t *testing.T) {
82 if testing.Short() {
83 t.Skip("skipping SQL Server integration tests")
84 }
85 requireSQLServerVars(t)
86
87 var creds string
88 if *ipType == "public" {
89 creds = keyfile(t)
90 }
91 tok, path, cleanup := removeAuthEnvVar(t)
92 defer cleanup()
93
94 tcs := []struct {
95 desc string
96 args []string
97 }{
98 {
99 desc: "with token",
100 args: []string{"--token", tok.AccessToken, *sqlserverConnName},
101 },
102 {
103 desc: "with token and impersonation",
104 args: []string{
105 "--token", tok.AccessToken,
106 "--impersonate-service-account", *impersonatedUser,
107 *sqlserverConnName},
108 },
109 }
110 if *ipType == "public" {
111 additionaTcs := []struct {
112 desc string
113 args []string
114 }{
115 {
116 desc: "with credentials file",
117 args: []string{"--credentials-file", path, *sqlserverConnName},
118 },
119 {
120 desc: "with credentials file and impersonation",
121 args: []string{
122 "--credentials-file", path,
123 "--impersonate-service-account", *impersonatedUser,
124 *sqlserverConnName,
125 },
126 },
127 {
128 desc: "with credentials JSON",
129 args: []string{"--json-credentials", string(creds), *sqlserverConnName},
130 },
131 {
132 desc: "with credentials JSON and impersonation",
133 args: []string{
134 "--json-credentials", string(creds),
135 "--impersonate-service-account", *impersonatedUser,
136 *sqlserverConnName,
137 },
138 },

Callers

nothing calls this directly

Calls 6

requireSQLServerVarsFunction · 0.85
keyfileFunction · 0.85
removeAuthEnvVarFunction · 0.85
proxyConnTestFunction · 0.85
AddIPTypeFlagFunction · 0.85
sqlserverDSNFunction · 0.85

Tested by

no test coverage detected