diff --git a/builtin/providers/google/provider_test.go b/builtin/providers/google/provider_test.go index 827a7f575..51654a668 100644 --- a/builtin/providers/google/provider_test.go +++ b/builtin/providers/google/provider_test.go @@ -1,6 +1,7 @@ package google import ( + "io/ioutil" "os" "testing" @@ -29,6 +30,14 @@ func TestProvider_impl(t *testing.T) { } func testAccPreCheck(t *testing.T) { + if v := os.Getenv("GOOGLE_CREDENTIALS_FILE"); v != "" { + creds, err := ioutil.ReadFile(v) + if err != nil { + t.Fatalf("Error reading GOOGLE_CREDENTIALS_FILE path: %s", err) + } + os.Setenv("GOOGLE_CREDENTIALS", string(creds)) + } + if v := os.Getenv("GOOGLE_CREDENTIALS"); v == "" { t.Fatal("GOOGLE_CREDENTIALS must be set for acceptance tests") }