From 1aacd62faf09dd214a9d70991aa282501aa198e9 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 --- provider_test.go | 4 ++++ resource_compute_instance_test.go | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/provider_test.go b/provider_test.go index 35a1b3c0..b6f6859e 100644 --- a/provider_test.go +++ b/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/resource_compute_instance_test.go b/resource_compute_instance_test.go index 62683509..2a254b91 100644 --- a/resource_compute_instance_test.go +++ b/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) },