Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow overriding the base path for a URL with custom endpoints #811

Merged
merged 1 commit into from
Jun 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions google-beta/bootstrap_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@ func BootstrapKMSKeyInLocation(t *testing.T, locationID string) bootstrappedKMS
keyParent := fmt.Sprintf("projects/%s/locations/%s/keyRings/%s", projectID, locationID, SharedKeyRing)
keyName := fmt.Sprintf("%s/cryptoKeys/%s", keyParent, SharedCyptoKey)

config := Config{
config := &Config{
Credentials: getTestCredsFromEnv(),
Project: getTestProjectFromEnv(),
Region: getTestRegionFromEnv(),
Zone: getTestZoneFromEnv(),
}

ConfigureBasePaths(config)

if err := config.LoadAndValidate(); err != nil {
t.Errorf("Unable to bootstrap KMS key: %s", err)
}
Expand Down Expand Up @@ -116,7 +118,7 @@ var serviceAccountDisplay = "Bootstrapped Service Account for Terraform tests"
// Some tests need a second service account, other than the test runner, to assert functionality on.
// This provides a well-known service account that can be used when dynamically creating a service
// account isn't an option.
func getOrCreateServiceAccount(config Config, project string) (*iam.ServiceAccount, error) {
func getOrCreateServiceAccount(config *Config, project string) (*iam.ServiceAccount, error) {
name := fmt.Sprintf("projects/%s/serviceAccounts/%s@%s.iam.gserviceaccount.com", project, serviceAccountEmail, project)
log.Printf("[DEBUG] Verifying %s as bootstrapped service account.\n", name)

Expand Down Expand Up @@ -148,7 +150,7 @@ func getOrCreateServiceAccount(config Config, project string) (*iam.ServiceAccou
// on a different service account. Granting permissions takes time and there is no operation to wait on
// so instead this creates a single service account once per test-suite with the correct permissions.
// The first time this test is run it will fail, but subsequent runs will succeed.
func impersonationServiceAccountPermissions(config Config, sa *iam.ServiceAccount, testRunner string) error {
func impersonationServiceAccountPermissions(config *Config, sa *iam.ServiceAccount, testRunner string) error {
log.Printf("[DEBUG] Setting service account permissions.\n")
policy := iam.Policy{
Bindings: []*iam.Binding{},
Expand Down Expand Up @@ -179,13 +181,15 @@ func BootstrapServiceAccount(t *testing.T, project, testRunner string) string {
return ""
}

config := Config{
config := &Config{
Credentials: getTestCredsFromEnv(),
Project: getTestProjectFromEnv(),
Region: getTestRegionFromEnv(),
Zone: getTestZoneFromEnv(),
}

ConfigureBasePaths(config)

if err := config.LoadAndValidate(); err != nil {
t.Fatalf("Bootstrapping failed. Unable to load test config: %s", err)
}
Expand Down
Loading