(t *testing.T)
| 163 | } |
| 164 | |
| 165 | func TestMySQLAuthentication(t *testing.T) { |
| 166 | if testing.Short() { |
| 167 | t.Skip("skipping MySQL integration tests") |
| 168 | } |
| 169 | requireMySQLVars(t) |
| 170 | |
| 171 | var creds string |
| 172 | if *ipType == "public" { |
| 173 | creds = keyfile(t) |
| 174 | } |
| 175 | tok, path, cleanup := removeAuthEnvVar(t) |
| 176 | defer cleanup() |
| 177 | |
| 178 | tcs := []struct { |
| 179 | desc string |
| 180 | args []string |
| 181 | }{ |
| 182 | { |
| 183 | desc: "with token", |
| 184 | args: []string{"--token", tok.AccessToken, *mysqlConnName}, |
| 185 | }, |
| 186 | { |
| 187 | desc: "with token and impersonation", |
| 188 | args: []string{ |
| 189 | "--token", tok.AccessToken, |
| 190 | "--impersonate-service-account", *impersonatedUser, |
| 191 | *mysqlConnName}, |
| 192 | }, |
| 193 | } |
| 194 | if *ipType == "public" { |
| 195 | additionaTcs := []struct { |
| 196 | desc string |
| 197 | args []string |
| 198 | }{ |
| 199 | { |
| 200 | desc: "with credentials file", |
| 201 | args: []string{"--credentials-file", path, *mysqlConnName}, |
| 202 | }, |
| 203 | { |
| 204 | desc: "with credentials file and impersonation", |
| 205 | args: []string{ |
| 206 | "--credentials-file", path, |
| 207 | "--impersonate-service-account", *impersonatedUser, |
| 208 | *mysqlConnName, |
| 209 | }, |
| 210 | }, |
| 211 | { |
| 212 | desc: "with credentials JSON", |
| 213 | args: []string{"--json-credentials", string(creds), *mysqlConnName}, |
| 214 | }, |
| 215 | { |
| 216 | desc: "with credentials JSON and impersonation", |
| 217 | args: []string{ |
| 218 | "--json-credentials", string(creds), |
| 219 | "--impersonate-service-account", *impersonatedUser, |
| 220 | *mysqlConnName, |
| 221 | }, |
| 222 | }, |
nothing calls this directly
no test coverage detected