github.com/hobbeswalsh/terraform@v0.3.7-0.20150619183303-ad17cf55a0fa/builtin/providers/azure/provider_test.go (about) 1 package azure 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 testAccProviders map[string]terraform.ResourceProvider 12 var testAccProvider *schema.Provider 13 14 const testAccSecurityGroupName = "terraform-security-group" 15 16 // testAccStorageServiceName is used as the name for the Storage Service 17 // created in all storage-related tests. 18 // It is much more convenient to provide a Storage Service which 19 // has been created beforehand as the creation of one takes a lot 20 // and would greatly impede the multitude of tests which rely on one. 21 // NOTE: the storage container should be located in `West US`. 22 var testAccStorageServiceName = os.Getenv("AZURE_STORAGE") 23 24 const testAccStorageContainerName = "terraform-testing-container" 25 26 func init() { 27 testAccProvider = Provider().(*schema.Provider) 28 testAccProviders = map[string]terraform.ResourceProvider{ 29 "azure": testAccProvider, 30 } 31 } 32 33 func TestProvider(t *testing.T) { 34 if err := Provider().(*schema.Provider).InternalValidate(); err != nil { 35 t.Fatalf("err: %s", err) 36 } 37 } 38 39 func TestProvider_impl(t *testing.T) { 40 var _ terraform.ResourceProvider = Provider() 41 } 42 43 func testAccPreCheck(t *testing.T) { 44 if v := os.Getenv("AZURE_SETTINGS_FILE"); v == "" { 45 subscriptionID := os.Getenv("AZURE_SUBSCRIPTION_ID") 46 certificate := os.Getenv("AZURE_CERTIFICATE") 47 48 if subscriptionID == "" || certificate == "" { 49 t.Fatal("either AZURE_SETTINGS_FILE, or AZURE_SUBSCRIPTION_ID " + 50 "and AZURE_CERTIFICATE must be set for acceptance tests") 51 } 52 } 53 54 if v := os.Getenv("AZURE_STORAGE"); v == "" { 55 t.Fatal("AZURE_STORAGE must be set for acceptance tests") 56 } 57 }