Skip to content

Commit

Permalink
chore(ci): remove firestore project and its reference (GoogleCloudPla…
Browse files Browse the repository at this point in the history
  • Loading branch information
iyabchen authored May 7, 2024
1 parent d20b9dd commit c6ac001
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 84 deletions.
2 changes: 0 additions & 2 deletions mmv1/api/resource/examples.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ type Examples struct {
// test_env_vars is a Hash from template variable names to one of the
// following symbols:
// - :PROJECT_NAME
// - :FIRESTORE_PROJECT_NAME
// - :CREDENTIALS
// - :REGION
// - :ORG_ID
Expand Down Expand Up @@ -238,7 +237,6 @@ func ExecuteTemplate(e any, templatePath string) string {
// func (e *Examples) config_documentation(pwd) {
// docs_defaults = {
// PROJECT_NAME: 'my-project-name',
// FIRESTORE_PROJECT_NAME: 'my-project-name',
// CREDENTIALS: 'my/credentials/filename.json',
// REGION: 'us-west1',
// ORG_ID: '123456789',
Expand Down
62 changes: 30 additions & 32 deletions mmv1/provider/template_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,22 +131,21 @@ func (td *TemplateData) GenerateTestFile(filePath string, resource api.Resource)
templatePath,
}
tmplInput := TestInput{
Res: resource,
ImportPath: td.ImportPath(),
PROJECT_NAME: "my-project-name",
FIRESTORE_PROJECT_NAME: "my-project-name",
CREDENTIALS: "my/credentials/filename.json",
REGION: "us-west1",
ORG_ID: "123456789",
ORG_DOMAIN: "example.com",
ORG_TARGET: "123456789",
PROJECT_NUMBER: "1111111111111",
BILLING_ACCT: "000000-0000000-0000000-000000",
MASTER_BILLING_ACCT: "000000-0000000-0000000-000000",
SERVICE_ACCT: "[email protected]",
CUST_ID: "A01b123xz",
IDENTITY_USER: "cloud_identity_user",
PAP_DESCRIPTION: "description",
Res: resource,
ImportPath: td.ImportPath(),
PROJECT_NAME: "my-project-name",
CREDENTIALS: "my/credentials/filename.json",
REGION: "us-west1",
ORG_ID: "123456789",
ORG_DOMAIN: "example.com",
ORG_TARGET: "123456789",
PROJECT_NUMBER: "1111111111111",
BILLING_ACCT: "000000-0000000-0000000-000000",
MASTER_BILLING_ACCT: "000000-0000000-0000000-000000",
SERVICE_ACCT: "[email protected]",
CUST_ID: "A01b123xz",
IDENTITY_USER: "cloud_identity_user",
PAP_DESCRIPTION: "description",
}

td.GenerateFile(filePath, templatePath, tmplInput, true, templates...)
Expand Down Expand Up @@ -283,20 +282,19 @@ func (td *TemplateData) ImportPath() string {
}

type TestInput struct {
Res api.Resource
ImportPath string
PROJECT_NAME string
FIRESTORE_PROJECT_NAME string
CREDENTIALS string
REGION string
ORG_ID string
ORG_DOMAIN string
ORG_TARGET string
PROJECT_NUMBER string
BILLING_ACCT string
MASTER_BILLING_ACCT string
SERVICE_ACCT string
CUST_ID string
IDENTITY_USER string
PAP_DESCRIPTION string
Res api.Resource
ImportPath string
PROJECT_NAME string
CREDENTIALS string
REGION string
ORG_ID string
ORG_DOMAIN string
ORG_TARGET string
PROJECT_NUMBER string
BILLING_ACCT string
MASTER_BILLING_ACCT string
SERVICE_ACCT string
CUST_ID string
IDENTITY_USER string
PAP_DESCRIPTION string
}
2 changes: 0 additions & 2 deletions mmv1/provider/terraform/examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class Examples < Google::YamlValidator
# test_env_vars is a Hash from template variable names to one of the
# following symbols:
# - :PROJECT_NAME
# - :FIRESTORE_PROJECT_NAME
# - :CREDENTIALS
# - :REGION
# - :ORG_ID
Expand Down Expand Up @@ -151,7 +150,6 @@ class Examples < Google::YamlValidator
def config_documentation(pwd)
docs_defaults = {
PROJECT_NAME: 'my-project-name',
FIRESTORE_PROJECT_NAME: 'my-project-name',
CREDENTIALS: 'my/credentials/filename.json',
REGION: 'us-west1',
ORG_ID: '123456789',
Expand Down
2 changes: 0 additions & 2 deletions mmv1/templates/terraform/env_var_context.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
"<%= var_name -%>": envvar.GetTestProjectFromEnv(),
<% elsif var_type == :PROJECT_NUMBER -%>
"<%= var_name -%>": envvar.GetTestProjectNumberFromEnv(),
<% elsif var_type == :FIRESTORE_PROJECT_NAME -%>
"<%= var_name -%>": envvar.GetTestFirestoreProjectFromEnv(t),
<% elsif var_type == :CUST_ID -%>
"<%= var_name -%>": envvar.GetTestCustIdFromEnv(t),
<% elsif var_type == :IDENTITY_USER -%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ func TestAcc{{ $e.TestSlug $.Res.ProductMetadata.Name $.Res.Name }}(t *testing.T
"{{$varKey}}": envvar.GetTestProjectFromEnv(),
{{- else if eq $varVal $.PROJECT_NUMBER }}
"{{$varKey}}": envvar.GetTestProjectNumberFromEnv(),
{{- else if eq $varVal $.FIRESTORE_PROJECT_NAME }}
"{{$varKey}}": envvar.GetTestFirestoreProjectFromEnv(t),
{{- else if eq $varVal $.CUST_ID }}
"{{$varKey}}": envvar.GetTestCustIdFromEnv(t),
{{- else if eq $varVal $.IDENTITY_USER }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ The next step is provide some input values that the configuration needs to fully
| identityUserGa | Used to set the [GOOGLE_IDENTITY_USER](https://github.com/GoogleCloudPlatform/magic-modules/blob/94a3f91d75ee823c521a0d8d3984a1493fa0926a/mmv1/third_party/terraform/envvar/envvar_utils.go#L58-L63) environment variable in acceptance tests - GA specific |
| identityUserBeta | Used to set the [GOOGLE_IDENTITY_USER](https://github.com/GoogleCloudPlatform/magic-modules/blob/94a3f91d75ee823c521a0d8d3984a1493fa0926a/mmv1/third_party/terraform/envvar/envvar_utils.go#L58-L63) environment variable in acceptance tests - Beta specific |
| identityUserVcr | Used to set the [GOOGLE_IDENTITY_USER](https://github.com/GoogleCloudPlatform/magic-modules/blob/94a3f91d75ee823c521a0d8d3984a1493fa0926a/mmv1/third_party/terraform/envvar/envvar_utils.go#L58-L63) environment variable in acceptance tests - VCR specific |
| firestoreProjectGa | Used to set the [GOOGLE_FIRESTORE_PROJECT](https://github.com/GoogleCloudPlatform/magic-modules/blob/94a3f91d75ee823c521a0d8d3984a1493fa0926a/mmv1/third_party/terraform/envvar/envvar_utils.go#L32-L34) environment variable in acceptance tests - GA specific |
| firestoreProjectBeta | Used to set the [GOOGLE_FIRESTORE_PROJECT](https://github.com/GoogleCloudPlatform/magic-modules/blob/94a3f91d75ee823c521a0d8d3984a1493fa0926a/mmv1/third_party/terraform/envvar/envvar_utils.go#L32-L34) environment variable in acceptance tests - Beta specific |
| firestoreProjectVcr | Used to set the [GOOGLE_FIRESTORE_PROJECT](https://github.com/GoogleCloudPlatform/magic-modules/blob/94a3f91d75ee823c521a0d8d3984a1493fa0926a/mmv1/third_party/terraform/envvar/envvar_utils.go#L32-L34) environment variable in acceptance tests - VCR specific |
| masterBillingAccountGa | Used to set the [GOOGLE_MASTER_BILLING_ACCOUNT](https://github.com/GoogleCloudPlatform/magic-modules/blob/94a3f91d75ee823c521a0d8d3984a1493fa0926a/mmv1/third_party/terraform/envvar/envvar_utils.go#L87-L91) environment variable in acceptance tests - GA specific |
| masterBillingAccountBeta | Used to set the [GOOGLE_MASTER_BILLING_ACCOUNT](https://github.com/GoogleCloudPlatform/magic-modules/blob/94a3f91d75ee823c521a0d8d3984a1493fa0926a/mmv1/third_party/terraform/envvar/envvar_utils.go#L87-L91) environment variable in acceptance tests - Beta specific |
| masterBillingAccountVcr | Used to set the [GOOGLE_MASTER_BILLING_ACCOUNT](https://github.com/GoogleCloudPlatform/magic-modules/blob/94a3f91d75ee823c521a0d8d3984a1493fa0926a/mmv1/third_party/terraform/envvar/envvar_utils.go#L87-L91) environment variable in acceptance tests - VCR specific |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ class AllContextParameters(
val identityUserBeta: String,
val identityUserVcr: String,

// GOOGLE_FIRESTORE_PROJECT
val firestoreProjectGa: String,
val firestoreProjectBeta: String,
val firestoreProjectVcr: String,

// GOOGLE_MASTER_BILLING_ACCOUNT
val masterBillingAccountGa: String,
val masterBillingAccountBeta: String,
Expand Down Expand Up @@ -81,7 +76,6 @@ class AccTestConfiguration(
val billingAccount2: String,
val credentials: String,
val custId: String,
val firestoreProject: String,
val identityUser: String,
val masterBillingAccount: String,
val org: String,
Expand All @@ -104,7 +98,6 @@ fun getGaAcceptanceTestConfig(allConfig: AllContextParameters): AccTestConfigura
allConfig.billingAccount2,
allConfig.credentialsGa,
allConfig.custId,
allConfig.firestoreProjectGa,
allConfig.identityUserGa,
allConfig.masterBillingAccountGa,
allConfig.org,
Expand All @@ -126,7 +119,6 @@ fun getBetaAcceptanceTestConfig(allConfig: AllContextParameters): AccTestConfigu
allConfig.billingAccount2,
allConfig.credentialsBeta,
allConfig.custId,
allConfig.firestoreProjectBeta,
allConfig.identityUserBeta,
allConfig.masterBillingAccountBeta,
allConfig.org,
Expand All @@ -148,7 +140,6 @@ fun getVcrAcceptanceTestConfig(allConfig: AllContextParameters): AccTestConfigur
allConfig.billingAccount2,
allConfig.credentialsVcr,
allConfig.custId,
allConfig.firestoreProjectVcr,
allConfig.identityUserVcr,
allConfig.masterBillingAccountVcr,
allConfig.org,
Expand Down Expand Up @@ -179,7 +170,6 @@ fun ParametrizedWithType.configureGoogleSpecificTestParameters(config: AccTestCo
hiddenVariable("env.GOOGLE_REGION", config.region, "The google region to use")
hiddenVariable("env.GOOGLE_SERVICE_ACCOUNT", config.serviceAccount, "The service account")
hiddenVariable("env.GOOGLE_ZONE", config.zone, "The google zone to use")
hiddenVariable("env.GOOGLE_FIRESTORE_PROJECT", config.firestoreProject, "The project to use for firestore")
hiddenVariable("env.GOOGLE_IDENTITY_USER", config.identityUser, "The user for the identity platform")
hiddenPasswordVariable("env.GOOGLE_CREDENTIALS", config.credentials, "The Google credentials for this test runner")
}
Expand Down Expand Up @@ -280,4 +270,4 @@ fun ParametrizedWithType.hiddenVariable(name: String, value: String, description

fun ParametrizedWithType.hiddenPasswordVariable(name: String, value: String, description: String) {
password(name, value, "", description, ParameterDisplay.HIDDEN)
}
}
9 changes: 1 addition & 8 deletions mmv1/third_party/terraform/.teamcity/settings.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ val projectNumberVcr = DslContext.getParameter("projectNumberVcr", "")
val identityUserGa = DslContext.getParameter("identityUserGa", "")
val identityUserBeta = DslContext.getParameter("identityUserBeta", "")
val identityUserVcr = DslContext.getParameter("identityUserVcr", "")
// GOOGLE_FIRESTORE_PROJECT
val firestoreProjectGa = DslContext.getParameter("firestoreProjectGa", "")
val firestoreProjectBeta = DslContext.getParameter("firestoreProjectBeta", "")
val firestoreProjectVcr = DslContext.getParameter("firestoreProjectVcr", "")
// GOOGLE_MASTER_BILLING_ACCOUNT
val masterBillingAccountGa = DslContext.getParameter("masterBillingAccountGa", "")
val masterBillingAccountBeta = DslContext.getParameter("masterBillingAccountBeta", "")
Expand Down Expand Up @@ -80,9 +76,6 @@ var allContextParams = AllContextParameters(
identityUserGa,
identityUserBeta,
identityUserVcr,
firestoreProjectGa,
firestoreProjectBeta,
firestoreProjectVcr,
masterBillingAccountGa,
masterBillingAccountBeta,
masterBillingAccountVcr,
Expand All @@ -102,4 +95,4 @@ var allContextParams = AllContextParameters(

// This is the entry point of the code in .teamcity/
// See https://teamcity.jetbrains.com/app/dsl-documentation/root/project.html
project(googleCloudRootProject(allContextParams))
project(googleCloudRootProject(allContextParams))
5 changes: 1 addition & 4 deletions mmv1/third_party/terraform/.teamcity/tests/test_utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ fun testContextParameters(): AllContextParameters {
"identityUserGa",
"identityUserBeta",
"identityUserVcr",
"firestoreProjectGa",
"firestoreProjectBeta",
"firestoreProjectVcr",
"masterBillingAccountGa",
"masterBillingAccountBeta",
"masterBillingAccountVcr",
Expand Down Expand Up @@ -78,4 +75,4 @@ fun getBuildFromProject(parentProject: Project, buildName: String): BuildType {
}

return buildType!!
}
}
11 changes: 0 additions & 11 deletions mmv1/third_party/terraform/envvar/envvar_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ var ProjectEnvVars = []string{
"CLOUDSDK_CORE_PROJECT",
}

var FirestoreProjectEnvVars = []string{
"GOOGLE_FIRESTORE_PROJECT",
}

var RegionEnvVars = []string{
"GOOGLE_REGION",
"GCLOUD_REGION",
Expand Down Expand Up @@ -152,13 +148,6 @@ func GetTestIdentityUserFromEnv(t *testing.T) string {
return transport_tpg.MultiEnvSearch(IdentityUserEnvVars)
}

// Firestore can't be enabled at the same time as Datastore, so we need a new
// project to manage it until we can enable Firestore programmatically.
func GetTestFirestoreProjectFromEnv(t *testing.T) string {
SkipIfEnvNotSet(t, FirestoreProjectEnvVars...)
return transport_tpg.MultiEnvSearch(FirestoreProjectEnvVars)
}

// Returns the raw organization id like 1234567890, skipping the test if one is
// not found.
func GetTestOrgFromEnv(t *testing.T) string {
Expand Down
7 changes: 0 additions & 7 deletions mmv1/third_party/tgc/tests/source/environment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const (
defaultAncestry = "organization/12345/folder/67890"
defaultBillingAccount = "000AA0-A0B00A-AA00AA"
defaultCustId = "A00ccc00a"
defaultFirestoreProject = "firebar"
defaultFolder = "67890"
defaultIdentityUser = "foo"
defaultOrganization = "12345"
Expand Down Expand Up @@ -69,12 +68,6 @@ func getTestIdentityUserFromEnv(t *testing.T) string {
return defaultIdentityUser
}

// Firestore can't be enabled at the same time as Datastore, so we need a new
// project to manage it until we can enable Firestore programmatically.
func getTestFirestoreProjectFromEnv(t *testing.T) string {
return defaultFirestoreProject
}

func getTestOrgFromEnv(t *testing.T) string {
org, ok := os.LookupEnv("TEST_ORG_ID")
if !ok {
Expand Down

0 comments on commit c6ac001

Please sign in to comment.