Skip to content

Commit

Permalink
Add GOOGLE_VMWAREENGINE_PROJECT env var for vmwareengine tests (#12707)
Browse files Browse the repository at this point in the history
[upstream:415b35bae8e1e92e6949d472b987105f369be650]

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician committed Jan 8, 2025
1 parent 3202217 commit 89a807c
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/12707.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
10 changes: 10 additions & 0 deletions .teamcity/components/builds/build_parameters.kt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ class AllContextParameters(
val chronicleInstanceIdBeta: String,
val chronicleInstanceIdVcr: String,

// GOOGLE_VMWAREENGINE_PROJECT
val vmwareengineProjectGa: String,
val vmwareengineProjectBeta: String,
val vmwareengineProjectVcr: String,

// Values that are the same across GA, Beta, and VCR testing environments
val billingAccount: String, // GOOGLE_BILLING_ACCOUNT
val billingAccount2: String, // GOOGLE_BILLING_ACCOUNT_2
Expand Down Expand Up @@ -94,6 +99,7 @@ class AccTestConfiguration(
val projectNumber: String,
val region: String,
val serviceAccount: String,
val vmwareengineProject: String,
val zone: String,

// VCR specific
Expand All @@ -120,6 +126,7 @@ fun getGaAcceptanceTestConfig(allConfig: AllContextParameters): AccTestConfigura
allConfig.projectNumberGa,
allConfig.region,
allConfig.serviceAccountGa,
allConfig.vmwareengineProjectGa,
allConfig.zone,
allConfig.infraProject,
allConfig.vcrBucketName,
Expand All @@ -143,6 +150,7 @@ fun getBetaAcceptanceTestConfig(allConfig: AllContextParameters): AccTestConfigu
allConfig.projectNumberBeta,
allConfig.region,
allConfig.serviceAccountBeta,
allConfig.vmwareengineProjectBeta,
allConfig.zone,
allConfig.infraProject,
allConfig.vcrBucketName,
Expand All @@ -166,6 +174,7 @@ fun getVcrAcceptanceTestConfig(allConfig: AllContextParameters): AccTestConfigur
allConfig.projectNumberVcr,
allConfig.region,
allConfig.serviceAccountVcr,
allConfig.vmwareengineProjectVcr,
allConfig.zone,
allConfig.infraProject,
allConfig.vcrBucketName,
Expand All @@ -190,6 +199,7 @@ fun ParametrizedWithType.configureGoogleSpecificTestParameters(config: AccTestCo
hiddenVariable("env.GOOGLE_ZONE", config.zone, "The google zone to use")
hiddenVariable("env.GOOGLE_IDENTITY_USER", config.identityUser, "The user for the identity platform")
hiddenVariable("env.GOOGLE_CHRONICLE_INSTANCE_ID", config.chronicleInstanceId, "The id of the Chronicle instance")
hiddenVariable("env.GOOGLE_VMWAREENGINE_PROJECT", config.vmwareengineProject, "The project used for vmwareengine tests")
hiddenPasswordVariable("env.GOOGLE_CREDENTIALS", config.credentials, "The Google credentials for this test runner")
}

Expand Down
7 changes: 7 additions & 0 deletions .teamcity/settings.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ val org2Vcr = DslContext.getParameter("org2Vcr", "")
val chronicleInstanceIdGa = DslContext.getParameter("chronicleInstanceIdGa", "")
val chronicleInstanceIdBeta = DslContext.getParameter("chronicleInstanceIdBeta", "")
val chronicleInstanceIdVcr = DslContext.getParameter("chronicleInstanceIdVcr", "")
// GOOGLE_VMWAREENGINE_PROJECT
val vmwareengineProjectGa = DslContext.getParameter("vmwareengineProjectGa", "")
val vmwareengineProjectBeta = DslContext.getParameter("vmwareengineProjectBeta", "")
val vmwareengineProjectVcr = DslContext.getParameter("vmwareengineProjectVcr", "")

// Values that are the same across GA, Beta, and VCR testing environments
val billingAccount = DslContext.getParameter("billingAccount", "") // GOOGLE_BILLING_ACCOUNT
Expand Down Expand Up @@ -91,6 +95,9 @@ var allContextParams = AllContextParameters(
chronicleInstanceIdGa,
chronicleInstanceIdBeta,
chronicleInstanceIdVcr,
vmwareengineProjectGa,
vmwareengineProjectBeta,
vmwareengineProjectVcr,
billingAccount,
billingAccount2,
custId,
Expand Down
3 changes: 3 additions & 0 deletions .teamcity/tests/test_utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ fun testContextParameters(): AllContextParameters {
"chronicleInstanceIdGa",
"chronicleInstanceIdBeta",
"chronicleInstanceIdVcr",
"vmwareengineProjectGa",
"vmwareengineProjectBeta",
"vmwareengineProjectVcr",
"billingAccount",
"billingAccount2",
"custId",
Expand Down
11 changes: 11 additions & 0 deletions google/envvar/envvar_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ var ImpersonateServiceAccountEnvVars = []string{
"GOOGLE_IMPERSONATE_SERVICE_ACCOUNT",
}

// This value is the project used for vmwareengine tests. A separate project is needed
// due to the limited quota allocated to each testing project
var vmwareengineProjectEnvVars = []string{
"GOOGLE_VMWAREENGINE_PROJECT",
}

// AccTestPreCheck ensures at least one of the project env variables is set.
func GetTestProjectNumberFromEnv() string {
return transport_tpg.MultiEnvSearch(ProjectNumberEnvVars)
Expand Down Expand Up @@ -217,6 +223,11 @@ func GetTestChronicleInstanceIdFromEnv(t *testing.T) string {
return transport_tpg.MultiEnvSearch(ChronicleInstanceIdEnvVars)
}

func GetTestVmwareengineProjectFromEnv(t *testing.T) string {
SkipIfEnvNotSet(t, vmwareengineProjectEnvVars...)
return transport_tpg.MultiEnvSearch(vmwareengineProjectEnvVars)
}

func SkipIfEnvNotSet(t *testing.T, envs ...string) {
if t == nil {
log.Printf("[DEBUG] Not running inside of test - skip skipping")
Expand Down

0 comments on commit 89a807c

Please sign in to comment.