the XPN_* env. variable is no longer mandatory (#760)

Since this variable is only used for 3 tests, it doesn't make sense
to declare it as mandatory in the test config. Therefore, concerned tests
are now skipped if the variable is absent.
This commit is contained in:
thomas 2017-11-17 19:32:46 +01:00 committed by Vincent Roseberry
parent aa63af1fc3
commit ecdb1de297
4 changed files with 6 additions and 4 deletions

View File

@ -70,10 +70,6 @@ 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 := 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) {

View File

@ -90,6 +90,8 @@ func TestAccComputeDisk_update(t *testing.T) {
func TestAccComputeDisk_fromSnapshot(t *testing.T) {
t.Parallel()
skipIfEnvNotSet(t, "GOOGLE_XPN_HOST_PROJECT")
diskName := fmt.Sprintf("tf-test-%s", acctest.RandString(10))
firstDiskName := fmt.Sprintf("tf-test-%s", acctest.RandString(10))
snapshotName := fmt.Sprintf("tf-test-%s", acctest.RandString(10))

View File

@ -178,6 +178,8 @@ func TestAccComputeInstanceTemplate_subnet_custom(t *testing.T) {
func TestAccComputeInstanceTemplate_subnet_xpn(t *testing.T) {
t.Parallel()
skipIfEnvNotSet(t, "GOOGLE_XPN_HOST_PROJECT")
var instanceTemplate compute.InstanceTemplate
var xpn_host = os.Getenv("GOOGLE_XPN_HOST_PROJECT")

View File

@ -587,6 +587,8 @@ func TestAccComputeInstance_subnet_custom(t *testing.T) {
func TestAccComputeInstance_subnet_xpn(t *testing.T) {
t.Parallel()
skipIfEnvNotSet(t, "GOOGLE_XPN_HOST_PROJECT")
var instance compute.Instance
var instanceName = fmt.Sprintf("instance-test-%s", acctest.RandString(10))
var xpn_host = os.Getenv("GOOGLE_XPN_HOST_PROJECT")