From 9aebe3344a9b0268b322b227fbe1421e44d15c09 Mon Sep 17 00:00:00 2001 From: stack72 Date: Tue, 13 Dec 2016 19:29:23 +0000 Subject: [PATCH] provider/google: Moving the XPN EnvVar check into provider_test.go to stop failed build --- builtin/providers/google/provider_test.go | 4 ++++ builtin/providers/google/resource_compute_instance_test.go | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/builtin/providers/google/provider_test.go b/builtin/providers/google/provider_test.go index 35a1b3c06..b6f6859e4 100644 --- a/builtin/providers/google/provider_test.go +++ b/builtin/providers/google/provider_test.go @@ -74,6 +74,10 @@ func testAccPreCheck(t *testing.T) { if v := multiEnvSearch(regs); v != "us-central1" { t.Fatalf("One of %s must be set to us-central1 for acceptance tests", strings.Join(regs, ", ")) } + + if v := os.Getenv("GOOGLE_XPN_HOST_PROJECT"); v == "" { + t.Fatal("GOOGLE_XPN_HOST_PROJECT must be set for acceptance tests") + } } func TestProvider_getRegionFromZone(t *testing.T) { diff --git a/builtin/providers/google/resource_compute_instance_test.go b/builtin/providers/google/resource_compute_instance_test.go index 62683509a..2a254b911 100644 --- a/builtin/providers/google/resource_compute_instance_test.go +++ b/builtin/providers/google/resource_compute_instance_test.go @@ -423,9 +423,6 @@ func TestAccComputeInstance_subnet_xpn(t *testing.T) { var instance compute.Instance var instanceName = fmt.Sprintf("instance-test-%s", acctest.RandString(10)) var xpn_host = os.Getenv("GOOGLE_XPN_HOST_PROJECT") - if xpn_host == "" { - t.Fatal("GOOGLE_XPN_HOST_PROJECT must be set for TestAccComputeInstance_subnet_xpn test") - } resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) },