Skip to content

Commit

Permalink
[Terraform]: Require a provider zone to be set in tests (#1087)
Browse files Browse the repository at this point in the history
Merged PR #1087.
  • Loading branch information
rileykarson authored and modular-magician committed Dec 20, 2018
1 parent facff5b commit a245cf0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build/terraform
2 changes: 1 addition & 1 deletion build/terraform-beta
10 changes: 10 additions & 0 deletions third_party/terraform/utils/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ var regionEnvVars = []string{
"CLOUDSDK_COMPUTE_REGION",
}

var zoneEnvVars = []string{
"GOOGLE_ZONE",
"GCLOUD_ZONE",
"CLOUDSDK_COMPUTE_ZONE",
}

var orgEnvVars = []string{
"GOOGLE_ORG",
}
Expand Down Expand Up @@ -97,6 +103,10 @@ func testAccPreCheck(t *testing.T) {
if v := multiEnvSearch(regionEnvVars); v != "us-central1" {
t.Fatalf("One of %s must be set to us-central1 for acceptance tests", strings.Join(regionEnvVars, ", "))
}

if v := multiEnvSearch(zoneEnvVars); v != "us-central1-a" {
t.Fatalf("One of %s must be set to us-central1-a for acceptance tests", strings.Join(zoneEnvVars, ", "))
}
}

func TestProvider_getRegionFromZone(t *testing.T) {
Expand Down

0 comments on commit a245cf0

Please sign in to comment.