github.com/turtlemonvh/terraform@v0.6.9-0.20151204001754-8e40b6b855e8/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_REGION_NAME = "" 13 OS_POOL_NAME = "" 14 ) 15 16 var testAccProviders map[string]terraform.ResourceProvider 17 var testAccProvider *schema.Provider 18 19 func init() { 20 testAccProvider = Provider().(*schema.Provider) 21 testAccProviders = map[string]terraform.ResourceProvider{ 22 "openstack": testAccProvider, 23 } 24 } 25 26 func TestProvider(t *testing.T) { 27 if err := Provider().(*schema.Provider).InternalValidate(); err != nil { 28 t.Fatalf("err: %s", err) 29 } 30 } 31 32 func TestProvider_impl(t *testing.T) { 33 var _ terraform.ResourceProvider = Provider() 34 } 35 36 func testAccPreCheck(t *testing.T) { 37 v := os.Getenv("OS_AUTH_URL") 38 if v == "" { 39 t.Fatal("OS_AUTH_URL must be set for acceptance tests") 40 } 41 42 v = os.Getenv("OS_REGION_NAME") 43 if v != "" { 44 OS_REGION_NAME = v 45 } 46 47 v1 := os.Getenv("OS_IMAGE_ID") 48 v2 := os.Getenv("OS_IMAGE_NAME") 49 50 if v1 == "" || v2 == "" { 51 t.Fatal("OS_IMAGE_ID and OS_IMAGE_NAME must be set for acceptance tests") 52 } 53 54 v = os.Getenv("OS_POOL_NAME") 55 if v == "" { 56 t.Fatal("OS_POOL_NAME must be set for acceptance tests") 57 } 58 OS_POOL_NAME = v 59 60 v1 = os.Getenv("OS_FLAVOR_ID") 61 v2 = os.Getenv("OS_FLAVOR_NAME") 62 if v1 == "" && v2 == "" { 63 t.Fatal("OS_FLAVOR_ID or OS_FLAVOR_NAME must be set for acceptance tests") 64 } 65 66 v = os.Getenv("OS_NETWORK_ID") 67 if v == "" { 68 t.Fatal("OS_NETWORK_ID must be set for acceptance tests") 69 } 70 }