github.com/recobe182/terraform@v0.8.5-0.20170117231232-49ab22a935b7/builtin/providers/openstack/provider_test.go (about) 1 package openstack 2 3 import ( 4 "os" 5 "testing" 6 7 "github.com/hashicorp/terraform/helper/schema" 8 "github.com/hashicorp/terraform/terraform" 9 ) 10 11 var ( 12 OS_EXTGW_ID = os.Getenv("OS_EXTGW_ID") 13 OS_FLAVOR_ID = os.Getenv("OS_FLAVOR_ID") 14 OS_FLAVOR_NAME = os.Getenv("OS_FLAVOR_NAME") 15 OS_IMAGE_ID = os.Getenv("OS_IMAGE_ID") 16 OS_IMAGE_NAME = os.Getenv("OS_IMAGE_NAME") 17 OS_NETWORK_ID = os.Getenv("OS_NETWORK_ID") 18 OS_POOL_NAME = os.Getenv("OS_POOL_NAME") 19 OS_REGION_NAME = os.Getenv("OS_REGION_NAME") 20 ) 21 22 var testAccProviders map[string]terraform.ResourceProvider 23 var testAccProvider *schema.Provider 24 25 func init() { 26 testAccProvider = Provider().(*schema.Provider) 27 testAccProviders = map[string]terraform.ResourceProvider{ 28 "openstack": testAccProvider, 29 } 30 } 31 32 func TestProvider(t *testing.T) { 33 if err := Provider().(*schema.Provider).InternalValidate(); err != nil { 34 t.Fatalf("err: %s", err) 35 } 36 } 37 38 func TestProvider_impl(t *testing.T) { 39 var _ terraform.ResourceProvider = Provider() 40 } 41 42 func testAccPreCheck(t *testing.T) { 43 v := os.Getenv("OS_AUTH_URL") 44 if v == "" { 45 t.Fatal("OS_AUTH_URL must be set for acceptance tests") 46 } 47 48 if OS_IMAGE_ID == "" || OS_IMAGE_NAME == "" { 49 t.Fatal("OS_IMAGE_ID and OS_IMAGE_NAME must be set for acceptance tests") 50 } 51 52 if OS_POOL_NAME == "" { 53 t.Fatal("OS_POOL_NAME must be set for acceptance tests") 54 } 55 56 if OS_FLAVOR_ID == "" && OS_FLAVOR_NAME == "" { 57 t.Fatal("OS_FLAVOR_ID or OS_FLAVOR_NAME must be set for acceptance tests") 58 } 59 60 if OS_NETWORK_ID == "" { 61 t.Fatal("OS_NETWORK_ID must be set for acceptance tests") 62 } 63 64 if OS_EXTGW_ID == "" { 65 t.Fatal("OS_EXTGW_ID must be set for acceptance tests") 66 } 67 }