Skip to content

Commit

Permalink
Add envvar GOOGLE_CHRONICLE_INSTANCE_ID for tests (#12536)
Browse files Browse the repository at this point in the history
[upstream:0052688447f35fe46cecb1f418520295f9007b9c]

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician committed Dec 18, 2024
1 parent 3c9bb91 commit a24fe0a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/12536.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
12 changes: 12 additions & 0 deletions google-beta/envvar/envvar_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ var PapDescriptionEnvVars = []string{
"GOOGLE_PUBLIC_AVERTISED_PREFIX_DESCRIPTION",
}

// This value is the instance id of a pre-configured Chronicle instance, for the purpose of
// integration tests. It is needed because the instance is 1-to-1 with a test project, and it
// cannot be created within the test org.
var ChronicleInstanceIdEnvVars = []string{
"GOOGLE_CHRONICLE_INSTANCE_ID",
}

var ImpersonateServiceAccountEnvVars = []string{
"GOOGLE_IMPERSONATE_SERVICE_ACCOUNT",
}
Expand Down Expand Up @@ -205,6 +212,11 @@ func GetTestPublicAdvertisedPrefixDescriptionFromEnv(t *testing.T) string {
return transport_tpg.MultiEnvSearch(PapDescriptionEnvVars)
}

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

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 a24fe0a

Please sign in to comment.