|
9 | 9 | "testing"
|
10 | 10 | "time"
|
11 | 11 |
|
| 12 | + transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" |
| 13 | + |
12 | 14 | "google.golang.org/api/cloudbilling/v1"
|
13 | 15 | cloudkms "google.golang.org/api/cloudkms/v1"
|
14 | 16 | cloudresourcemanager "google.golang.org/api/cloudresourcemanager/v1"
|
@@ -136,7 +138,7 @@ var serviceAccountDisplay = "Bootstrapped Service Account for Terraform tests"
|
136 | 138 | // Some tests need a second service account, other than the test runner, to assert functionality on.
|
137 | 139 | // This provides a well-known service account that can be used when dynamically creating a service
|
138 | 140 | // account isn't an option.
|
139 |
| -func getOrCreateServiceAccount(config *Config, project string) (*iam.ServiceAccount, error) { |
| 141 | +func getOrCreateServiceAccount(config *transport_tpg.Config, project string) (*iam.ServiceAccount, error) { |
140 | 142 | name := fmt.Sprintf("projects/%s/serviceAccounts/%s@%s.iam.gserviceaccount.com", project, serviceAccountEmail, project)
|
141 | 143 | log.Printf("[DEBUG] Verifying %s as bootstrapped service account.\n", name)
|
142 | 144 |
|
@@ -168,7 +170,7 @@ func getOrCreateServiceAccount(config *Config, project string) (*iam.ServiceAcco
|
168 | 170 | // on a different service account. Granting permissions takes time and there is no operation to wait on
|
169 | 171 | // so instead this creates a single service account once per test-suite with the correct permissions.
|
170 | 172 | // The first time this test is run it will fail, but subsequent runs will succeed.
|
171 |
| -func impersonationServiceAccountPermissions(config *Config, sa *iam.ServiceAccount, testRunner string) error { |
| 173 | +func impersonationServiceAccountPermissions(config *transport_tpg.Config, sa *iam.ServiceAccount, testRunner string) error { |
172 | 174 | log.Printf("[DEBUG] Setting service account permissions.\n")
|
173 | 175 | policy := iam.Policy{
|
174 | 176 | Bindings: []*iam.Binding{},
|
@@ -535,20 +537,20 @@ func BootstrapProject(t *testing.T, projectIDPrefix, billingAccount string, serv
|
535 | 537 | }
|
536 | 538 |
|
537 | 539 | // BootstrapConfig returns a Config pulled from the environment.
|
538 |
| -func BootstrapConfig(t *testing.T) *Config { |
| 540 | +func BootstrapConfig(t *testing.T) *transport_tpg.Config { |
539 | 541 | if v := os.Getenv("TF_ACC"); v == "" {
|
540 | 542 | t.Skip("Acceptance tests and bootstrapping skipped unless env 'TF_ACC' set")
|
541 | 543 | return nil
|
542 | 544 | }
|
543 | 545 |
|
544 |
| - config := &Config{ |
| 546 | + config := &transport_tpg.Config{ |
545 | 547 | Credentials: GetTestCredsFromEnv(),
|
546 | 548 | Project: GetTestProjectFromEnv(),
|
547 | 549 | Region: GetTestRegionFromEnv(),
|
548 | 550 | Zone: GetTestZoneFromEnv(),
|
549 | 551 | }
|
550 | 552 |
|
551 |
| - ConfigureBasePaths(config) |
| 553 | + transport_tpg.ConfigureBasePaths(config) |
552 | 554 |
|
553 | 555 | if err := config.LoadAndValidate(context.Background()); err != nil {
|
554 | 556 | t.Fatalf("Bootstrapping failed. Unable to load test config: %s", err)
|
|
0 commit comments