Skip to content

Commit

Permalink
Fix project naming strategy for BootstrapProject to produce valid nam…
Browse files Browse the repository at this point in the history
…es in all envs
  • Loading branch information
roaks3 committed Mar 2, 2023
1 parent e7e0f27 commit 4923bf8
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions mmv1/third_party/terraform/utils/bootstrap_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,16 +418,20 @@ func removeContainerServiceAgentRoleFromContainerEngineRobot(t *testing.T, proje
}
}

// BootstrapProject will create or get a project named "<projectIDPrefix><testProjectFromEnv>"
// that will persist across test runs. The reason for the naming is to isolate
// bootstrapped projects by test environment.
// BootstrapProject will create or get a project named
// "<projectIDPrefix><projectIDSuffix>" that will persist across test runs,
// where projectIDSuffix is based off of getTestProjectFromEnv(). The reason
// for the naming is to isolate bootstrapped projects by test environment.
// Given the existing projects being used by our team, the prefix provided to
// this function can be no longer than 18 characters.
func BootstrapProject(t *testing.T, projectIDPrefix, billingAccount string, services []string) *cloudresourcemanager.Project {
config := BootstrapConfig(t)
if config == nil {
return nil
}

projectID := fmt.Sprintf("%s%s", projectIDPrefix, getTestProjectFromEnv())
projectIDSuffix = strings.Replace(getTestProjectFromEnv(), "ci-test-project-", "", 1)
projectID := projectIDPrefix + projectIDSuffix

crmClient := config.NewResourceManagerClient(config.userAgent)

Expand Down

0 comments on commit 4923bf8

Please sign in to comment.